diff --git a/gradle.properties b/gradle.properties index 8acea8f8..d4a23dac 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx1G # check these on https://fabricmc.net/use # or better: https://modmuss50.me/fabric.html minecraft_version=20w30a - yarn_mappings=20w30a+build.11 + yarn_mappings=20w30a+build.26 loader_version=0.9.0+build.204 # Mod Properties diff --git a/src/main/java/carpet/mixins/BlockLightStorage_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/BlockLightStorage_scarpetChunkCreationMixin.java index 33c94881..0241fa17 100644 --- a/src/main/java/carpet/mixins/BlockLightStorage_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/BlockLightStorage_scarpetChunkCreationMixin.java @@ -30,8 +30,8 @@ public abstract class BlockLightStorage_scarpetChunkCreationMixin extends LightS for (int y = -1; y < 17; ++y) { - final long sectionPos = ChunkSectionPos.asLong(ChunkSectionPos.getX(cPos), y, ChunkSectionPos.getZ(cPos)); - final long pos = BlockPos.asLong(ChunkSectionPos.getBlockCoord(ChunkSectionPos.getX(sectionPos)), ChunkSectionPos.getBlockCoord(y), ChunkSectionPos.getBlockCoord(ChunkSectionPos.getZ(sectionPos))); + final long sectionPos = ChunkSectionPos.asLong(ChunkSectionPos.unpackX(cPos), y, ChunkSectionPos.unpackZ(cPos)); + final long pos = BlockPos.asLong(ChunkSectionPos.getBlockCoord(ChunkSectionPos.unpackX(sectionPos)), ChunkSectionPos.getBlockCoord(y), ChunkSectionPos.getBlockCoord(ChunkSectionPos.unpackZ(sectionPos))); if (!this.hasSection(sectionPos)) continue; diff --git a/src/main/java/carpet/mixins/ChunkHolder_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ChunkHolder_scarpetChunkCreationMixin.java index 91607c60..7a1d8fc7 100644 --- a/src/main/java/carpet/mixins/ChunkHolder_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ChunkHolder_scarpetChunkCreationMixin.java @@ -19,7 +19,7 @@ import java.util.concurrent.atomic.AtomicReferenceArray; @Mixin(ChunkHolder.class) public abstract class ChunkHolder_scarpetChunkCreationMixin implements ChunkHolderInterface { - @Shadow protected abstract void updateFuture(CompletableFuture> newChunkFuture); + @Shadow protected abstract void combineSavingFuture(CompletableFuture> newChunkFuture); @Shadow @Final private AtomicReferenceArray>> futuresByStatus; @@ -31,7 +31,7 @@ public abstract class ChunkHolder_scarpetChunkCreationMixin implements ChunkHold () -> Either.left(new ProtoChunk(chpos, UpgradeData.NO_UPGRADE_DATA)), executor ); - updateFuture(completableFuture2); + combineSavingFuture(completableFuture2); futuresByStatus.set(i, completableFuture2); return completableFuture2; } diff --git a/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java b/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java index 67276bdd..35620d79 100644 --- a/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java +++ b/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java @@ -33,7 +33,7 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator { if (CarpetSettings.flatWorldStructureSpawning) { - if (accessor.method_28388(pos, true, StructureFeature.SWAMP_HUT).hasChildren()) + if (accessor.getStructureAt(pos, true, StructureFeature.SWAMP_HUT).hasChildren()) { //swamp hut if (group == SpawnGroup.MONSTER) { @@ -48,32 +48,32 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator if (group == SpawnGroup.MONSTER) { - if (accessor.method_28388(pos, false, StructureFeature.PILLAGER_OUTPOST).hasChildren()) + if (accessor.getStructureAt(pos, false, StructureFeature.PILLAGER_OUTPOST).hasChildren()) { return StructureFeature.PILLAGER_OUTPOST.getMonsterSpawns(); } if (CarpetSettings.huskSpawningInTemples) { - if (accessor.method_28388(pos, true, StructureFeature.DESERT_PYRAMID).hasChildren()) + if (accessor.getStructureAt(pos, true, StructureFeature.DESERT_PYRAMID).hasChildren()) { return StructureFeature.DESERT_PYRAMID.getMonsterSpawns(); } } - if (accessor.method_28388(pos, false, StructureFeature.MONUMENT).hasChildren()) + if (accessor.getStructureAt(pos, false, StructureFeature.MONUMENT).hasChildren()) { return StructureFeature.MONUMENT.getMonsterSpawns(); } - if (accessor.method_28388(pos, true, StructureFeature.FORTRESS).hasChildren()) + if (accessor.getStructureAt(pos, true, StructureFeature.FORTRESS).hasChildren()) { return StructureFeature.FORTRESS.getMonsterSpawns(); } if (CarpetSettings.shulkerSpawningInEndCities) { - if (accessor.method_28388(pos, true, StructureFeature.END_CITY).hasChildren()) + if (accessor.getStructureAt(pos, true, StructureFeature.END_CITY).hasChildren()) { return StructureFeature.END_CITY.getMonsterSpawns(); } diff --git a/src/main/java/carpet/mixins/HuskEntityMixin.java b/src/main/java/carpet/mixins/HuskEntityMixin.java index 9ddb8a93..13d27836 100644 --- a/src/main/java/carpet/mixins/HuskEntityMixin.java +++ b/src/main/java/carpet/mixins/HuskEntityMixin.java @@ -1,12 +1,10 @@ package carpet.mixins; import carpet.CarpetSettings; -import net.minecraft.class_5425; import net.minecraft.entity.mob.HuskEntity; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.gen.feature.StructureFeature; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -15,10 +13,10 @@ import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(HuskEntity.class) public class HuskEntityMixin { - @Redirect(method = "canSpawn", at = @At(value = "INVOKE", target="Lnet/minecraft/class_5425;isSkyVisible(Lnet/minecraft/util/math/BlockPos;)Z")) - private static boolean isSkylightOrTempleVisible(class_5425 class_5425, BlockPos pos) + @Redirect(method = "canSpawn", at = @At(value = "INVOKE", target="Lnet/minecraft/world/ServerWorldAccess;isSkyVisible(Lnet/minecraft/util/math/BlockPos;)Z")) + private static boolean isSkylightOrTempleVisible(ServerWorldAccess serverWorldAccess, BlockPos pos) { - return class_5425.isSkyVisible(pos) || - (CarpetSettings.huskSpawningInTemples && (((ServerWorld)class_5425).getStructureAccessor().method_28388(pos, false, StructureFeature.DESERT_PYRAMID).hasChildren())); + return serverWorldAccess.isSkyVisible(pos) || + (CarpetSettings.huskSpawningInTemples && (((ServerWorld)serverWorldAccess).getStructureAccessor().getStructureAt(pos, false, StructureFeature.DESERT_PYRAMID).hasChildren())); } } diff --git a/src/main/java/carpet/mixins/LightStorage_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/LightStorage_scarpetChunkCreationMixin.java index 18e5738d..5a035131 100644 --- a/src/main/java/carpet/mixins/LightStorage_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/LightStorage_scarpetChunkCreationMixin.java @@ -75,7 +75,7 @@ public abstract class LightStorage_scarpetChunkCreationMixin implements LightSto { for (int y = -1; y < 17; ++y) { - final long sectionPos = ChunkSectionPos.asLong(ChunkSectionPos.getX(cPos), y, ChunkSectionPos.getZ(cPos)); + final long sectionPos = ChunkSectionPos.asLong(ChunkSectionPos.unpackX(cPos), y, ChunkSectionPos.unpackZ(cPos)); this.queuedSections.remove(sectionPos); diff --git a/src/main/java/carpet/mixins/ServerLightingProvider_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ServerLightingProvider_scarpetChunkCreationMixin.java index c7a41ac8..1b6525dd 100644 --- a/src/main/java/carpet/mixins/ServerLightingProvider_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ServerLightingProvider_scarpetChunkCreationMixin.java @@ -48,7 +48,7 @@ public abstract class ServerLightingProvider_scarpetChunkCreationMixin extends L this.enqueue(pos.x, pos.z, () -> 0, ServerLightingProvider.Stage.PRE_UPDATE, Util.debugRunnable(() -> { super.setColumnEnabled(pos, false); - ((Lighting_scarpetChunkCreationInterface) this).removeLightData(ChunkSectionPos.withZeroZ(ChunkSectionPos.asLong(pos.x, 0, pos.z))); + ((Lighting_scarpetChunkCreationInterface) this).removeLightData(ChunkSectionPos.withZeroY(ChunkSectionPos.asLong(pos.x, 0, pos.z))); }, () -> "Remove light data " + pos )); @@ -66,7 +66,7 @@ public abstract class ServerLightingProvider_scarpetChunkCreationMixin extends L blockPos -> super.addLightSource(blockPos, chunk.getLuminance(blockPos)) ); - ((Lighting_scarpetChunkCreationInterface) this).relight(ChunkSectionPos.withZeroZ(ChunkSectionPos.asLong(pos.x, 0, pos.z))); + ((Lighting_scarpetChunkCreationInterface) this).relight(ChunkSectionPos.withZeroY(ChunkSectionPos.asLong(pos.x, 0, pos.z))); }, () -> "Relight chunk " + pos )); diff --git a/src/main/java/carpet/mixins/SkyLightStorage_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/SkyLightStorage_scarpetChunkCreationMixin.java index d6e2a168..9ee0a85d 100644 --- a/src/main/java/carpet/mixins/SkyLightStorage_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/SkyLightStorage_scarpetChunkCreationMixin.java @@ -47,7 +47,7 @@ public abstract class SkyLightStorage_scarpetChunkCreationMixin extends LightSto { for (int y = -1; y < 17; ++y) { - final long sectionPos = ChunkSectionPos.asLong(ChunkSectionPos.getX(cPos), y, ChunkSectionPos.getZ(cPos)); + final long sectionPos = ChunkSectionPos.asLong(ChunkSectionPos.unpackX(cPos), y, ChunkSectionPos.unpackZ(cPos)); this.sectionsToUpdate.remove(sectionPos); this.sectionsToRemove.remove(sectionPos); @@ -63,8 +63,8 @@ public abstract class SkyLightStorage_scarpetChunkCreationMixin extends LightSto for (int y = -1; y < 17; ++y) { - final long sectionPos = ChunkSectionPos.asLong(ChunkSectionPos.getX(cPos), y, ChunkSectionPos.getZ(cPos)); - final long pos = BlockPos.asLong(ChunkSectionPos.getBlockCoord(ChunkSectionPos.getX(sectionPos)), ChunkSectionPos.getBlockCoord(y), ChunkSectionPos.getBlockCoord(ChunkSectionPos.getZ(sectionPos))); + final long sectionPos = ChunkSectionPos.asLong(ChunkSectionPos.unpackX(cPos), y, ChunkSectionPos.unpackZ(cPos)); + final long pos = BlockPos.asLong(ChunkSectionPos.getBlockCoord(ChunkSectionPos.unpackX(sectionPos)), ChunkSectionPos.getBlockCoord(y), ChunkSectionPos.getBlockCoord(ChunkSectionPos.unpackZ(sectionPos))); if (!this.hasSection(sectionPos)) continue; @@ -95,11 +95,11 @@ public abstract class SkyLightStorage_scarpetChunkCreationMixin extends LightSto long src = BlockPos.offset(dst, dir); if (neighborLightArray == null) - src = BlockPos.asLong(BlockPos.unpackLongX(src), ChunkSectionPos.getBlockCoord(ChunkSectionPos.getY(neighborCeilingSectionPos)), BlockPos.unpackLongZ(src)); + src = BlockPos.asLong(BlockPos.unpackLongX(src), ChunkSectionPos.getBlockCoord(ChunkSectionPos.unpackY(neighborCeilingSectionPos)), BlockPos.unpackLongZ(src)); final int srcLevel = neighborCeilingLightArray != null ? ((ChunkLightProviderInterface) lightProvider).callGetCurrentLevelFromSection(neighborCeilingLightArray, src) - : this.isSectionEnabled(ChunkSectionPos.withZeroZ(neighborCeilingSectionPos)) ? 0 : 15; + : this.isSectionEnabled(ChunkSectionPos.withZeroY(neighborCeilingSectionPos)) ? 0 : 15; levelPropagator.invokeUpdateLevel(src, dst, levelPropagator.callGetPropagatedLevel(src, dst, srcLevel), true); } diff --git a/src/main/java/carpet/mixins/SpawnHelperMixin.java b/src/main/java/carpet/mixins/SpawnHelperMixin.java index 8dcbf2d8..ae747765 100644 --- a/src/main/java/carpet/mixins/SpawnHelperMixin.java +++ b/src/main/java/carpet/mixins/SpawnHelperMixin.java @@ -6,7 +6,6 @@ import carpet.utils.SpawnReporter; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.FenceGateBlock; -import net.minecraft.class_5425; import net.minecraft.entity.Entity; import net.minecraft.entity.SpawnGroup; import net.minecraft.entity.EntityData; @@ -23,13 +22,12 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.registry.RegistryKey; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.WorldAccess; +import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.LocalDifficulty; import net.minecraft.world.SpawnHelper; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.WorldChunk; -import net.minecraft.world.dimension.DimensionType; import org.apache.commons.lang3.tuple.Pair; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -153,7 +151,7 @@ public class SpawnHelperMixin @Redirect(method = "spawnEntitiesInChunk(Lnet/minecraft/entity/SpawnGroup;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/Chunk;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/SpawnHelper$Checker;Lnet/minecraft/world/SpawnHelper$Runner;)V", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/world/ServerWorld;method_30771(Lnet/minecraft/entity/Entity;)V"//"Lnet/minecraft/server/world/ServerWorld;spawnEntity(Lnet/minecraft/entity/Entity;)Z" + target = "Lnet/minecraft/server/world/ServerWorld;spawnEntityAndPassengers(Lnet/minecraft/entity/Entity;)V"//"Lnet/minecraft/server/world/ServerWorld;spawnEntity(Lnet/minecraft/entity/Entity;)Z" )) private static void spawnEntity(ServerWorld world, Entity entity_1) { @@ -170,18 +168,18 @@ public class SpawnHelperMixin entity_1.getBlockPos()); } if (!SpawnReporter.mock_spawns) - world.method_30771(entity_1); + world.spawnEntityAndPassengers(entity_1); //world.spawnEntity(entity_1); } @Redirect(method = "spawnEntitiesInChunk(Lnet/minecraft/entity/SpawnGroup;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/Chunk;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/SpawnHelper$Checker;Lnet/minecraft/world/SpawnHelper$Runner;)V", at = @At( value = "INVOKE", - target = "Lnet/minecraft/entity/mob/MobEntity;initialize(Lnet/minecraft/class_5425;Lnet/minecraft/world/LocalDifficulty;Lnet/minecraft/entity/SpawnReason;Lnet/minecraft/entity/EntityData;Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/entity/EntityData;" + target = "Lnet/minecraft/entity/mob/MobEntity;initialize(Lnet/minecraft/world/ServerWorldAccess;Lnet/minecraft/world/LocalDifficulty;Lnet/minecraft/entity/SpawnReason;Lnet/minecraft/entity/EntityData;Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/entity/EntityData;" )) - private static EntityData spawnEntity(MobEntity mobEntity, class_5425 foo, LocalDifficulty localDifficulty_1, SpawnReason spawnType_1, EntityData entityData_1, CompoundTag compoundTag_1) + private static EntityData spawnEntity(MobEntity mobEntity, ServerWorldAccess serverWorldAccess, LocalDifficulty difficulty, SpawnReason spawnReason, EntityData entityData, CompoundTag entityTag) { if (!SpawnReporter.mock_spawns) // WorldAccess - return mobEntity.initialize(foo, localDifficulty_1, spawnType_1, entityData_1, compoundTag_1); + return mobEntity.initialize(serverWorldAccess, difficulty, spawnReason, entityData, entityTag); return null; } diff --git a/src/main/java/carpet/mixins/StructureBlockBlockEntity_fillUpdatesMixin.java b/src/main/java/carpet/mixins/StructureBlockBlockEntity_fillUpdatesMixin.java index e3e9b7a1..541cdbc8 100644 --- a/src/main/java/carpet/mixins/StructureBlockBlockEntity_fillUpdatesMixin.java +++ b/src/main/java/carpet/mixins/StructureBlockBlockEntity_fillUpdatesMixin.java @@ -2,11 +2,10 @@ package carpet.mixins; import carpet.CarpetSettings; import net.minecraft.block.entity.StructureBlockBlockEntity; -import net.minecraft.class_5425; import net.minecraft.structure.Structure; import net.minecraft.structure.StructurePlacementData; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.WorldAccess; +import net.minecraft.world.ServerWorldAccess; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; @@ -18,15 +17,15 @@ public abstract class StructureBlockBlockEntity_fillUpdatesMixin { @Redirect(method = "place", at = @At( value = "INVOKE", - target = "Lnet/minecraft/structure/Structure;place(Lnet/minecraft/class_5425;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/structure/StructurePlacementData;Ljava/util/Random;)V" + target = "Lnet/minecraft/structure/Structure;place(Lnet/minecraft/world/ServerWorldAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/structure/StructurePlacementData;Ljava/util/Random;)V" )) - private void onStructurePlacen(Structure structure, class_5425 world, BlockPos pos, StructurePlacementData placementData, Random random) + private void onStructurePlacen(Structure structure, ServerWorldAccess serverWorldAccess, BlockPos pos, StructurePlacementData placementData, Random random) { if(!CarpetSettings.fillUpdates) CarpetSettings.impendingFillSkipUpdates = true; try { - structure.place(world, pos, placementData, random); + structure.place(serverWorldAccess, pos, placementData, random); } finally { diff --git a/src/main/java/carpet/mixins/Structure_fillUpdatesMixin.java b/src/main/java/carpet/mixins/Structure_fillUpdatesMixin.java index 4dc21a4f..65515491 100644 --- a/src/main/java/carpet/mixins/Structure_fillUpdatesMixin.java +++ b/src/main/java/carpet/mixins/Structure_fillUpdatesMixin.java @@ -2,11 +2,10 @@ package carpet.mixins; import carpet.CarpetSettings; import net.minecraft.block.Block; -import net.minecraft.class_5425; import net.minecraft.structure.Structure; import net.minecraft.structure.StructurePlacementData; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.WorldAccess; +import net.minecraft.world.ServerWorldAccess; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; @@ -14,17 +13,17 @@ import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(Structure.class) public class Structure_fillUpdatesMixin { - @Redirect( method = "place(Lnet/minecraft/class_5425;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/structure/StructurePlacementData;Ljava/util/Random;I)Z", at = @At( + @Redirect( method = "place(Lnet/minecraft/world/ServerWorldAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/structure/StructurePlacementData;Ljava/util/Random;I)Z", at = @At( value = "INVOKE", - target = "Lnet/minecraft/class_5425;updateNeighbors(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;)V" + target = "Lnet/minecraft/world/ServerWorldAccess;updateNeighbors(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;)V" )) - private void skipUpdateNeighbours(class_5425 class_5425, BlockPos pos, Block block) + private void skipUpdateNeighbours(ServerWorldAccess serverWorldAccess, BlockPos pos, Block block) { if (!CarpetSettings.impendingFillSkipUpdates) - class_5425.updateNeighbors(pos, block); + serverWorldAccess.updateNeighbors(pos, block); } - @Redirect(method = "place(Lnet/minecraft/class_5425;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/structure/StructurePlacementData;Ljava/util/Random;I)Z", at = @At( + @Redirect(method = "place(Lnet/minecraft/world/ServerWorldAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/structure/StructurePlacementData;Ljava/util/Random;I)Z", at = @At( value = "INVOKE", target = "Lnet/minecraft/structure/StructurePlacementData;shouldUpdateNeighbors()Z" )) diff --git a/src/main/java/carpet/mixins/SurfaceChunkGenerator_husksSpawnMixin.java b/src/main/java/carpet/mixins/SurfaceChunkGenerator_husksSpawnMixin.java index b4b8f6b1..2cf5f5c0 100644 --- a/src/main/java/carpet/mixins/SurfaceChunkGenerator_husksSpawnMixin.java +++ b/src/main/java/carpet/mixins/SurfaceChunkGenerator_husksSpawnMixin.java @@ -32,14 +32,14 @@ public abstract class SurfaceChunkGenerator_husksSpawnMixin extends ChunkGenerat { if (CarpetSettings.huskSpawningInTemples && group == SpawnGroup.MONSTER) { - if (accessor.method_28388(pos, true, StructureFeature.DESERT_PYRAMID).hasChildren()) + if (accessor.getStructureAt(pos, true, StructureFeature.DESERT_PYRAMID).hasChildren()) { cir.setReturnValue(StructureFeature.DESERT_PYRAMID.getMonsterSpawns()); } } if (CarpetSettings.shulkerSpawningInEndCities && SpawnGroup.MONSTER == group) { - if (accessor.method_28388(pos, true, StructureFeature.END_CITY).hasChildren()) + if (accessor.getStructureAt(pos, true, StructureFeature.END_CITY).hasChildren()) { cir.setReturnValue(StructureFeature.END_CITY.getMonsterSpawns()); } diff --git a/src/main/java/carpet/mixins/ThreadedAnvilChunkStorage_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ThreadedAnvilChunkStorage_scarpetChunkCreationMixin.java index 9b089dee..6ec96b74 100644 --- a/src/main/java/carpet/mixins/ThreadedAnvilChunkStorage_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ThreadedAnvilChunkStorage_scarpetChunkCreationMixin.java @@ -93,7 +93,7 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem protected abstract boolean updateHolderMap(); @Shadow - protected abstract CompletableFuture, Unloaded>> createChunkRegionFuture(final ChunkPos centerChunk, final int margin, final IntFunction distanceToStatus); + protected abstract CompletableFuture, Unloaded>> getRegion (final ChunkPos centerChunk, final int margin, final IntFunction distanceToStatus); //in method_20617 //method_19534(Lnet/minecraft/server/world/ChunkHolder;Lnet/minecraft/world/chunk/Chunk;)Ljava/util/concurrent/CompletableFuture; @@ -114,7 +114,7 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem @Unique private void addTicket(final ChunkPos pos, final ChunkStatus status) { // UNKNOWN - this.ticketManager.addTicketWithLevel(ChunkTicketType.field_14032, pos, 33 + ChunkStatus.getTargetGenerationRadius(status), pos); + this.ticketManager.addTicketWithLevel(ChunkTicketType.field_14032, pos, 33 + ChunkStatus.getDistanceFromFull(status), pos); } @Unique @@ -162,7 +162,7 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem { final Set existingChunks = this.getExistingChunks(requestedChunks); for (final ChunkPos pos : existingChunks) - this.currentChunkHolders.get(pos.toLong()).createFuture(ChunkStatus.EMPTY, (ThreadedAnvilChunkStorage) (Object) this); + this.currentChunkHolders.get(pos.toLong()).getChunkAt(ChunkStatus.EMPTY, (ThreadedAnvilChunkStorage) (Object) this); return existingChunks; } @@ -184,7 +184,7 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem // Fetch all currently loaded chunks final Set loadedChunks = requestedChunks.stream().filter( - pos -> this.currentChunkHolders.get(pos.toLong()).getCompletedChunk() != null // all relevant ChunkHolders exist + pos -> this.currentChunkHolders.get(pos.toLong()).getCurrentChunk() != null // all relevant ChunkHolders exist ).collect(Collectors.toSet()); if (report != null) @@ -223,7 +223,7 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem @Unique private Chunk getCurrentChunk(final ChunkPos pos) { - final CompletableFuture future = this.currentChunkHolders.get(pos.toLong()).getFuture(); + final CompletableFuture future = this.currentChunkHolders.get(pos.toLong()).getSavingFuture(); this.waitFor(future); return future.join(); @@ -234,14 +234,14 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem { this.addTicket(pos); this.tickTicketManager(); - if (this.currentChunkHolders.get(pos.toLong()).getCompletedChunk() == null) // chunk unloaded + if (this.currentChunkHolders.get(pos.toLong()).getCurrentChunk() == null) // chunk unloaded if (WorldTools.canHasChunk(this.world, pos, null, true)) - this.currentChunkHolders.get(pos.toLong()).createFuture(ChunkStatus.EMPTY, (ThreadedAnvilChunkStorage) (Object) this); + this.currentChunkHolders.get(pos.toLong()).getChunkAt(ChunkStatus.EMPTY, (ThreadedAnvilChunkStorage) (Object) this); final Chunk chunk = this.getCurrentChunk(pos); if (!(chunk.getStatus().isAtLeast(ChunkStatus.LIGHT.getPrevious()))) return; ((ServerLightingProviderInterface) this.serverLightingProvider).removeLightData(chunk); this.addRelightTicket(pos); - final CompletableFuture lightFuture = this.createChunkRegionFuture(pos, 1, (pos_) -> ChunkStatus.LIGHT) + final CompletableFuture lightFuture = this.getRegion (pos, 1, (pos_) -> ChunkStatus.LIGHT) .thenCompose( either -> either.map( list -> ((ServerLightingProviderInterface) this.serverLightingProvider).relight(chunk), @@ -360,7 +360,7 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem { final ChunkPos pos = chunk.getPos(); - lightFutures.add(this.createChunkRegionFuture(pos, 1, (pos_) -> ChunkStatus.LIGHT).thenCompose( + lightFutures.add(this.getRegion (pos, 1, (pos_) -> ChunkStatus.LIGHT).thenCompose( either -> either.map( list -> ((ServerLightingProviderInterface) this.serverLightingProvider).relight(chunk), unloaded -> { @@ -389,7 +389,7 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem for (final Entry entry : targetGenerationStatus.entrySet()) targetGenerationFutures.add(Pair.of( entry.getValue(), - this.currentChunkHolders.get(entry.getKey().toLong()).createFuture(entry.getValue(), (ThreadedAnvilChunkStorage) (Object) this) + this.currentChunkHolders.get(entry.getKey().toLong()).getChunkAt(entry.getValue(), (ThreadedAnvilChunkStorage) (Object) this) )); final Map>> targetGenerationFuturesGrouped = targetGenerationFutures.stream().collect( diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java index 9575ae4c..76b5c5f3 100644 --- a/src/main/java/carpet/utils/SpawnReporter.java +++ b/src/main/java/carpet/utils/SpawnReporter.java @@ -416,7 +416,7 @@ public class SpawnReporter // yeeted from SpawnHelper - temporary fix private static List method_29950(ServerWorld serverWorld, StructureAccessor structureAccessor, ChunkGenerator chunkGenerator, SpawnGroup spawnGroup, BlockPos blockPos, /*@Nullable*/ Biome biome) { - return spawnGroup == SpawnGroup.MONSTER && serverWorld.getBlockState(blockPos.down()).getBlock() == Blocks.NETHER_BRICKS && structureAccessor.method_28388(blockPos, false, StructureFeature.FORTRESS).hasChildren() ? StructureFeature.FORTRESS.getMonsterSpawns() : chunkGenerator.getEntitySpawnList(biome != null ? biome : serverWorld.getBiome(blockPos), structureAccessor, spawnGroup, blockPos); + return spawnGroup == SpawnGroup.MONSTER && serverWorld.getBlockState(blockPos.down()).getBlock() == Blocks.NETHER_BRICKS && structureAccessor.getStructureAt(blockPos, false, StructureFeature.FORTRESS).hasChildren() ? StructureFeature.FORTRESS.getMonsterSpawns() : chunkGenerator.getEntitySpawnList(biome != null ? biome : serverWorld.getBiome(blockPos), structureAccessor, spawnGroup, blockPos); } public static List report(BlockPos pos, ServerWorld worldIn)