Nearly everything for 1.19 is fixed (all that is left is generator & architectury)

This commit is contained in:
coolGi
2022-06-08 18:53:28 +09:30
parent 4ee1949873
commit a81fd9a483
13 changed files with 83 additions and 27 deletions
+6
View File
@@ -27,6 +27,12 @@ This branch is for these versions of Minecraft
Architectury version: 3.4-SNAPSHOT\
Java Compiler plugin: Manifold Preprocessor
#### 1.19 mods
Forge version: 41.0.1\
Fabric version: 0.14.6\
Fabric API version: 0.55.1+1.19\
Modmenu version: 4.0.0
#### 1.18.2 mods
Forge version: 40.0.18\
Fabric version: 0.13.3\
+16 -17
View File
@@ -89,9 +89,9 @@ subprojects { p ->
loom {
silentMojangMappingsLicense()
// if (p != project(":core")) {
// accessWidenerPath.set(project(":common").file("src/main/resources/${acsessWidenerVersion}.lod.accesswidener"))
// }
if (p != project(":core")) {
accessWidenerPath.set(project(":common").file("src/main/resources/${acsessWidenerVersion}.lod.accesswidener"))
}
}
configurations {
@@ -122,10 +122,10 @@ subprojects { p ->
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
}
// if (p != project(":core")) {
// common(project(":core")) { transitive false }
// shadowMe(project(":core")) { transitive false }
// }
if (p != project(":core")) {
common(project(":core")) { transitive false }
shadowMe(project(":core")) { transitive false }
}
}
// Allows the jar to run standalone
@@ -239,10 +239,10 @@ allprojects { p ->
rename "${rootProject.acsessWidenerVersion}.lod.accesswidener", "lod.accesswidener"
}
// task copyCoreResources(type: Copy) {
// from fileTree(project(":core").file("src/main/resources"))
// into p.file("build/resources/main")
// }
task copyCoreResources(type: Copy) {
from fileTree(project(":core").file("src/main/resources"))
into p.file("build/resources/main")
}
task copyCommonResources(type: Copy) {
from fileTree(project(":common").file("src/main/resources"))
@@ -277,12 +277,12 @@ allprojects { p ->
// println options.compilerArgs
// Set the java version
// if (p != project(":core")) {
if (p != project(":core")) {
options.compilerArgs += ['-Xplugin:Manifold']
options.release = rootProject.java_version as Integer
// } else if (p == project(":core")) {
// options.release = 8; // Core should use Java 8 no matter what
// }
} else if (p == project(":core")) {
options.release = 8; // Core should use Java 8 no matter what
}
// TODO: make everything use java 8
// options.release = 8 // Use Java 8 for everything so back porting is easier
}
@@ -292,8 +292,7 @@ allprojects { p ->
}
// Disable running the core and common
// if (p == project(":core") || p == project(":common")) {
if (p == project(":common")) {
if (p == project(":core") || p == project(":common")) {
runClient.enabled = false
runServer.enabled = false
}
@@ -22,6 +22,9 @@ package com.seibel.lod.common.forge;
import com.seibel.lod.common.wrappers.minecraft.MinecraftClientWrapper;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.core.Direction;
#if MC_1_19
import net.minecraft.util.RandomSource;
#endif
import net.minecraft.world.level.ColorResolver;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block;
@@ -36,7 +39,11 @@ import java.util.Random;
* @author Ran
*/
public interface LodForgeMethodCaller {
List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random);
#if PRE_MC_1_19
List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random); // FIXME: For 1.19
#else
List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random); // FIXME: For 1.19
#endif
int colorResolverGetColor(ColorResolver resolver, Biome biome, double x, double z);
}
@@ -50,6 +50,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Cursor3D;
import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.*;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block;
@@ -77,7 +78,11 @@ public class BlockDetailWrapper extends IBlockDetailWrapper
public static final int FLOWER_COLOR_SCALE = 5;
#if PRE_MC_1_19
public static final Random random = new Random(0);
#else
public static final RandomSource random = RandomSource.create();
#endif
enum ColorMode {
Default,
@@ -133,7 +133,11 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
@Override
public double getGamma()
{
#if PRE_MC_1_19
return MC.options.gamma;
#else
return MC.options.gamma().get();
#endif
}
@Override
@@ -6,7 +6,7 @@ accessible field net/minecraft/world/level/storage/DimensionDataStorage dataFold
# used when rendering
accessible field com/mojang/blaze3d/vertex/VertexBuffer indexCount I
accessible field com/mojang/blaze3d/vertex/VertexBuffer vertextBufferId I
#accessible field com/mojang/blaze3d/vertex/VertexBuffer vertextBufferId I #FIXME (is it needed for 1.19?)
accessible method net/minecraft/client/renderer/GameRenderer getFov (Lnet/minecraft/client/Camera;FZ)D
# used for grabbing vanilla rendered chunks
@@ -24,15 +24,15 @@ accessible field net/minecraft/world/level/lighting/LevelLightEngine skyEngine L
# world generation
accessible method net/minecraft/world/level/levelgen/Heightmap setHeight (III)V
accessible field net/minecraft/world/level/biome/Biome generationSettings Lnet/minecraft/world/level/biome/BiomeGenerationSettings;
accessible field net/minecraft/world/level/biome/Biome biomeCategory Lnet/minecraft/world/level/biome/Biome$BiomeCategory;
#accessible field net/minecraft/world/level/biome/Biome biomeCategory Lnet/minecraft/world/level/biome/Biome$BiomeCategory; #FIXME (is it needed for 1.19?)
# accessible field net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator settings Lnet/minecraft/core/Holder;
accessible method net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator doFill (Lnet/minecraft/world/level/levelgen/blending/Blender;Lnet/minecraft/world/level/StructureFeatureManager;Lnet/minecraft/world/level/chunk/ChunkAccess;II)Lnet/minecraft/world/level/chunk/ChunkAccess;
#accessible method net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator doCreateBiomes (Lnet/minecraft/core/Registry;Lnet/minecraft/world/level/levelgen/blending/Blender;Lnet/minecraft/world/level/StructureFeatureManager;Lnet/minecraft/world/level/chunk/ChunkAccess;)V
#accessible method net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator doFill (Lnet/minecraft/world/level/levelgen/blending/Blender;Lnet/minecraft/world/level/StructureFeatureManager;Lnet/minecraft/world/level/chunk/ChunkAccess;II)Lnet/minecraft/world/level/chunk/ChunkAccess; #FIXME (is it needed for 1.19?)
#accessible method net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator doCreateBiomes (Lnet/minecraft/core/Registry;Lnet/minecraft/world/level/levelgen/blending/Blender;Lnet/minecraft/world/level/StructureFeatureManager;Lnet/minecraft/world/level/chunk/ChunkAccess;)V #FIXME (is it needed for 1.19?)
accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V
# lod generation from save file
accessible field net/minecraft/server/level/ChunkMap mainThreadExecutor Lnet/minecraft/util/thread/BlockableEventLoop;
accessible method net/minecraft/server/level/ChunkMap readChunk (Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/nbt/CompoundTag;
#accessible method net/minecraft/server/level/ChunkMap readChunk (Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/nbt/CompoundTag; #FIXME (is it needed for 1.19?)
# grabbing textures
+2 -2
View File
@@ -100,13 +100,13 @@ task deleteResources(type: Delete) {
}
processResources {
// dependsOn(copyCoreResources)
dependsOn(copyCoreResources)
dependsOn(copyCommonResources)
dependsOn(copyAccessWidener)
}
runClient {
// dependsOn(copyCoreResources)
dependsOn(copyCoreResources)
dependsOn(copyCommonResources)
dependsOn(copyAccessWidener)
jvmArgs "-XX:-OmitStackTraceInFastThrow"
@@ -48,8 +48,12 @@ public class MixinFogRenderer {
private static final float A_REALLY_REALLY_BIG_VALUE = 420694206942069.F;
private static final float A_EVEN_LARGER_VALUE = 42069420694206942069.F;
@Inject(at = @At("RETURN"), method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZ)V")
@Inject(at = @At("RETURN"), method = "setupFog")
#if PRE_MC_1_19
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, CallbackInfo callback) {
#else
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float g, CallbackInfo callback) {
#endif
#if PRE_MC_1_17_1
FluidState fluidState = camera.getFluidInCamera();
boolean cameraNotInFluid = fluidState.isEmpty();
@@ -27,7 +27,9 @@ import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import net.minecraft.client.gui.screens.OptionsScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
#if PRE_MC_1_19
import net.minecraft.network.chat.TranslatableComponent;
#endif
import net.minecraft.resources.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -67,6 +69,10 @@ public class MixinOptionsScreen extends Screen {
// For now it goes to the client option by default
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, "client")),
// Add a title to the screen
#if PRE_MC_1_19
new TranslatableComponent("text.autoconfig." + ModInfo.ID + ".title")));
#else
Component.literal("text.autoconfig." + ModInfo.ID + ".title")));
#endif
}
}
+1 -1
View File
@@ -58,7 +58,7 @@ dependencies {
processResources {
dependsOn(copyAccessWidener)
// dependsOn(copyCoreResources)
dependsOn(copyCoreResources)
dependsOn(copyCommonResources)
}
@@ -35,6 +35,9 @@ import com.seibel.lod.forge.wrappers.modAccessor.OptifineAccessor;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.core.Direction;
#if MC_1_19
import net.minecraft.util.RandomSource;
#endif
import net.minecraft.world.level.ColorResolver;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block;
@@ -109,9 +112,15 @@ public class ForgeMain implements LodForgeMethodCaller
private final ModelDataMap dataMap = new ModelDataMap.Builder().build();
@Override
#if PRE_MC_1_19
public List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random) {
return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, dataMap);
}
#else
public List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random) {
return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, dataMap);
}
#endif
@Override
public int colorResolverGetColor(ColorResolver resolver, Biome biome, double x, double z) {
@@ -27,7 +27,9 @@ import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import net.minecraft.client.gui.screens.OptionsScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
#if PRE_MC_1_19
import net.minecraft.network.chat.TranslatableComponent;
#endif
import net.minecraft.resources.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -67,6 +69,10 @@ public class MixinOptionsScreen extends Screen {
// For now it goes to the client option by default
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, "client")),
// Add a title to the screen
#if PRE_MC_1_19
new TranslatableComponent("text.autoconfig." + ModInfo.ID + ".title")));
#else
Component.literal("text.autoconfig." + ModInfo.ID + ".title")));
#endif
}
}
@@ -37,7 +37,9 @@ import com.seibel.lod.forge.fabric.impl.networking.PacketCallbackListener;
import net.minecraft.network.Connection;
import net.minecraft.network.PacketListener;
import net.minecraft.network.chat.Component;
#if PRE_MC_1_19
import net.minecraft.network.chat.TranslatableComponent;
#endif
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.PacketFlow;
import net.minecraft.resources.ResourceLocation;
@@ -67,11 +69,19 @@ abstract class ClientConnectionMixin implements ChannelInfoHolder {
private void resendOnExceptionCaught(Connection self, Packet<?> packet, GenericFutureListener<? extends Future<? super Void>> listener) {
PacketListener handler = this.packetListener;
#if PRE_MC_1_19
if (handler instanceof DisconnectPacketSource) {
this.send(((DisconnectPacketSource) handler).createDisconnectPacket(new TranslatableComponent("disconnect.genericReason")), listener);
} else {
this.disconnect(new TranslatableComponent("disconnect.genericReason")); // Don't send packet if we cannot send proper packets
}
#else
if (handler instanceof DisconnectPacketSource) {
this.send(((DisconnectPacketSource) handler).createDisconnectPacket(Component.literal("disconnect.genericReason")), listener);
} else {
this.disconnect(Component.literal("disconnect.genericReason")); // Don't send packet if we cannot send proper packets
}
#endif
}
@Inject(method = "sendPacket", at = @At(value = "FIELD", target = "Lnet/minecraft/network/Connection;sentPackets:I"))