From bab49be81e2630ee716b84fae62711c26949518d Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 29 Jul 2020 17:28:15 -0300 Subject: [PATCH] 1.16.2-pre1 --- gradle.properties | 4 ++-- src/main/java/carpet/helpers/FeatureGenerator.java | 4 ++-- .../carpet/mixins/BastionRemnantFeatureMixin.java | 11 ++++++----- .../java/carpet/mixins/DesertPyramidFeatureMixin.java | 7 ++++--- src/main/java/carpet/mixins/EndCityFeatureMixin.java | 5 +++-- .../java/carpet/mixins/FlatChunkGeneratorMixin.java | 3 ++- src/main/java/carpet/mixins/SpawnHelperMixin.java | 2 +- .../mixins/SurfaceChunkGenerator_husksSpawnMixin.java | 3 ++- src/main/java/carpet/utils/PerimeterDiagnostics.java | 5 +++-- src/main/java/carpet/utils/SpawnReporter.java | 7 ++++--- 10 files changed, 29 insertions(+), 22 deletions(-) diff --git a/gradle.properties b/gradle.properties index d4a23dac..4cc87c33 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=20w30a - yarn_mappings=20w30a+build.26 + minecraft_version=1.16.2-pre1 + yarn_mappings=1.16.2-pre1+build.1 loader_version=0.9.0+build.204 # Mod Properties diff --git a/src/main/java/carpet/helpers/FeatureGenerator.java b/src/main/java/carpet/helpers/FeatureGenerator.java index 73467f12..03a34994 100644 --- a/src/main/java/carpet/helpers/FeatureGenerator.java +++ b/src/main/java/carpet/helpers/FeatureGenerator.java @@ -140,7 +140,7 @@ public class FeatureGenerator private static ConfiguredStructureFeature getDefaultFeature(StructureFeature structure, ServerWorld world, BlockPos pos, boolean tryHard) { - ConfiguredStructureFeature configuredFeature = world.getBiome(pos).method_28405(structure.configure(null)); + ConfiguredStructureFeature configuredFeature = world.getBiome(pos).method_30970().method_30978(structure.configure(null)); if (configuredFeature.config != null || !tryHard) return configuredFeature; return BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE.getEntries().stream(). filter(cS -> cS.getValue().feature == structure). @@ -159,7 +159,7 @@ public class FeatureGenerator ChunkRandom chunkRandom = new ChunkRandom(); ChunkPos chunkPos = new ChunkPos(pos); Biome biome = biomeAccess.getBiome(new BlockPos(chunkPos.getStartX() + 9, 0, chunkPos.getStartZ() + 9)); - ConfiguredStructureFeature configuredFeature = biome.method_28405(structure.configure(null)); + ConfiguredStructureFeature configuredFeature = biome.method_30970().method_30978(structure.configure(null)); if (configuredFeature == null || configuredFeature.config == null) return null; ChunkPos chunkPos2 = structure.getStartChunk(params, seed, chunkRandom, chunkPos.x, chunkPos.z); //find some chunk I guess if (chunkPos.x == chunkPos2.x && chunkPos.z == chunkPos2.z && ((StructureFeatureInterface)structure).shouldStartPublicAt(generator, generator.getBiomeSource(), seed, chunkRandom, chunkPos.x, chunkPos.z, biome, chunkPos, configuredFeature.config)) // should start at diff --git a/src/main/java/carpet/mixins/BastionRemnantFeatureMixin.java b/src/main/java/carpet/mixins/BastionRemnantFeatureMixin.java index 2fdfa29e..d5099d25 100644 --- a/src/main/java/carpet/mixins/BastionRemnantFeatureMixin.java +++ b/src/main/java/carpet/mixins/BastionRemnantFeatureMixin.java @@ -7,6 +7,7 @@ import com.mojang.serialization.Codec; import net.minecraft.class_5434; import net.minecraft.entity.EntityType; import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.SpawnSettings; import net.minecraft.world.gen.feature.BastionRemnantFeature; import net.minecraft.world.gen.feature.StructurePoolFeatureConfig; @@ -18,10 +19,10 @@ import java.util.List; @Mixin(BastionRemnantFeature.class) public abstract class BastionRemnantFeatureMixin extends class_5434 { - private static final List spawnList = Lists.newArrayList( - new Biome.SpawnEntry(EntityType.PIGLIN_BRUTE, 5, 1, 2), - new Biome.SpawnEntry(EntityType.PIGLIN, 10, 2, 4), - new Biome.SpawnEntry(EntityType.HOGLIN, 2, 1, 2) + private static final List spawnList = Lists.newArrayList( + new SpawnSettings.SpawnEntry(EntityType.PIGLIN_BRUTE, 5, 1, 2), + new SpawnSettings.SpawnEntry(EntityType.PIGLIN, 10, 2, 4), + new SpawnSettings.SpawnEntry(EntityType.HOGLIN, 2, 1, 2) ); public BastionRemnantFeatureMixin(Codec codec, int i, boolean bl, boolean bl2) @@ -30,7 +31,7 @@ public abstract class BastionRemnantFeatureMixin extends class_5434 } @Override - public List getMonsterSpawns() + public List getMonsterSpawns() { if (CarpetSettings.piglinsSpawningInBastions) return spawnList; diff --git a/src/main/java/carpet/mixins/DesertPyramidFeatureMixin.java b/src/main/java/carpet/mixins/DesertPyramidFeatureMixin.java index 9f3778fe..af99be30 100644 --- a/src/main/java/carpet/mixins/DesertPyramidFeatureMixin.java +++ b/src/main/java/carpet/mixins/DesertPyramidFeatureMixin.java @@ -7,6 +7,7 @@ import com.mojang.serialization.Codec; import net.minecraft.entity.EntityType; import net.minecraft.world.biome.Biome; //import net.minecraft.world.gen.feature.AbstractTempleFeature; +import net.minecraft.world.biome.SpawnSettings; import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.gen.feature.DesertPyramidFeature; import net.minecraft.world.gen.feature.StructureFeature; @@ -19,11 +20,11 @@ import java.util.List; @Mixin(DesertPyramidFeature.class) public abstract class DesertPyramidFeatureMixin extends StructureFeature { - private static final List MONSTER_SPAWNS; + private static final List MONSTER_SPAWNS; static { - MONSTER_SPAWNS = Lists.newArrayList(new Biome.SpawnEntry(EntityType.HUSK, 1, 1, 1)); + MONSTER_SPAWNS = Lists.newArrayList(new SpawnSettings.SpawnEntry(EntityType.HUSK, 1, 1, 1)); } public DesertPyramidFeatureMixin(Codec codec) @@ -33,7 +34,7 @@ public abstract class DesertPyramidFeatureMixin extends StructureFeature getMonsterSpawns() + public List getMonsterSpawns() { if (CarpetSettings.huskSpawningInTemples) { diff --git a/src/main/java/carpet/mixins/EndCityFeatureMixin.java b/src/main/java/carpet/mixins/EndCityFeatureMixin.java index 417582a7..0a1f412d 100644 --- a/src/main/java/carpet/mixins/EndCityFeatureMixin.java +++ b/src/main/java/carpet/mixins/EndCityFeatureMixin.java @@ -6,6 +6,7 @@ import com.google.common.collect.Lists; import com.mojang.serialization.Codec; import net.minecraft.entity.EntityType; import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.SpawnSettings; import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.gen.feature.EndCityFeature; import net.minecraft.world.gen.feature.StructureFeature; @@ -18,7 +19,7 @@ import java.util.List; @Mixin(EndCityFeature.class) public abstract class EndCityFeatureMixin extends StructureFeature { - private static final List spawnList = Lists.newArrayList(new Biome.SpawnEntry(EntityType.SHULKER, 10, 4, 4)); + private static final List spawnList = Lists.newArrayList(new SpawnSettings.SpawnEntry(EntityType.SHULKER, 10, 4, 4)); public EndCityFeatureMixin(Codec codec) { @@ -26,7 +27,7 @@ public abstract class EndCityFeatureMixin extends StructureFeature getMonsterSpawns() + public List getMonsterSpawns() { if (CarpetSettings.shulkerSpawningInEndCities) return spawnList; diff --git a/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java b/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java index 35620d79..743c5ff8 100644 --- a/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java +++ b/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java @@ -6,6 +6,7 @@ import net.minecraft.entity.SpawnGroup; import net.minecraft.util.math.BlockPos; //import net.minecraft.world.WorldAccess; import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.SpawnSettings; import net.minecraft.world.biome.source.BiomeSource; import net.minecraft.world.gen.StructureAccessor; import net.minecraft.world.gen.chunk.ChunkGenerator; @@ -29,7 +30,7 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator } @Override - public List getEntitySpawnList(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos) + public List getEntitySpawnList(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos) { if (CarpetSettings.flatWorldStructureSpawning) { diff --git a/src/main/java/carpet/mixins/SpawnHelperMixin.java b/src/main/java/carpet/mixins/SpawnHelperMixin.java index ae747765..bfd1df3c 100644 --- a/src/main/java/carpet/mixins/SpawnHelperMixin.java +++ b/src/main/java/carpet/mixins/SpawnHelperMixin.java @@ -46,7 +46,7 @@ public class SpawnHelperMixin @Shadow @Final private static SpawnGroup[] SPAWNABLE_GROUPS; - @Redirect(method = "canSpawn(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/entity/SpawnGroup;Lnet/minecraft/world/gen/StructureAccessor;Lnet/minecraft/world/gen/chunk/ChunkGenerator;Lnet/minecraft/world/biome/Biome$SpawnEntry;Lnet/minecraft/util/math/BlockPos$Mutable;D)Z", at = @At( + @Redirect(method = "canSpawn(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/entity/SpawnGroup;Lnet/minecraft/world/gen/StructureAccessor;Lnet/minecraft/world/gen/chunk/ChunkGenerator;Lnet/minecraft/world/biome/SpawnSettings$SpawnEntry;Lnet/minecraft/util/math/BlockPos$Mutable;D)Z", at = @At( value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;doesNotCollide(Lnet/minecraft/util/math/Box;)Z" )) diff --git a/src/main/java/carpet/mixins/SurfaceChunkGenerator_husksSpawnMixin.java b/src/main/java/carpet/mixins/SurfaceChunkGenerator_husksSpawnMixin.java index 2cf5f5c0..2f409dfa 100644 --- a/src/main/java/carpet/mixins/SurfaceChunkGenerator_husksSpawnMixin.java +++ b/src/main/java/carpet/mixins/SurfaceChunkGenerator_husksSpawnMixin.java @@ -4,6 +4,7 @@ import carpet.CarpetSettings; import net.minecraft.entity.SpawnGroup; import net.minecraft.util.math.BlockPos; import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.SpawnSettings; import net.minecraft.world.biome.source.BiomeSource; import net.minecraft.world.gen.StructureAccessor; import net.minecraft.world.gen.chunk.ChunkGenerator; @@ -28,7 +29,7 @@ public abstract class SurfaceChunkGenerator_husksSpawnMixin extends ChunkGenerat } @Inject(method = "getEntitySpawnList", at = @At("HEAD"), cancellable = true) - private void isInsidePyramid(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos, CallbackInfoReturnable> cir) + private void isInsidePyramid(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos, CallbackInfoReturnable> cir) { if (CarpetSettings.huskSpawningInTemples && group == SpawnGroup.MONSTER) { diff --git a/src/main/java/carpet/utils/PerimeterDiagnostics.java b/src/main/java/carpet/utils/PerimeterDiagnostics.java index c8d14edc..ae061f14 100644 --- a/src/main/java/carpet/utils/PerimeterDiagnostics.java +++ b/src/main/java/carpet/utils/PerimeterDiagnostics.java @@ -17,6 +17,7 @@ import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; import net.minecraft.world.SpawnHelper; import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.SpawnSettings; import java.util.ArrayList; import java.util.List; @@ -34,7 +35,7 @@ public class PerimeterDiagnostics samples = new ArrayList<>(); } } - private Biome.SpawnEntry sle; + private SpawnSettings.SpawnEntry sle; private ServerWorld worldServer; private SpawnGroup ctype; private MobEntity el; @@ -161,7 +162,7 @@ public class PerimeterDiagnostics 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.getBiome(pos), worldServer.getStructureAccessor(), ctype, pos)) + for (SpawnSettings.SpawnEntry sle: worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getBiome(pos), worldServer.getStructureAccessor(), ctype, pos)) { if (el.getType() == sle.type) { diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java index 76b5c5f3..73424930 100644 --- a/src/main/java/carpet/utils/SpawnReporter.java +++ b/src/main/java/carpet/utils/SpawnReporter.java @@ -25,6 +25,7 @@ import net.minecraft.world.Heightmap; import net.minecraft.world.SpawnHelper; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.SpawnSettings; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.gen.StructureAccessor; import net.minecraft.world.gen.chunk.ChunkGenerator; @@ -415,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) { + 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.getStructureAt(blockPos, false, StructureFeature.FORTRESS).hasChildren() ? StructureFeature.FORTRESS.getMonsterSpawns() : chunkGenerator.getEntitySpawnList(biome != null ? biome : serverWorld.getBiome(blockPos), structureAccessor, spawnGroup, blockPos); } @@ -432,10 +433,10 @@ public class SpawnReporter for (SpawnGroup enumcreaturetype : SpawnGroup.values()) { String type_code = String.format("%s", enumcreaturetype).substring(0, 3); - List lst = method_29950(worldIn, worldIn.getStructureAccessor(), worldIn.getChunkManager().getChunkGenerator(), enumcreaturetype, pos, worldIn.getBiome(pos) );// ((ChunkGenerator)worldIn.getChunkManager().getChunkGenerator()).getEntitySpawnList(, worldIn.getStructureAccessor(), enumcreaturetype, pos); + List lst = method_29950(worldIn, worldIn.getStructureAccessor(), worldIn.getChunkManager().getChunkGenerator(), enumcreaturetype, pos, worldIn.getBiome(pos) );// ((ChunkGenerator)worldIn.getChunkManager().getChunkGenerator()).getEntitySpawnList(, worldIn.getStructureAccessor(), enumcreaturetype, pos); if (lst != null && !lst.isEmpty()) { - for (Biome.SpawnEntry spawnEntry : lst) + for (SpawnSettings.SpawnEntry spawnEntry : lst) { if (SpawnRestriction.getLocation(spawnEntry.type)==null) continue; // vanilla bug