MixinPalettedContainer

This commit is contained in:
Ran
2021-12-09 19:09:55 +06:00
parent 56faf3fdb6
commit 297f53beaf
4 changed files with 45 additions and 5 deletions
@@ -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<NoneFeatureConfiguration> 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<NoneFeatureConfiguration> 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));
@@ -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;
@@ -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 = "<init>", at = @At("RETURN"))
private void setSemaphore(CallbackInfo ci) {
this.lock = new Semaphore(2);
}
}
+3 -1
View File
@@ -3,7 +3,9 @@
"minVersion": "0.8",
"package": "com.seibel.lod.fabric.mixins",
"compatibilityLevel": "JAVA_16",
"mixins": [],
"mixins": [
"unsafe.MixinPalettedContainer"
],
"client": [
"MixinMinecraft",
"MixinOptionsScreen",