diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/WorldGeneratorWrapper.java b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/WorldGeneratorWrapper.java index f880a10c0..66bf540af 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/WorldGeneratorWrapper.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/WorldGeneratorWrapper.java @@ -206,14 +206,16 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper chunk.setStatus(ChunkStatus.STRUCTURE_REFERENCES); chunkGen.createBiomes(serverWorld.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), chunk); ChunkStatus.NOISE.generate(Executor, serverWorld, chunkGen, templateManager, lightEngine, null, chunkList); - // TODO: Find why this dosnt work (seems like the "Executor" is doing this) + // TODO: Find why this doesn't work (seems like the "Executor" is doing this) ChunkStatus.SURFACE.generate(Executor, serverWorld, chunkGen, templateManager, lightEngine, null, chunkList); // this feature has been proven to be thread safe, // so we will add it - FeaturePlaceContext featurePlaceContext = new FeaturePlaceContext<>(lodServerWorld, chunkGen, serverWorld.random, chunk.getPos().getWorldPosition(), null); - SnowAndFreezeFeature snowFeature = new SnowAndFreezeFeature(NoneFeatureConfiguration.CODEC); - snowFeature.place(featurePlaceContext); + + // TODO: Find why this doesn't work +// FeaturePlaceContext featurePlaceContext = new FeaturePlaceContext<>(lodServerWorld, chunkGen, serverWorld.random, chunk.getPos().getWorldPosition(), null); +// SnowAndFreezeFeature snowFeature = new SnowAndFreezeFeature(NoneFeatureConfiguration.CODEC); +// snowFeature.place(featurePlaceContext); lodBuilder.generateLodNodeFromChunk(lodDim, new ChunkWrapper(chunk), new LodBuilderConfig(DistanceGenerationMode.SURFACE)); diff --git a/common/src/main/resources/lod.accesswidener b/common/src/main/resources/lod.accesswidener index 17a99d6a7..ef7e09a30 100644 --- a/common/src/main/resources/lod.accesswidener +++ b/common/src/main/resources/lod.accesswidener @@ -30,3 +30,7 @@ accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite mainIm accessible method net/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture getFrameX (I)I accessible method net/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture getFrameY (I)I extendable class com/mojang/math/Matrix4f + +# hacky stuff +mutable field Lnet/minecraft/world/level/chunk/PalettedContainer traces Lnet/minecraft/util/DebugBuffer; +mutable field Lnet/minecraft/world/level/chunk/PalettedContainer lock Ljava/util/concurrent/Semaphore; \ No newline at end of file diff --git a/fabric/src/main/java/com/seibel/lod/fabric/mixins/unsafe/MixinPalettedContainer.java b/fabric/src/main/java/com/seibel/lod/fabric/mixins/unsafe/MixinPalettedContainer.java new file mode 100644 index 000000000..d1a513bcc --- /dev/null +++ b/fabric/src/main/java/com/seibel/lod/fabric/mixins/unsafe/MixinPalettedContainer.java @@ -0,0 +1,32 @@ +package com.seibel.lod.fabric.mixins.unsafe; + +import com.mojang.datafixers.util.Pair; +import net.minecraft.util.DebugBuffer; +import net.minecraft.world.level.chunk.PalettedContainer; +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Mutable; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.concurrent.Semaphore; + +/** + * NOTE: THIS IS NOT A FIX TO THE PROBLEM. + * TODO: Do/Find an actual fix to this + * + * @author Ran + */ +@Mixin(PalettedContainer.class) +public class MixinPalettedContainer { + @Mutable + @Shadow @Final private Semaphore lock; + + @Inject(method = "", at = @At("RETURN")) + private void setSemaphore(CallbackInfo ci) { + this.lock = new Semaphore(2); + } +} diff --git a/fabric/src/main/resources/lod.mixins.json b/fabric/src/main/resources/lod.mixins.json index c44a1469d..830a93764 100644 --- a/fabric/src/main/resources/lod.mixins.json +++ b/fabric/src/main/resources/lod.mixins.json @@ -3,7 +3,9 @@ "minVersion": "0.8", "package": "com.seibel.lod.fabric.mixins", "compatibilityLevel": "JAVA_16", - "mixins": [], + "mixins": [ + "unsafe.MixinPalettedContainer" + ], "client": [ "MixinMinecraft", "MixinOptionsScreen",