diff --git a/gradle.properties b/gradle.properties index 59208972..f4fcd4d1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,8 +4,8 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use # or better: https://modmuss50.me/fabric.html - minecraft_version=20w19a - yarn_mappings=20w19a+build.15 + minecraft_version=20w20a + yarn_mappings=20w20a+build.1 loader_version=0.8.2+build.194 # Mod Properties diff --git a/src/main/java/carpet/commands/PlayerCommand.java b/src/main/java/carpet/commands/PlayerCommand.java index e6d99c12..6663ad67 100644 --- a/src/main/java/carpet/commands/PlayerCommand.java +++ b/src/main/java/carpet/commands/PlayerCommand.java @@ -236,7 +236,7 @@ public class PlayerCommand ); DimensionType dim = tryGetArg( () -> DimensionArgumentType.getDimensionArgument(context, "dimension"), - () -> source.getWorld().dimension.getType() + () -> source.getWorld().method_27983() // dimension.getType() ); GameMode mode = GameMode.CREATIVE; try diff --git a/src/main/java/carpet/fakes/StructureFeatureInterface.java b/src/main/java/carpet/fakes/StructureFeatureInterface.java index f97b7eee..3e12719c 100644 --- a/src/main/java/carpet/fakes/StructureFeatureInterface.java +++ b/src/main/java/carpet/fakes/StructureFeatureInterface.java @@ -9,5 +9,5 @@ public interface StructureFeatureInterface { boolean plopAnywhere(ServerWorld world, BlockPos pos); boolean gridAnywhere(ServerWorld world, BlockPos pos); - boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly); + boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly); } diff --git a/src/main/java/carpet/helpers/FeatureGenerator.java b/src/main/java/carpet/helpers/FeatureGenerator.java index 41228a40..aac701ac 100644 --- a/src/main/java/carpet/helpers/FeatureGenerator.java +++ b/src/main/java/carpet/helpers/FeatureGenerator.java @@ -18,8 +18,9 @@ import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.DefaultBiomeFeatures; import net.minecraft.world.biome.source.BiomeAccess; import net.minecraft.world.biome.source.BiomeSource; -import net.minecraft.world.biome.source.VanillaLayeredBiomeSource; -import net.minecraft.world.biome.source.VanillaLayeredBiomeSourceConfig; +import net.minecraft.world.biome.source.FixedBiomeSource; +//import net.minecraft.world.biome.source.VanillaLayeredBiomeSource; +//import net.minecraft.world.biome.source.VanillaLayeredBiomeSourceConfig; import net.minecraft.world.gen.ChunkRandom; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.OverworldChunkGenerator; @@ -106,7 +107,7 @@ public class FeatureGenerator //if (1+2==3) // throw new RuntimeException("rebuild me"); return (w, p) -> { - ChunkGenerator chunkgen = new OverworldChunkGenerator(w, w.getChunkManager().getChunkGenerator().getBiomeSource(), new OverworldChunkGeneratorConfig()) // BiomeSourceType.VANILLA_LAYERED.applyConfig((BiomeSourceType.VANILLA_LAYERED.getConfig())), ChunkGeneratorType.SURFACE.createSettings()) + ChunkGenerator chunkgen = new OverworldChunkGenerator(w.getChunkManager().getChunkGenerator().getBiomeSource(), w.getSeed(), new OverworldChunkGeneratorConfig()) // BiomeSourceType.VANILLA_LAYERED.applyConfig((BiomeSourceType.VANILLA_LAYERED.getConfig())), ChunkGeneratorType.SURFACE.createSettings()) { @Override public C getStructureConfig(Biome biome_1, StructureFeature structureFeature_1) @@ -117,7 +118,8 @@ public class FeatureGenerator @Override public BiomeSource getBiomeSource() { - return new VanillaLayeredBiomeSource(new VanillaLayeredBiomeSourceConfig(w.getLevelProperties().getSeed())) + return new FixedBiomeSource(biome); + /*return new VanillaLayeredBiomeSource(new VanillaLayeredBiomeSourceConfig(w.getLevelProperties().getSeed())) { @Override public Biome getBiomeForNoiseGen(int i, int j, int k) @@ -130,7 +132,7 @@ public class FeatureGenerator { return Sets.newHashSet(biome); } - }; + };*/ } }; @@ -156,18 +158,19 @@ public class FeatureGenerator public static StructureStart shouldStructureStartAt(ServerWorld world, BlockPos pos, StructureFeature structure, boolean computeBox) { - ChunkGenerator generator = world.getChunkManager().getChunkGenerator(); + long seed = world.getSeed(); + ChunkGenerator generator = world.getChunkManager().getChunkGenerator(); if (!generator.getBiomeSource().hasStructureFeature(structure)) return null; BiomeAccess biomeAccess = world.getBiomeAccess().withSource(generator.getBiomeSource()); ChunkRandom chunkRandom = new ChunkRandom(); ChunkPos chunkPos = new ChunkPos(pos); Biome biome = biomeAccess.getBiome(new BlockPos(chunkPos.getStartX() + 9, 0, chunkPos.getStartZ() + 9)); - if (structure.method_27217(biomeAccess, generator, chunkRandom, chunkPos.x, chunkPos.z, biome)) // should start at + if (structure.method_27217(biomeAccess, generator, seed, chunkRandom, chunkPos.x, chunkPos.z, biome)) // should start at { if (!computeBox) return StructureStart.DEFAULT; StructureManager manager = world.getStructureManager(); - StructureStart structureStart3 = structure.getStructureStartFactory().create(structure, chunkPos.x, chunkPos.z, BlockBox.empty(), 0, generator.getSeed()); + StructureStart structureStart3 = structure.getStructureStartFactory().create(structure, chunkPos.x, chunkPos.z, BlockBox.empty(), 0, seed); structureStart3.init(generator, manager, chunkPos.x, chunkPos.z, biome); if (!structureStart3.hasChildren()) return null; return structureStart3; diff --git a/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java b/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java index 74e0ad8e..e7a98c6b 100644 --- a/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java +++ b/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java @@ -9,6 +9,7 @@ import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.source.BiomeSource; import net.minecraft.world.gen.StructureAccessor; import net.minecraft.world.gen.chunk.ChunkGenerator; +import net.minecraft.world.gen.chunk.ChunkGeneratorConfig; import net.minecraft.world.gen.chunk.FlatChunkGenerator; import net.minecraft.world.gen.chunk.FlatChunkGeneratorConfig; import net.minecraft.world.gen.feature.Feature; @@ -17,19 +18,19 @@ import org.spongepowered.asm.mixin.Mixin; import java.util.List; @Mixin(FlatChunkGenerator.class) -public abstract class FlatChunkGeneratorMixin extends ChunkGenerator +public abstract class FlatChunkGeneratorMixin extends ChunkGenerator { - public FlatChunkGeneratorMixin(IWorld iWorld, BiomeSource biome, FlatChunkGeneratorConfig chunkGeneratorConfig) + public FlatChunkGeneratorMixin(BiomeSource biomeSource, ChunkGeneratorConfig chunkGeneratorConfig) { - super(iWorld, biome, chunkGeneratorConfig); + super(biomeSource, chunkGeneratorConfig); } @Override - public List getEntitySpawnList(StructureAccessor arg, SpawnGroup category, BlockPos pos) + public List getEntitySpawnList(Biome biome, StructureAccessor structureAccessor, SpawnGroup category, BlockPos blockPos) { if (CarpetSettings.flatWorldStructureSpawning) { - if (Feature.SWAMP_HUT.method_14029(this.world, arg, pos)) + if (Feature.SWAMP_HUT.isApproximatelyInsideStructure(structureAccessor, blockPos)) { if (category == SpawnGroup.MONSTER) { @@ -43,37 +44,32 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator +public abstract class FloatingIslandsChunkGeneratorMixin extends SurfaceChunkGenerator //FloatingIslandsChunkGeneratorConfig { - public FloatingIslandsChunkGeneratorMixin(IWorld iWorld_1, BiomeSource biomeSource_1, int int_1, int int_2, int int_3, FloatingIslandsChunkGeneratorConfig chunkGeneratorConfig_1, boolean boolean_1) + public FloatingIslandsChunkGeneratorMixin(BiomeSource biomeSource, long l, class_5284 arg, int i, int j, int k, boolean bl) { - super(iWorld_1, biomeSource_1, int_1, int_2, int_3, chunkGeneratorConfig_1, boolean_1); + super(biomeSource, l, arg, i, j, k, bl); } @Override - public List getEntitySpawnList(StructureAccessor arg, SpawnGroup category, BlockPos pos) + public List getEntitySpawnList(Biome biome, StructureAccessor structureAccessor, SpawnGroup category, BlockPos pos) { if (CarpetSettings.shulkerSpawningInEndCities && SpawnGroup.MONSTER == category) { - if (Feature.END_CITY.isInsideStructure(this.world, arg, pos)) + if (Feature.END_CITY.isInsideStructure(structureAccessor, pos)) { return Feature.END_CITY.getMonsterSpawns(); } } - return this.world.getBiome(pos).getEntitySpawnList(category); + return super.getEntitySpawnList(biome, structureAccessor, category, pos); } } diff --git a/src/main/java/carpet/mixins/HuskEntityMixin.java b/src/main/java/carpet/mixins/HuskEntityMixin.java index 9e37657e..9c173b5c 100644 --- a/src/main/java/carpet/mixins/HuskEntityMixin.java +++ b/src/main/java/carpet/mixins/HuskEntityMixin.java @@ -17,6 +17,6 @@ public class HuskEntityMixin private static boolean isSkylightOrTempleVisible(IWorld iWorld, BlockPos blockPos_1) { return iWorld.isSkyVisible(blockPos_1) || - (CarpetSettings.huskSpawningInTemples && Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(iWorld, ((ServerWorld)iWorld).getStructureAccessor(), blockPos_1)); + (CarpetSettings.huskSpawningInTemples && Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(((ServerWorld)iWorld).getStructureAccessor(), blockPos_1)); } } diff --git a/src/main/java/carpet/mixins/IntegratedServerMixin.java b/src/main/java/carpet/mixins/IntegratedServerMixin.java index b6492b8c..dace2a32 100644 --- a/src/main/java/carpet/mixins/IntegratedServerMixin.java +++ b/src/main/java/carpet/mixins/IntegratedServerMixin.java @@ -2,11 +2,9 @@ package carpet.mixins; import carpet.CarpetServer; import net.minecraft.server.integrated.IntegratedServer; -import net.minecraft.world.level.LevelGeneratorOptions; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(IntegratedServer.class) diff --git a/src/main/java/carpet/mixins/MinecraftServer_coreMixin.java b/src/main/java/carpet/mixins/MinecraftServer_coreMixin.java index 4cab5206..44b64c95 100644 --- a/src/main/java/carpet/mixins/MinecraftServer_coreMixin.java +++ b/src/main/java/carpet/mixins/MinecraftServer_coreMixin.java @@ -2,10 +2,8 @@ package carpet.mixins; import carpet.CarpetServer; import carpet.CarpetSettings; -import com.google.gson.JsonElement; import net.minecraft.server.MinecraftServer; import net.minecraft.server.WorldGenerationProgressListener; -import net.minecraft.world.level.LevelGeneratorOptions; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; diff --git a/src/main/java/carpet/mixins/OverworldChunkGeneratorMixin.java b/src/main/java/carpet/mixins/OverworldChunkGeneratorMixin.java index 619b33b1..6f71c698 100644 --- a/src/main/java/carpet/mixins/OverworldChunkGeneratorMixin.java +++ b/src/main/java/carpet/mixins/OverworldChunkGeneratorMixin.java @@ -21,19 +21,19 @@ import java.util.List; @Mixin(OverworldChunkGenerator.class) public abstract class OverworldChunkGeneratorMixin extends SurfaceChunkGenerator { - public OverworldChunkGeneratorMixin(IWorld iWorld_1, BiomeSource biomeSource_1, int int_1, int int_2, int int_3, OverworldChunkGeneratorConfig chunkGeneratorConfig_1, boolean boolean_1) + public OverworldChunkGeneratorMixin(BiomeSource biomeSource, long seed, OverworldChunkGeneratorConfig arg, int i, int j, int k, boolean bl) { - super(iWorld_1, biomeSource_1, int_1, int_2, int_3, chunkGeneratorConfig_1, boolean_1); + super(biomeSource, seed, arg, i, j, k, bl); } - + @Inject(method = "getEntitySpawnList", at = @At(value = "INVOKE", ordinal = 1, shift = At.Shift.BEFORE, - target = "Lnet/minecraft/world/gen/feature/StructureFeature;isApproximatelyInsideStructure(Lnet/minecraft/world/IWorld;Lnet/minecraft/world/gen/StructureAccessor;Lnet/minecraft/util/math/BlockPos;)Z"), + target = "Lnet/minecraft/world/gen/feature/StructureFeature;isApproximatelyInsideStructure(Lnet/minecraft/world/gen/StructureAccessor;Lnet/minecraft/util/math/BlockPos;)Z"), cancellable = true) - private void onGetEntitySpawnList(StructureAccessor arg, SpawnGroup entityCategory, BlockPos blockPos, CallbackInfoReturnable> cir) + private void onGetEntitySpawnList(Biome biome, StructureAccessor structureAccessor, SpawnGroup spawnGroup, BlockPos blockPos, CallbackInfoReturnable> cir) { if (CarpetSettings.huskSpawningInTemples) { - if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(this.world, arg, blockPos)) + if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(structureAccessor, blockPos)) { cir.setReturnValue(Feature.DESERT_PYRAMID.getMonsterSpawns()); } diff --git a/src/main/java/carpet/mixins/ServerChunkManagerMixin.java b/src/main/java/carpet/mixins/ServerChunkManagerMixin.java index 83bd1774..2b7841a1 100644 --- a/src/main/java/carpet/mixins/ServerChunkManagerMixin.java +++ b/src/main/java/carpet/mixins/ServerChunkManagerMixin.java @@ -47,7 +47,7 @@ public abstract class ServerChunkManagerMixin implements ServerChunkManagerInter private int setupTracking(ChunkTicketManager chunkTicketManager) { int j = chunkTicketManager.getSpawningChunkCount(); - DimensionType dim = this.world.dimension.getType(); + DimensionType dim = this.world.method_27983(); // getDimensionType; //((WorldInterface)world).getPrecookedMobs().clear(); not needed because mobs are compared with predefined BBs SpawnReporter.chunkCounts.put(dim, j); @@ -77,8 +77,8 @@ public abstract class ServerChunkManagerMixin implements ServerChunkManagerInter { for (SpawnGroup cat: SpawnGroup.values()) { - DimensionType dim = world.dimension.getType(); - Pair key = Pair.of(world.dimension.getType(), cat); + DimensionType dim = world.method_27983(); // getDimensionType; + Pair key = Pair.of(dim, cat); int spawnTries = SpawnReporter.spawn_tries.get(cat); if (!SpawnReporter.local_spawns.containsKey(cat)) { diff --git a/src/main/java/carpet/mixins/ServerChunkManager_tickMixin.java b/src/main/java/carpet/mixins/ServerChunkManager_tickMixin.java index a5b5a253..cffb2096 100644 --- a/src/main/java/carpet/mixins/ServerChunkManager_tickMixin.java +++ b/src/main/java/carpet/mixins/ServerChunkManager_tickMixin.java @@ -2,11 +2,8 @@ package carpet.mixins; import carpet.helpers.TickSpeed; import carpet.utils.CarpetProfiler; -import net.minecraft.class_5217; import net.minecraft.server.world.ServerChunkManager; import net.minecraft.server.world.ServerWorld; -import net.minecraft.world.level.LevelGeneratorType; -import net.minecraft.world.level.LevelProperties; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -95,12 +92,13 @@ public abstract class ServerChunkManager_tickMixin @Redirect(method = "tickChunks", at = @At( value = "INVOKE", //target = "Lnet/minecraft/world/level/LevelProperties;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;" - target = "Lnet/minecraft/class_5217;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;" + //target = "Lnet/minecraft/class_5217;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;" + target = "Lnet/minecraft/server/world/ServerWorld;method_27982()Z" // idDebug )) - private LevelGeneratorType skipChunkTicking(class_5217 levelProperties) + private boolean skipChunkTicking(ServerWorld serverWorld) { - if (!TickSpeed.process_entities) return LevelGeneratorType.DEBUG_ALL_BLOCK_STATES; - return levelProperties.getGeneratorType(); + if (!TickSpeed.process_entities) return true; + return serverWorld.method_27982(); //isDebug } } diff --git a/src/main/java/carpet/mixins/ServerPlayNetworkHandler_interactionUpdatesMixin.java b/src/main/java/carpet/mixins/ServerPlayNetworkHandler_interactionUpdatesMixin.java index 061ca518..a277e303 100644 --- a/src/main/java/carpet/mixins/ServerPlayNetworkHandler_interactionUpdatesMixin.java +++ b/src/main/java/carpet/mixins/ServerPlayNetworkHandler_interactionUpdatesMixin.java @@ -15,7 +15,7 @@ public class ServerPlayNetworkHandler_interactionUpdatesMixin { @Inject(method = "onPlayerInteractBlock", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactBlock(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;", + target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactBlock(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;", shift = At.Shift.BEFORE )) private void beforeBlockInteracted(PlayerInteractBlockC2SPacket playerInteractBlockC2SPacket_1, CallbackInfo ci) @@ -26,7 +26,7 @@ public class ServerPlayNetworkHandler_interactionUpdatesMixin @Inject(method = "onPlayerInteractBlock", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactBlock(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;", + target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactBlock(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;", shift = At.Shift.AFTER )) private void afterBlockInteracted(PlayerInteractBlockC2SPacket playerInteractBlockC2SPacket_1, CallbackInfo ci) @@ -37,7 +37,7 @@ public class ServerPlayNetworkHandler_interactionUpdatesMixin @Inject(method = "onPlayerInteractItem", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactItem(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;", + target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactItem(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;", shift = At.Shift.BEFORE )) private void beforeItemInteracted(PlayerInteractItemC2SPacket packet, CallbackInfo ci) @@ -48,7 +48,7 @@ public class ServerPlayNetworkHandler_interactionUpdatesMixin @Inject(method = "onPlayerInteractItem", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactItem(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;", + target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactItem(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;", shift = At.Shift.AFTER )) private void afterItemInteracted(PlayerInteractItemC2SPacket packet, CallbackInfo ci) diff --git a/src/main/java/carpet/mixins/ServerPlayNetworkHandler_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerPlayNetworkHandler_scarpetEventsMixin.java index af0330e5..76b8aa71 100644 --- a/src/main/java/carpet/mixins/ServerPlayNetworkHandler_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerPlayNetworkHandler_scarpetEventsMixin.java @@ -115,7 +115,7 @@ public class ServerPlayNetworkHandler_scarpetEventsMixin @Inject(method = "onPlayerInteractBlock", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactBlock(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;" + target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactBlock(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;" )) private void onBlockInteracted(PlayerInteractBlockC2SPacket playerInteractBlockC2SPacket_1, CallbackInfo ci) { diff --git a/src/main/java/carpet/mixins/ServerPlayerInteractionManager_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerPlayerInteractionManager_scarpetEventsMixin.java index a9dc05cf..a88d8ab3 100644 --- a/src/main/java/carpet/mixins/ServerPlayerInteractionManager_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerPlayerInteractionManager_scarpetEventsMixin.java @@ -42,8 +42,8 @@ public class ServerPlayerInteractionManager_scarpetEventsMixin value = "RETURN", ordinal = 2 )) - private void onBlockActivated(PlayerEntity playerArg, World world, ItemStack stack, Hand hand, BlockHitResult blockHitResult, CallbackInfoReturnable cir) + private void onBlockActivated(ServerPlayerEntity serverPlayerEntity, World world, ItemStack stack, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable cir) { - PLAYER_INTERACTS_WITH_BLOCK.onBlockHit(player, hand, blockHitResult); + PLAYER_INTERACTS_WITH_BLOCK.onBlockHit(player, hand, hitResult); } } diff --git a/src/main/java/carpet/mixins/ServerWorld_tickMixin.java b/src/main/java/carpet/mixins/ServerWorld_tickMixin.java index d45d470a..5f919891 100644 --- a/src/main/java/carpet/mixins/ServerWorld_tickMixin.java +++ b/src/main/java/carpet/mixins/ServerWorld_tickMixin.java @@ -2,20 +2,14 @@ package carpet.mixins; import carpet.helpers.TickSpeed; import carpet.utils.CarpetProfiler; -import net.minecraft.class_5217; import net.minecraft.class_5269; import net.minecraft.entity.raid.RaidManager; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.profiler.Profiler; -import net.minecraft.village.ZombieSiegeManager; import net.minecraft.world.WanderingTraderManager; import net.minecraft.world.World; import net.minecraft.world.border.WorldBorder; -import net.minecraft.world.chunk.ChunkManager; -import net.minecraft.world.dimension.Dimension; import net.minecraft.world.dimension.DimensionType; -import net.minecraft.world.level.LevelGeneratorType; -import net.minecraft.world.level.LevelProperties; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -33,9 +27,9 @@ public abstract class ServerWorld_tickMixin extends World @Shadow protected abstract void processSyncedBlockEvents(); //@Shadow protected abstract void sendBlockActions(); - protected ServerWorld_tickMixin(LevelProperties levelProperties, DimensionType dimensionType, BiFunction chunkManagerProvider, Supplier supplier, boolean isClient) + protected ServerWorld_tickMixin(class_5269 arg, DimensionType dimensionType, Supplier supplier, boolean bl, boolean bl2, long l) { - super(levelProperties, dimensionType, chunkManagerProvider, supplier, isClient); + super(arg, dimensionType, supplier, bl, bl2, l); } private CarpetProfiler.ProfilerToken currentSection; @@ -135,9 +129,9 @@ public abstract class ServerWorld_tickMixin extends World @Redirect(method = "tick", at = @At( value = "INVOKE", - target = "Lnet/minecraft/world/dimension/Dimension;hasSkyLight()Z" + target = "Lnet/minecraft/world/dimension/DimensionType;hasSkyLight()Z" )) - private boolean tickWorldBorder(Dimension dimension) + private boolean tickWorldBorder(DimensionType dimension) { return TickSpeed.process_entities && dimension.hasSkyLight(); } @@ -153,13 +147,13 @@ public abstract class ServerWorld_tickMixin extends World @Redirect(method = "tick", at = @At( value = "INVOKE", - target = "Lnet/minecraft/class_5269;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;" + target = "Lnet/minecraft/server/world/ServerWorld;method_27982()Z" // isDebug //target = "Lnet/minecraft/world/level/LevelProperties;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;" )) - private LevelGeneratorType tickPendingBlocks(class_5269 levelProperties) + private boolean tickPendingBlocks(ServerWorld serverWorld) { - if (TickSpeed.process_entities) return levelProperties.getGeneratorType(); - return LevelGeneratorType.DEBUG_ALL_BLOCK_STATES; + if (TickSpeed.process_entities) return true; + return serverWorld.method_27982(); // isDebug() } @Redirect(method = "tick", at = @At( diff --git a/src/main/java/carpet/mixins/SpawnHelperMixin.java b/src/main/java/carpet/mixins/SpawnHelperMixin.java index 51021460..e0bfcb42 100644 --- a/src/main/java/carpet/mixins/SpawnHelperMixin.java +++ b/src/main/java/carpet/mixins/SpawnHelperMixin.java @@ -162,7 +162,7 @@ public class SpawnHelperMixin if (SpawnReporter.track_spawns > 0L && SpawnReporter.local_spawns != null) { SpawnReporter.registerSpawn( - world.dimension.getType(), + world.method_27983(), // getDimensionType //dimension.getType(), // getDimensionType (MobEntity) entity_1, entity_1.getType().getSpawnGroup(), entity_1.getBlockPos()); @@ -280,7 +280,7 @@ public class SpawnHelperMixin SpawnGroup entityCategory = var6[var8]; if ((spawnAnimals || !entityCategory.isPeaceful()) && (spawnMonsters || entityCategory.isPeaceful()) && (shouldSpawnAnimals || !entityCategory.isAnimal()) ) { - DimensionType dim = world.dimension.getType(); + DimensionType dim = world.method_27983(); // getDimensionType; int newCap = (int) ((double)entityCategory.getCapacity()*(Math.pow(2.0,(SpawnReporter.mobcap_exponent/4)))); int int_2 = SpawnReporter.chunkCounts.get(dim); // eligible chunks for spawning int int_3 = newCap * int_2 / CHUNK_AREA; //current spawning limits diff --git a/src/main/java/carpet/mixins/StructureFeatureMixin.java b/src/main/java/carpet/mixins/StructureFeatureMixin.java index d6068a8a..c004a683 100644 --- a/src/main/java/carpet/mixins/StructureFeatureMixin.java +++ b/src/main/java/carpet/mixins/StructureFeatureMixin.java @@ -45,7 +45,7 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface } @Override - public boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly) + public boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly) { if (world.isClient()) return false; @@ -108,7 +108,7 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface return true; } - private StructureStart forceStructureStart(IWorld worldIn, ChunkGenerator generator, Random rand, long packedChunkPos) + private StructureStart forceStructureStart(ServerWorld worldIn, ChunkGenerator generator, Random rand, long packedChunkPos) { ChunkPos chunkpos = new ChunkPos(packedChunkPos); StructureStart structurestart; @@ -125,8 +125,8 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface } } Biome biome_1 = generator.getBiomeSource().getBiomeForNoiseGen((chunkpos.getStartX() + 9) >> 2, 0, (chunkpos.getStartZ() + 9) >> 2 ); - StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos.x, chunkpos.z, BlockBox.empty(),0,generator.getSeed()); - structurestart1.init(generator, ((ServerWorld)worldIn).getStructureManager() , chunkpos.x, chunkpos.z, biome_1); + StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos.x, chunkpos.z, BlockBox.empty(),0,worldIn.getSeed()); + structurestart1.init(generator, worldIn.getStructureManager() , chunkpos.x, chunkpos.z, biome_1); structurestart = structurestart1.hasChildren() ? structurestart1 : StructureStart.DEFAULT; if (structurestart.hasChildren()) diff --git a/src/main/java/carpet/mixins/WorldRenderer_fogOffMixin.java b/src/main/java/carpet/mixins/WorldRenderer_fogOffMixin.java index a620c194..e6d31f1c 100644 --- a/src/main/java/carpet/mixins/WorldRenderer_fogOffMixin.java +++ b/src/main/java/carpet/mixins/WorldRenderer_fogOffMixin.java @@ -1,6 +1,7 @@ package carpet.mixins; import carpet.CarpetSettings; +import net.minecraft.class_5294; import net.minecraft.client.render.WorldRenderer; import net.minecraft.world.dimension.Dimension; import org.spongepowered.asm.mixin.Mixin; @@ -12,12 +13,12 @@ public class WorldRenderer_fogOffMixin { @Redirect(method = "render", require = 0, expect = 0, at = @At( value = "INVOKE", - target = "Lnet/minecraft/world/dimension/Dimension;isFogThick(II)Z" + target = "Lnet/minecraft/class_5294;method_28110(II)Z" //method_28110 isFogThick )) - private boolean isReallyThick(Dimension dimension, int x, int z) + private boolean isReallyThick(class_5294 class_5294, int x, int z) { if (CarpetSettings.fogOff) return false; - return dimension.isFogThick(x, z); + return class_5294.method_28110(x, z); //isFogThick } } diff --git a/src/main/java/carpet/mixins/World_movableTEMixin.java b/src/main/java/carpet/mixins/World_movableTEMixin.java index 82862303..33464758 100644 --- a/src/main/java/carpet/mixins/World_movableTEMixin.java +++ b/src/main/java/carpet/mixins/World_movableTEMixin.java @@ -6,24 +6,21 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockEntityProvider; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.class_5217; import net.minecraft.class_5269; import net.minecraft.server.world.ChunkHolder; import net.minecraft.util.math.BlockPos; import net.minecraft.util.profiler.Profiler; import net.minecraft.world.BlockView; +import net.minecraft.world.IWorld; import net.minecraft.world.World; -import net.minecraft.world.chunk.ChunkManager; import net.minecraft.world.chunk.EmptyChunk; import net.minecraft.world.chunk.WorldChunk; -import net.minecraft.world.level.LevelGeneratorType; -import net.minecraft.world.level.LevelProperties; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @Mixin(World.class) -public abstract class World_movableTEMixin implements WorldInterface +public abstract class World_movableTEMixin implements WorldInterface, IWorld { @Shadow @Final @@ -38,8 +35,8 @@ public abstract class World_movableTEMixin implements WorldInterface @Shadow public abstract BlockState getBlockState(BlockPos blockPos_1); - @Shadow - public abstract ChunkManager getChunkManager(); + //@Shadow + //public abstract ChunkManager getChunkManager(); @Shadow public abstract void checkBlockRerender(BlockPos blockPos_1, BlockState s1, BlockState s2); @@ -59,6 +56,8 @@ public abstract class World_movableTEMixin implements WorldInterface @Shadow public abstract boolean setBlockState(BlockPos pos, BlockState state, int flags); + @Shadow public abstract boolean method_27982(); //isDebug() + /** * @author 2No2Name */ @@ -71,7 +70,7 @@ public abstract class World_movableTEMixin implements WorldInterface { return false; } - else if (!this.isClient && this.properties.getGeneratorType() == LevelGeneratorType.DEBUG_ALL_BLOCK_STATES) + else if (!this.isClient && method_27982()) { return false; } diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index a1a10f1e..1e542cf1 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -2921,7 +2921,7 @@ public class CarpetExpression this.expr.addLazyFunction("current_dimension", 0, (c, t, lv) -> { ServerCommandSource s = ((CarpetContext)c).s; - Value retval = new StringValue(NBTSerializableValue.nameFromRegistryId(Registry.DIMENSION_TYPE.getId(s.getWorld().dimension.getType()))); + Value retval = new StringValue(NBTSerializableValue.nameFromRegistryId(Registry.DIMENSION_TYPE.getId(s.getWorld().method_27983()))); // getDImensionType return (cc, tt) -> retval; }); diff --git a/src/main/java/carpet/utils/PerimeterDiagnostics.java b/src/main/java/carpet/utils/PerimeterDiagnostics.java index ae7477f1..a6913fd6 100644 --- a/src/main/java/carpet/utils/PerimeterDiagnostics.java +++ b/src/main/java/carpet/utils/PerimeterDiagnostics.java @@ -155,10 +155,10 @@ public class PerimeterDiagnostics private boolean check_entity_spawn(BlockPos pos) { - if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getStructureAccessor(), ctype, pos).contains(sle)) + if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getBiome(pos), worldServer.getStructureAccessor(), ctype, pos).contains(sle)) { sle = null; - for (Biome.SpawnEntry sle: worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getStructureAccessor(), ctype, pos)) + for (Biome.SpawnEntry sle: worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getBiome(pos), worldServer.getStructureAccessor(), ctype, pos)) { if (el.getType() == sle.type) { @@ -166,7 +166,7 @@ public class PerimeterDiagnostics break; } } - if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getStructureAccessor(), ctype, pos).contains(sle)) + if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getBiome(pos), worldServer.getStructureAccessor(), ctype, pos).contains(sle)) { return false; } diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java index b27142b5..64761bbb 100644 --- a/src/main/java/carpet/utils/SpawnReporter.java +++ b/src/main/java/carpet/utils/SpawnReporter.java @@ -410,7 +410,7 @@ public class SpawnReporter for (SpawnGroup enumcreaturetype : SpawnGroup.values()) { String type_code = String.format("%s", enumcreaturetype).substring(0, 3); - List lst = ((ChunkGenerator)worldIn.getChunkManager().getChunkGenerator()).getEntitySpawnList(worldIn.getStructureAccessor(), enumcreaturetype, pos); + List lst = ((ChunkGenerator)worldIn.getChunkManager().getChunkGenerator()).getEntitySpawnList(worldIn.getBiome(pos), worldIn.getStructureAccessor(), enumcreaturetype, pos); if (lst != null && !lst.isEmpty()) { for (Biome.SpawnEntry spawnEntry : lst)