From cfaf596c29c5f981bacc0db810c0d67c1c4f010c Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 12 Oct 2021 23:54:25 -0300 Subject: [PATCH] update mappings and 21w40a, apparently. --- gradle.properties | 8 ++++---- .../java/carpet/helpers/FeatureGenerator.java | 4 +++- .../carpet/mixins/FlatChunkGeneratorMixin.java | 16 ++++++++-------- src/main/java/carpet/mixins/HuskEntityMixin.java | 2 +- .../mixins/LivingEntity_creativeFlyMixin.java | 4 ++-- .../NoiseChunkGenerator_husksSpawnMixin.java | 6 +++--- .../carpet/mixins/StructureFeatureMixin.java | 4 +++- .../carpet/mixins/WorldChunk_movableTEMixin.java | 10 +++++----- src/main/java/carpet/script/api/WorldAccess.java | 2 +- 9 files changed, 30 insertions(+), 26 deletions(-) diff --git a/gradle.properties b/gradle.properties index 2eb8cf04..9df27365 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,10 +4,10 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use # or better: https://modmuss50.me/fabric.html - minecraft_version=21w38a - yarn_mappings=21w38a+build.2 - loader_version=0.11.7 - fabric_version=0.40.4+1.18 + minecraft_version=21w40a + yarn_mappings=21w40a+build.6 + loader_version=0.12.1 + fabric_version=0.40.8+1.18 # Mod Properties mod_version = 1.4.47 diff --git a/src/main/java/carpet/helpers/FeatureGenerator.java b/src/main/java/carpet/helpers/FeatureGenerator.java index 2cac3e79..01103629 100644 --- a/src/main/java/carpet/helpers/FeatureGenerator.java +++ b/src/main/java/carpet/helpers/FeatureGenerator.java @@ -23,6 +23,7 @@ import net.minecraft.world.biome.BuiltinBiomes; import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize; import net.minecraft.world.gen.foliage.BlobFoliagePlacer; import net.minecraft.world.gen.foliage.LargeOakFoliagePlacer; +import net.minecraft.world.gen.random.AtomicSimpleRandom; import net.minecraft.world.gen.random.ChunkRandom; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.StructureConfig; @@ -34,6 +35,7 @@ import net.minecraft.world.gen.feature.SimpleRandomFeatureConfig; import net.minecraft.world.gen.feature.StructureFeature; import net.minecraft.world.gen.feature.StructurePoolFeatureConfig; import net.minecraft.world.gen.feature.TreeFeatureConfig; +import net.minecraft.world.gen.random.RandomSeed; import net.minecraft.world.gen.stateprovider.BlockStateProvider; import net.minecraft.world.gen.treedecorator.BeehiveTreeDecorator; import net.minecraft.world.gen.trunk.LargeOakTrunkPlacer; @@ -202,7 +204,7 @@ public class FeatureGenerator long seed = world.getSeed(); ChunkGenerator generator = world.getChunkManager().getChunkGenerator(); StructureConfig params = generator.getStructuresConfig().getForType(structure); - ChunkRandom chunkRandom = new ChunkRandom(); + ChunkRandom chunkRandom = new ChunkRandom(new AtomicSimpleRandom(RandomSeed.getSeed())); ChunkPos chunkPos = new ChunkPos(pos); Biome biome = world.getBiome(new BlockPos(chunkPos.getStartX() + 9, 0, chunkPos.getStartZ() + 9)); ConfiguredStructureFeature configuredFeature = getDefaultFeature(structure, world, pos, false); diff --git a/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java b/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java index c66bf9f7..456bc9bf 100644 --- a/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java +++ b/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java @@ -36,7 +36,7 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator if (!CarpetSettings.flatWorldStructureSpawning) return super.getEntitySpawnList(biome, accessor, group, pos); // vanila noise one - if (accessor.getStructureAt(pos, true, StructureFeature.SWAMP_HUT).hasChildren()) { + if (accessor.getStructureAt(pos, StructureFeature.SWAMP_HUT).hasChildren()) { if (group == SpawnGroup.MONSTER) { return SwampHutFeature.MONSTER_SPAWNS; } @@ -47,15 +47,15 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator } if (group == SpawnGroup.MONSTER) { - if (accessor.getStructureAt(pos, false, StructureFeature.PILLAGER_OUTPOST).hasChildren()) { + if (accessor.getStructureAt(pos, StructureFeature.PILLAGER_OUTPOST).hasChildren()) { return PillagerOutpostFeature.MONSTER_SPAWNS; } - if (accessor.getStructureAt(pos, false, StructureFeature.MONUMENT).hasChildren()) { + if (accessor.getStructureAt(pos, StructureFeature.MONUMENT).hasChildren()) { return OceanMonumentFeature.MONSTER_SPAWNS; } - if (accessor.getStructureAt(pos, true, StructureFeature.FORTRESS).hasChildren()) { + if (accessor.getStructureAt(pos, StructureFeature.FORTRESS).hasChildren()) { return NetherFortressFeature.MONSTER_SPAWNS; } } @@ -66,27 +66,27 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator { if (CarpetSettings.huskSpawningInTemples) { - if (accessor.getStructureAt(pos, true, StructureFeature.DESERT_PYRAMID).hasChildren()) + if (accessor.getStructureAt(pos, StructureFeature.DESERT_PYRAMID).hasChildren()) { return CustomSpawnLists.PYRAMID_SPAWNS; } } if (CarpetSettings.shulkerSpawningInEndCities) { - if (accessor.getStructureAt(pos, true, StructureFeature.END_CITY).hasChildren()) + if (accessor.getStructureAt(pos, StructureFeature.END_CITY).hasChildren()) { return CustomSpawnLists.SHULKER_SPAWNS; } } if (CarpetSettings.piglinsSpawningInBastions) { - if (accessor.getStructureAt(pos, true, StructureFeature.BASTION_REMNANT).hasChildren()) + if (accessor.getStructureAt(pos, StructureFeature.BASTION_REMNANT).hasChildren()) { return CustomSpawnLists.BASTION_SPAWNS; } } } - return (group == SpawnGroup.UNDERGROUND_WATER_CREATURE || group == SpawnGroup.AXOLOTLS) && accessor.getStructureAt(pos, false, StructureFeature.MONUMENT).hasChildren() ? SpawnSettings.EMPTY_ENTRY_POOL : super.getEntitySpawnList(biome, accessor, group, pos); + return (group == SpawnGroup.UNDERGROUND_WATER_CREATURE || group == SpawnGroup.AXOLOTLS) && accessor.getStructureAt(pos, StructureFeature.MONUMENT).hasChildren() ? SpawnSettings.EMPTY_ENTRY_POOL : super.getEntitySpawnList(biome, accessor, group, pos); } diff --git a/src/main/java/carpet/mixins/HuskEntityMixin.java b/src/main/java/carpet/mixins/HuskEntityMixin.java index 13d27836..06dcbb76 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(ServerWorldAccess serverWorldAccess, BlockPos pos) { return serverWorldAccess.isSkyVisible(pos) || - (CarpetSettings.huskSpawningInTemples && (((ServerWorld)serverWorldAccess).getStructureAccessor().getStructureAt(pos, false, StructureFeature.DESERT_PYRAMID).hasChildren())); + (CarpetSettings.huskSpawningInTemples && (((ServerWorld)serverWorldAccess).getStructureAccessor().getStructureAt(pos, StructureFeature.DESERT_PYRAMID).hasChildren())); } } diff --git a/src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java b/src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java index 7de5e55c..a96f0155 100644 --- a/src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java +++ b/src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java @@ -17,7 +17,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(LivingEntity.class) public abstract class LivingEntity_creativeFlyMixin extends Entity { - @Shadow public float flyingSpeed; + @Shadow public float airStrafingSpeed; public LivingEntity_creativeFlyMixin(EntityType type, World world) { @@ -44,7 +44,7 @@ public abstract class LivingEntity_creativeFlyMixin extends Entity { PlayerEntity self = (PlayerEntity)(Object)(this); if (self.getAbilities().flying && !onGround) - cir.setReturnValue(flyingSpeed* (float)CarpetSettings.creativeFlySpeed); + cir.setReturnValue( airStrafingSpeed* (float)CarpetSettings.creativeFlySpeed); } } } diff --git a/src/main/java/carpet/mixins/NoiseChunkGenerator_husksSpawnMixin.java b/src/main/java/carpet/mixins/NoiseChunkGenerator_husksSpawnMixin.java index 773c48d3..ead8ed9c 100644 --- a/src/main/java/carpet/mixins/NoiseChunkGenerator_husksSpawnMixin.java +++ b/src/main/java/carpet/mixins/NoiseChunkGenerator_husksSpawnMixin.java @@ -37,7 +37,7 @@ public abstract class NoiseChunkGenerator_husksSpawnMixin extends ChunkGenerator { if (CarpetSettings.huskSpawningInTemples) { - if (accessor.getStructureAt(pos, true, StructureFeature.DESERT_PYRAMID).hasChildren()) + if (accessor.getStructureAt(pos, StructureFeature.DESERT_PYRAMID).hasChildren()) { cir.setReturnValue(CustomSpawnLists.PYRAMID_SPAWNS); return; @@ -45,7 +45,7 @@ public abstract class NoiseChunkGenerator_husksSpawnMixin extends ChunkGenerator } if (CarpetSettings.shulkerSpawningInEndCities) { - if (accessor.getStructureAt(pos, true, StructureFeature.END_CITY).hasChildren()) + if (accessor.getStructureAt(pos, StructureFeature.END_CITY).hasChildren()) { cir.setReturnValue(CustomSpawnLists.SHULKER_SPAWNS); return; @@ -53,7 +53,7 @@ public abstract class NoiseChunkGenerator_husksSpawnMixin extends ChunkGenerator } if (CarpetSettings.piglinsSpawningInBastions) { - if (accessor.getStructureAt(pos, true, StructureFeature.BASTION_REMNANT).hasChildren()) + if (accessor.getStructureAt(pos, StructureFeature.BASTION_REMNANT).hasChildren()) { cir.setReturnValue(CustomSpawnLists.BASTION_SPAWNS); } diff --git a/src/main/java/carpet/mixins/StructureFeatureMixin.java b/src/main/java/carpet/mixins/StructureFeatureMixin.java index 0ea13c4c..f1400b12 100644 --- a/src/main/java/carpet/mixins/StructureFeatureMixin.java +++ b/src/main/java/carpet/mixins/StructureFeatureMixin.java @@ -19,12 +19,14 @@ import net.minecraft.world.biome.source.BiomeCoords; import net.minecraft.world.biome.source.BiomeSource; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkStatus; +import net.minecraft.world.gen.random.AtomicSimpleRandom; import net.minecraft.world.gen.random.ChunkRandom; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.feature.ConfiguredStructureFeature; import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.gen.feature.FeatureConfig; import net.minecraft.world.gen.feature.StructureFeature; +import net.minecraft.world.gen.random.RandomSeed; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -134,7 +136,7 @@ public abstract class StructureFeatureMixin implements // config = (C) new DefaultFeatureConfig(); class_6626 lv = new class_6626(); - field_34929.generatePieces(lv, config, new class_6622.class_6623(worldIn.getRegistryManager(), generator, worldIn.getStructureManager(), chunkpos, b -> true, worldIn, Util.make(new ChunkRandom(), (chunkRandomx) -> { + field_34929.generatePieces(lv, config, new class_6622.class_6623(worldIn.getRegistryManager(), generator, worldIn.getStructureManager(), chunkpos, b -> true, worldIn, Util.make(new ChunkRandom(new AtomicSimpleRandom(RandomSeed.getSeed())), (chunkRandomx) -> { chunkRandomx.setCarverSeed(worldIn.getSeed(), chunkpos.x, chunkpos.z); }), worldIn.getSeed())); StructureStart structurestart1 = new StructureStart<>(thiss, chunkpos, 0, lv.method_38714()); diff --git a/src/main/java/carpet/mixins/WorldChunk_movableTEMixin.java b/src/main/java/carpet/mixins/WorldChunk_movableTEMixin.java index 0cfe3f89..e35a6c37 100644 --- a/src/main/java/carpet/mixins/WorldChunk_movableTEMixin.java +++ b/src/main/java/carpet/mixins/WorldChunk_movableTEMixin.java @@ -99,10 +99,10 @@ public abstract class WorldChunk_movableTEMixin extends Chunk implements WorldCh { Block newBlock = newBlockState.getBlock(); Block oldBlock = oldBlockState.getBlock(); - ((Heightmap) this.field_34541.get(Heightmap.Type.MOTION_BLOCKING)).trackUpdate(x, y, z, newBlockState); - ((Heightmap) this.field_34541.get(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES)).trackUpdate(x, y, z, newBlockState); - ((Heightmap) this.field_34541.get(Heightmap.Type.OCEAN_FLOOR)).trackUpdate(x, y, z, newBlockState); - ((Heightmap) this.field_34541.get(Heightmap.Type.WORLD_SURFACE)).trackUpdate(x, y, z, newBlockState); + ((Heightmap) this.heightmaps.get(Heightmap.Type.MOTION_BLOCKING)).trackUpdate(x, y, z, newBlockState); + ((Heightmap) this.heightmaps.get(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES)).trackUpdate(x, y, z, newBlockState); + ((Heightmap) this.heightmaps.get(Heightmap.Type.OCEAN_FLOOR)).trackUpdate(x, y, z, newBlockState); + ((Heightmap) this.heightmaps.get(Heightmap.Type.WORLD_SURFACE)).trackUpdate(x, y, z, newBlockState); boolean boolean_3 = chunkSection.isEmpty(); if (boolean_2 != boolean_3) { @@ -156,7 +156,7 @@ public abstract class WorldChunk_movableTEMixin extends Chunk implements WorldCh newBlockState.onBlockAdded(this.world, blockPos_1, oldBlockState, boolean_1); //This can call setblockstate! (e.g. hopper does) } - this.field_34537 = true; // shouldSave + this.needsSaving = true; // shouldSave return oldBlockState; } } diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index a1948607..e27c90c4 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -1187,7 +1187,7 @@ public class WorldAccess { int j = i + BiomeCoords.fromBlock(chunk.getHeight()) - 1; int k = MathHelper.clamp(biomeY, i, j); int l = chunk.getSectionIndex(BiomeCoords.toBlock(k)); - chunk.getSection(l).method_38294().setSync(biomeX & 3, k & 3, biomeZ & 3, biome); + chunk.getSection(l).method_38294().set(biomeX & 3, k & 3, biomeZ & 3, biome); } catch (Throwable var8) { return Value.FALSE; }