diff --git a/gradle.properties b/gradle.properties index ded7b2bc..72a418cc 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=21w11a - yarn_mappings=21w11a+build.46 + minecraft_version=21w13a + yarn_mappings=21w13a+build.2 loader_version=0.11.3 fabric_version=0.32.5+1.17 diff --git a/src/main/java/carpet/CarpetSettings.java b/src/main/java/carpet/CarpetSettings.java index abd6287e..1ba4331e 100644 --- a/src/main/java/carpet/CarpetSettings.java +++ b/src/main/java/carpet/CarpetSettings.java @@ -184,9 +184,6 @@ public class CarpetSettings @Rule( desc = "Players absorb XP instantly, without delay", category = CREATIVE ) public static boolean xpNoCooldown = false; - @Rule( desc = "xpfix", category = SURVIVAL ) - public static boolean xpfix = false; - @Rule( desc = "XP orbs combine with other into bigger orbs", category = FEATURE ) public static boolean combineXPOrbs = false; diff --git a/src/main/java/carpet/commands/ScriptCommand.java b/src/main/java/carpet/commands/ScriptCommand.java index ceda769d..bc9d5b4e 100644 --- a/src/main/java/carpet/commands/ScriptCommand.java +++ b/src/main/java/carpet/commands/ScriptCommand.java @@ -470,7 +470,7 @@ public class ScriptCommand CarpetScriptHost host = getHost(context); BlockBox area = BlockBox.create(a, b); CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin); - int int_1 = area.getBlockCountX() * area.getBlockCountY() * area.getBlockCountZ(); + int int_1 = area.getBlockCountX() * area.getBlockCountY() * area.method_35414(); // X Y Z if (int_1 > CarpetSettings.fillLimit) { Messenger.m(source, "r too many blocks to evaluate: " + int_1); @@ -480,11 +480,11 @@ public class ScriptCommand CarpetSettings.impendingFillSkipUpdates = !CarpetSettings.fillUpdates; try { - for (int x = area.minX; x <= area.maxX; x++) + for (int x = area.method_35420(); x <= area.method_35417(); x++) //minx maxx { - for (int y = area.minY; y <= area.maxY; y++) + for (int y = area.method_35415(); y <= area.method_35418(); y++) // miny maxy { - for (int z = area.minZ; z <= area.maxZ; z++) + for (int z = area.method_35416(); z <= area.method_35419(); z++) // minz maxz { try { @@ -519,29 +519,29 @@ public class ScriptCommand CarpetScriptHost host = getHost(context); BlockBox area = BlockBox.create(a, b); CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin); - int int_1 = area.getBlockCountX() * area.getBlockCountY() * area.getBlockCountZ(); + int int_1 = area.getBlockCountX() * area.getBlockCountY() * area.method_35414(); if (int_1 > CarpetSettings.fillLimit) { Messenger.m(source, "r too many blocks to evaluate: "+ int_1); return 1; } - boolean[][][] volume = new boolean[area.getBlockCountX()][area.getBlockCountY()][area.getBlockCountZ()]; + boolean[][][] volume = new boolean[area.getBlockCountY()][area.method_35414()][area.getBlockCountX()]; //X then Y then Z got messedup BlockPos.Mutable mbpos = origin.mutableCopy(); ServerWorld world = source.getWorld(); - for (int x = area.minX; x <= area.maxX; x++) + for (int x = area.method_35420(); x <= area.method_35417(); x++) //minx maxx { - for (int y = area.minY; y <= area.maxY; y++) + for (int y = area.method_35415(); y <= area.method_35418(); y++) // miny maxy { - for (int z = area.minZ; z <= area.maxZ; z++) + for (int z = area.method_35416(); z <= area.method_35419(); z++) // minz maxz { try { if (cexpr.fillAndScanCommand(host, x, y, z)) { - volume[x-area.minX][y-area.minY][z-area.minZ]=true; + volume[x-area.method_35420()][y-area.method_35415()][z-area.method_35416()]=true; } } catch (CarpetExpressionException e) @@ -555,12 +555,12 @@ public class ScriptCommand } } } - final int maxx = area.getBlockCountX()-1; - final int maxy = area.getBlockCountY()-1; - final int maxz = area.getBlockCountZ()-1; + final int maxx = area.getBlockCountY()-1; //x + final int maxy = area.method_35414()-1; //y + final int maxz = area.getBlockCountX()-1; //z if ("outline".equalsIgnoreCase(mode)) { - boolean[][][] newVolume = new boolean[area.getBlockCountX()][area.getBlockCountY()][area.getBlockCountZ()]; + boolean[][][] newVolume = new boolean[area.getBlockCountY()][area.method_35414()][area.getBlockCountX()]; //X then Y then Z got messedup for (int x = 0; x <= maxx; x++) { for (int y = 0; y <= maxy; y++) @@ -596,7 +596,7 @@ public class ScriptCommand { if (volume[x][y][z]) { - mbpos.set(x+area.minX, y+area.minY, z+area.minZ); + mbpos.set(x+area.method_35420(), y+area.method_35415(), z+area.method_35416()); if (replacement == null || replacement.test( new CachedBlockPosition( world, mbpos, true))) { @@ -624,7 +624,7 @@ public class ScriptCommand { if (volume[x][y][z]) { - mbpos.set(x+area.minX, y+area.minY, z+area.minZ); + mbpos.set(x+area.method_35420(), y+area.method_35415(), z+area.method_35416()); Block blokc = world.getBlockState(mbpos).getBlock(); world.updateNeighbors(mbpos, blokc); } @@ -632,7 +632,7 @@ public class ScriptCommand } } } - Messenger.m(source, "gi Affected "+affected+" blocks in "+area.getBlockCountX() * area.getBlockCountY() * area.getBlockCountZ()+" block volume"); + Messenger.m(source, "gi Affected "+affected+" blocks in "+area.getBlockCountX() * area.getBlockCountY() * area.method_35414()+" block volume"); return 1; } } diff --git a/src/main/java/carpet/fakes/InventoryBearerInterface.java b/src/main/java/carpet/fakes/InventoryBearerInterface.java index aa282382..a1426973 100644 --- a/src/main/java/carpet/fakes/InventoryBearerInterface.java +++ b/src/main/java/carpet/fakes/InventoryBearerInterface.java @@ -1,8 +1,9 @@ package carpet.fakes; +import net.minecraft.class_6067; import net.minecraft.inventory.Inventory; public interface InventoryBearerInterface { - Inventory getCMInventory(); + Inventory getCMInventory(); // can be removed in 1.17 due to class_6067 } diff --git a/src/main/java/carpet/helpers/BlockRotator.java b/src/main/java/carpet/helpers/BlockRotator.java index e0b27d3f..8f9e9936 100644 --- a/src/main/java/carpet/helpers/BlockRotator.java +++ b/src/main/java/carpet/helpers/BlockRotator.java @@ -226,7 +226,7 @@ public class BlockRotator { Direction sourceFace = source.getBlockState().get(DispenserBlock.FACING); World world = source.getWorld(); - BlockPos blockpos = source.getBlockPos().offset(sourceFace); + BlockPos blockpos = source.getBlockPos().method_35851(sourceFace); // offset BlockState iblockstate = world.getBlockState(blockpos); Block block = iblockstate.getBlock(); diff --git a/src/main/java/carpet/helpers/FeatureGenerator.java b/src/main/java/carpet/helpers/FeatureGenerator.java index c2fd2be0..fc1c500a 100644 --- a/src/main/java/carpet/helpers/FeatureGenerator.java +++ b/src/main/java/carpet/helpers/FeatureGenerator.java @@ -162,7 +162,7 @@ public class FeatureGenerator { if (!computeBox) return StructureStart.DEFAULT; StructureManager manager = world.getStructureManager(); - StructureStart structureStart3 = structure.getStructureStartFactory().create((StructureFeature) configuredFeature.feature, chunkPos, BlockBox.empty(), 0, seed); + StructureStart structureStart3 = structure.getStructureStartFactory().create((StructureFeature) configuredFeature.feature, chunkPos, 0, seed); structureStart3.init(world.getRegistryManager(), generator, manager, chunkPos, biome, (T) configuredFeature.config, world); if (!structureStart3.hasChildren()) return null; return structureStart3; diff --git a/src/main/java/carpet/mixins/BastionRemnantFeatureMixin.java b/src/main/java/carpet/mixins/BastionRemnantFeatureMixin.java index bee4a591..9e3024cf 100644 --- a/src/main/java/carpet/mixins/BastionRemnantFeatureMixin.java +++ b/src/main/java/carpet/mixins/BastionRemnantFeatureMixin.java @@ -4,7 +4,9 @@ import carpet.CarpetSettings; import com.google.common.collect.Lists; import com.mojang.serialization.Codec; +import net.minecraft.class_6012; import net.minecraft.entity.EntityType; +import net.minecraft.world.MobSpawnerLogic; import net.minecraft.world.biome.SpawnSettings; import net.minecraft.world.gen.feature.BastionRemnantFeature; @@ -18,7 +20,7 @@ import java.util.List; @Mixin(BastionRemnantFeature.class) public abstract class BastionRemnantFeatureMixin extends JigsawFeature { - private static final List spawnList = Lists.newArrayList( + private static final class_6012 spawnList = class_6012.method_34989( 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) @@ -30,10 +32,10 @@ public abstract class BastionRemnantFeatureMixin extends JigsawFeature } @Override - public List getMonsterSpawns() + public class_6012 getMonsterSpawns() { if (CarpetSettings.piglinsSpawningInBastions) return spawnList; - return Collections.emptyList(); + return SpawnSettings.field_30982; // empty spawn list } } diff --git a/src/main/java/carpet/mixins/DesertPyramidFeatureMixin.java b/src/main/java/carpet/mixins/DesertPyramidFeatureMixin.java index 0b08e722..379f8bcf 100644 --- a/src/main/java/carpet/mixins/DesertPyramidFeatureMixin.java +++ b/src/main/java/carpet/mixins/DesertPyramidFeatureMixin.java @@ -3,6 +3,7 @@ package carpet.mixins; import carpet.CarpetSettings; import com.google.common.collect.Lists; import com.mojang.serialization.Codec; +import net.minecraft.class_6012; import net.minecraft.entity.EntityType; import net.minecraft.world.biome.SpawnSettings; import net.minecraft.world.gen.feature.DefaultFeatureConfig; @@ -16,11 +17,11 @@ import java.util.List; @Mixin(DesertPyramidFeature.class) public abstract class DesertPyramidFeatureMixin extends StructureFeature { - private static final List MONSTER_SPAWNS; + private static final class_6012 MONSTER_SPAWNS; static { - MONSTER_SPAWNS = Lists.newArrayList(new SpawnSettings.SpawnEntry(EntityType.HUSK, 1, 1, 1)); + MONSTER_SPAWNS = class_6012.method_34989(new SpawnSettings.SpawnEntry(EntityType.HUSK, 1, 1, 1)); } public DesertPyramidFeatureMixin(Codec codec) @@ -30,13 +31,13 @@ public abstract class DesertPyramidFeatureMixin extends StructureFeature getMonsterSpawns() + public class_6012 getMonsterSpawns() { if (CarpetSettings.huskSpawningInTemples) { return MONSTER_SPAWNS; } - return Collections.emptyList(); + return SpawnSettings.field_30982; // empty spawn list } } diff --git a/src/main/java/carpet/mixins/EndCityFeatureMixin.java b/src/main/java/carpet/mixins/EndCityFeatureMixin.java index 7ff4227c..6deefc73 100644 --- a/src/main/java/carpet/mixins/EndCityFeatureMixin.java +++ b/src/main/java/carpet/mixins/EndCityFeatureMixin.java @@ -3,6 +3,7 @@ package carpet.mixins; import carpet.CarpetSettings; import com.google.common.collect.Lists; import com.mojang.serialization.Codec; +import net.minecraft.class_6012; import net.minecraft.entity.EntityType; import net.minecraft.world.biome.SpawnSettings; import net.minecraft.world.gen.feature.DefaultFeatureConfig; @@ -16,7 +17,7 @@ import java.util.List; @Mixin(EndCityFeature.class) public abstract class EndCityFeatureMixin extends StructureFeature { - private static final List spawnList = Lists.newArrayList(new SpawnSettings.SpawnEntry(EntityType.SHULKER, 10, 4, 4)); + private static final class_6012 spawnList = class_6012.method_34989(new SpawnSettings.SpawnEntry(EntityType.SHULKER, 10, 4, 4)); public EndCityFeatureMixin(Codec codec) { @@ -24,10 +25,10 @@ public abstract class EndCityFeatureMixin extends StructureFeature getMonsterSpawns() + public class_6012 getMonsterSpawns() { if (CarpetSettings.shulkerSpawningInEndCities) return spawnList; - return Collections.emptyList(); + return SpawnSettings.field_30982; // empty spawn list } } diff --git a/src/main/java/carpet/mixins/EntityNavigation_pathfindingMixin.java b/src/main/java/carpet/mixins/EntityNavigation_pathfindingMixin.java index b819f013..45d402f9 100644 --- a/src/main/java/carpet/mixins/EntityNavigation_pathfindingMixin.java +++ b/src/main/java/carpet/mixins/EntityNavigation_pathfindingMixin.java @@ -7,6 +7,7 @@ import net.minecraft.entity.ai.pathing.Path; import net.minecraft.entity.mob.MobEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -22,18 +23,18 @@ public abstract class EntityNavigation_pathfindingMixin @Shadow @Final protected MobEntity entity; - @Shadow /*@Nullable*/ protected abstract Path findPathToAny(Set set_1, int int_1, boolean boolean_1, int int_2); + @Shadow protected @Nullable abstract Path method_35142(Set set, int i, boolean bl, int j); @Redirect(method = "findPathTo(Lnet/minecraft/util/math/BlockPos;I)Lnet/minecraft/entity/ai/pathing/Path;", at = @At( value = "INVOKE", - target = "Lnet/minecraft/entity/ai/pathing/EntityNavigation;findPathToAny(Ljava/util/Set;IZI)Lnet/minecraft/entity/ai/pathing/Path;" + target = "Lnet/minecraft/entity/ai/pathing/EntityNavigation;method_35142(Ljava/util/Set;IZI)Lnet/minecraft/entity/ai/pathing/Path;" )) private Path pathToBlock(EntityNavigation entityNavigation, Set set_1, int int_1, boolean boolean_1, int int_2) { if (!LoggerRegistry.__pathfinding) - return findPathToAny(set_1, int_1, boolean_1, int_2); + return method_35142(set_1, int_1, boolean_1, int_2); long start = System.nanoTime(); - Path path = findPathToAny(set_1, int_1, boolean_1, int_2); + Path path = method_35142(set_1, int_1, boolean_1, int_2); long finish = System.nanoTime(); float duration = (1.0F*((finish - start)/1000))/1000; set_1.forEach(b -> PathfindingVisualizer.slowPath(entity, Vec3d.ofBottomCenter(b), duration, path != null)); // ground centered position @@ -42,14 +43,14 @@ public abstract class EntityNavigation_pathfindingMixin @Redirect(method = "findPathTo(Lnet/minecraft/entity/Entity;I)Lnet/minecraft/entity/ai/pathing/Path;", at = @At( value = "INVOKE", - target = "Lnet/minecraft/entity/ai/pathing/EntityNavigation;findPathToAny(Ljava/util/Set;IZI)Lnet/minecraft/entity/ai/pathing/Path;" + target = "Lnet/minecraft/entity/ai/pathing/EntityNavigation;method_35142(Ljava/util/Set;IZI)Lnet/minecraft/entity/ai/pathing/Path;" )) private Path pathToEntity(EntityNavigation entityNavigation, Set set_1, int int_1, boolean boolean_1, int int_2) { if (!LoggerRegistry.__pathfinding) - return findPathToAny(set_1, int_1, boolean_1, int_2); + return method_35142(set_1, int_1, boolean_1, int_2); long start = System.nanoTime(); - Path path = findPathToAny(set_1, int_1, boolean_1, int_2); + Path path = method_35142(set_1, int_1, boolean_1, int_2); long finish = System.nanoTime(); float duration = (1.0F*((finish - start)/1000))/1000; set_1.forEach(b -> PathfindingVisualizer.slowPath(entity, Vec3d.ofBottomCenter(b), duration, path != null)); diff --git a/src/main/java/carpet/mixins/ExperienceOrbEntityMixin.java b/src/main/java/carpet/mixins/ExperienceOrbEntityMixin.java index e07d3d49..30aa4a50 100644 --- a/src/main/java/carpet/mixins/ExperienceOrbEntityMixin.java +++ b/src/main/java/carpet/mixins/ExperienceOrbEntityMixin.java @@ -84,22 +84,4 @@ public abstract class ExperienceOrbEntityMixin implements ExperienceOrbInterface playerEntity.addExperience(experience); } } - - // temporary until gets fixed game-side - @Inject(method = "onPlayerCollision", locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true, at = @At( - value = "INVOKE", - target = "Lnet/minecraft/entity/ExperienceOrbEntity;getMendingRepairAmount(I)I" - )) - void cancelApplication(PlayerEntity player, CallbackInfo ci, Map.Entry entry, ItemStack itemStack) - { - if (CarpetSettings.xpfix && pickingCount > 1) - { - int i = Math.min(getMendingRepairAmount(this.amount), itemStack.getDamage()); - pickingCount--; - itemStack.setDamage(itemStack.getDamage() - i); - // cancel effects of mending application - ci.cancel(); - } - } - } diff --git a/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java b/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java index 5dfa9edd..0124e0d4 100644 --- a/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java +++ b/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java @@ -1,6 +1,7 @@ package carpet.mixins; import carpet.CarpetSettings; +import net.minecraft.class_6012; import net.minecraft.entity.SpawnGroup; import net.minecraft.util.math.BlockPos; import net.minecraft.world.biome.Biome; @@ -25,7 +26,7 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator } @Override - public List getEntitySpawnList(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos) + public class_6012 getEntitySpawnList(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos) { if (CarpetSettings.flatWorldStructureSpawning) { diff --git a/src/main/java/carpet/mixins/FluidBlock_renewableBlackstoneMixin.java b/src/main/java/carpet/mixins/FluidBlock_renewableBlackstoneMixin.java index e3b620d8..5a522daa 100644 --- a/src/main/java/carpet/mixins/FluidBlock_renewableBlackstoneMixin.java +++ b/src/main/java/carpet/mixins/FluidBlock_renewableBlackstoneMixin.java @@ -33,7 +33,7 @@ public abstract class FluidBlock_renewableBlackstoneMixin for(Direction direction : Direction.values()) { if (direction != Direction.DOWN) { - BlockPos blockPos = pos.offset(direction); + BlockPos blockPos = pos.method_35851(direction); // offset if (world.getBlockState(blockPos).isOf(Blocks.BLUE_ICE)) { world.setBlockState(pos, Blocks.BLACKSTONE.getDefaultState()); playExtinguishSound(world, pos); diff --git a/src/main/java/carpet/mixins/HopperBlockEntityMixin.java b/src/main/java/carpet/mixins/HopperBlockEntityMixin.java index 15840d29..10225ef9 100644 --- a/src/main/java/carpet/mixins/HopperBlockEntityMixin.java +++ b/src/main/java/carpet/mixins/HopperBlockEntityMixin.java @@ -36,7 +36,7 @@ public abstract class HopperBlockEntityMixin extends LootableContainerBlockEntit if (CarpetSettings.hopperCounters) { DyeColor wool_color = WoolTool.getWoolColorAtPosition( world, - blockPos.offset(blockState.get(HopperBlock.FACING))); + blockPos.method_35851(blockState.get(HopperBlock.FACING))); // offset if (wool_color != null) { for (int i = 0; i < inventory.size(); ++i) diff --git a/src/main/java/carpet/mixins/NoiseChunkGenerator_husksSpawnMixin.java b/src/main/java/carpet/mixins/NoiseChunkGenerator_husksSpawnMixin.java index d547b313..a855596d 100644 --- a/src/main/java/carpet/mixins/NoiseChunkGenerator_husksSpawnMixin.java +++ b/src/main/java/carpet/mixins/NoiseChunkGenerator_husksSpawnMixin.java @@ -1,6 +1,7 @@ package carpet.mixins; import carpet.CarpetSettings; +import net.minecraft.class_6012; import net.minecraft.entity.SpawnGroup; import net.minecraft.util.math.BlockPos; import net.minecraft.world.biome.Biome; @@ -29,7 +30,7 @@ public abstract class NoiseChunkGenerator_husksSpawnMixin extends ChunkGenerator } @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/mixins/PistonHandler_customStickyMixin.java b/src/main/java/carpet/mixins/PistonHandler_customStickyMixin.java index 7b4a47f2..9a026549 100644 --- a/src/main/java/carpet/mixins/PistonHandler_customStickyMixin.java +++ b/src/main/java/carpet/mixins/PistonHandler_customStickyMixin.java @@ -196,7 +196,7 @@ public abstract class PistonHandler_customStickyMixin // stickyDirection = blockState_1.get(FacingBlock.FACING); //} - return stickyDirection == null || this.tryMove(blockPos_1.offset(stickyDirection), stickyDirection); + return stickyDirection == null || this.tryMove(blockPos_1.method_35851(stickyDirection), stickyDirection); //offset } diff --git a/src/main/java/carpet/mixins/StructureFeatureMixin.java b/src/main/java/carpet/mixins/StructureFeatureMixin.java index 62a8d2f0..d62055a9 100644 --- a/src/main/java/carpet/mixins/StructureFeatureMixin.java +++ b/src/main/java/carpet/mixins/StructureFeatureMixin.java @@ -50,13 +50,13 @@ public abstract class StructureFeatureMixin implements } world.getChunk(j, k).addStructureReference((StructureFeature) (Object)this, chId); - BlockBox box = structurestart.getBoundingBox(); + BlockBox box = structurestart.setBoundingBoxFromChildren(); // getBB if (!wireOnly) { structurestart.generateStructure(world, world.getStructureAccessor(), generator, rand,box, new ChunkPos(j, k)); } //structurestart.notifyPostProcessAt(new ChunkPos(j, k)); - int i = Math.max(box.getBlockCountX(),box.getBlockCountZ())/16+1; //size + int i = Math.max(box.getBlockCountY(),box.getBlockCountX())/16+1; // X Z //int i = getRadius(); for (int k1 = j - i; k1 <= j + i; ++k1) @@ -105,7 +105,7 @@ public abstract class StructureFeatureMixin implements if (biome == null) biome_1 = generator.getBiomeSource().getBiomeForNoiseGen((chunkpos.getStartX() + 9) >> 2, 0, (chunkpos.getStartZ() + 9) >> 2 ); - StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos, BlockBox.empty(),0,worldIn.getSeed()); + StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos,0,worldIn.getSeed()); if (config == null) config = new DefaultFeatureConfig(); structurestart1.init(worldIn.getRegistryManager(), generator, worldIn.getStructureManager() , chunkpos, biome_1, config, ichunk); diff --git a/src/main/java/carpet/script/api/BlockIterators.java b/src/main/java/carpet/script/api/BlockIterators.java index 03582021..a16b733e 100644 --- a/src/main/java/carpet/script/api/BlockIterators.java +++ b/src/main/java/carpet/script/api/BlockIterators.java @@ -216,10 +216,10 @@ public class BlockIterators { List neighbours = new ArrayList<>(); neighbours.add(new BlockValue(null, world, center.up())); neighbours.add(new BlockValue(null, world, center.down())); - neighbours.add(new BlockValue(null, world, center.north())); - neighbours.add(new BlockValue(null, world, center.south())); - neighbours.add(new BlockValue(null, world, center.east())); - neighbours.add(new BlockValue(null, world, center.west())); + neighbours.add(new BlockValue(null, world, center.method_35861())); // north + neighbours.add(new BlockValue(null, world, center.method_35859())); // sourh + neighbours.add(new BlockValue(null, world, center.method_35855())); // east + neighbours.add(new BlockValue(null, world, center.method_35857())); // west Value retval = ListValue.wrap(neighbours); return (c_, t_) -> retval; }); diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index a8f050d7..78affeb0 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -1304,10 +1304,10 @@ public class WorldAccess { StructureStart start = entry.getValue(); if (start == StructureStart.DEFAULT) continue; - BlockBox box = start.getBoundingBox(); + BlockBox box = start.setBoundingBoxFromChildren(); structureList.put( new StringValue(NBTSerializableValue.nameFromRegistryId(Registry.STRUCTURE_FEATURE.getId(entry.getKey()))), - ListValue.of(ListValue.fromTriple(box.minX, box.minY, box.minZ), ListValue.fromTriple(box.maxX, box.maxY, box.maxZ)) + ListValue.of(ListValue.fromTriple(box.method_35420(), box.method_35415(), box.method_35416()), ListValue.fromTriple(box.method_35417(), box.method_35418(), box.method_35419())) ); } Value ret = MapValue.wrap(structureList); @@ -1356,10 +1356,10 @@ public class WorldAccess { } StructureStart start = structures.get(structure); ChunkPos structureChunkPos = start.getPos(); // new ChunkPos(start.getChunkX(), start.getChunkZ()); - BlockBox box = start.getBoundingBox(); - for (int chx = box.minX / 16; chx <= box.maxX / 16; chx++) + BlockBox box = start.setBoundingBoxFromChildren(); + for (int chx = box.method_35420() / 16; chx <= box.method_35417() / 16; chx++) // minx maxx { - for (int chz = box.minZ / 16; chz <= box.maxZ / 16; chz++) + for (int chz = box.method_35416() / 16; chz <= box.method_35419() / 16; chz++) //minZ maxZ { ChunkPos chpos = new ChunkPos(chx, chz); // getting a chunk will convert it to full, allowing to modify references diff --git a/src/main/java/carpet/script/value/NBTSerializableValue.java b/src/main/java/carpet/script/value/NBTSerializableValue.java index e4e51334..88ffe668 100644 --- a/src/main/java/carpet/script/value/NBTSerializableValue.java +++ b/src/main/java/carpet/script/value/NBTSerializableValue.java @@ -15,12 +15,14 @@ import net.minecraft.block.ChestBlock; import net.minecraft.block.InventoryProvider; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.ChestBlockEntity; +import net.minecraft.class_6067; import net.minecraft.command.argument.ItemStackArgument; import net.minecraft.command.argument.ItemStringReader; import net.minecraft.command.argument.NbtPathArgumentType; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.mob.MobEntity; +import net.minecraft.entity.passive.MerchantEntity; import net.minecraft.entity.passive.VillagerEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.Inventory; @@ -224,7 +226,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa Entity e = ((EntityValue) v1).getEntity(); if (e instanceof PlayerEntity) inv = ((PlayerEntity) e).getInventory(); else if (e instanceof Inventory) inv = (Inventory) e; - else if (e instanceof VillagerEntity) inv = ((VillagerEntity) e).getInventory(); + else if (e instanceof class_6067) inv = ((class_6067) e).method_35199(); // getInentory // now covers pillagers else if (e instanceof InventoryBearerInterface) inv = ((InventoryBearerInterface)e).getCMInventory(); else if (e instanceof LivingEntity) return new InventoryLocator(e, e.getBlockPos(), new EquipmentInventory((MobEntity) e), offset+1); if (inv == null) diff --git a/src/main/java/carpet/script/value/ValueConversions.java b/src/main/java/carpet/script/value/ValueConversions.java index 51d431af..38199c8c 100644 --- a/src/main/java/carpet/script/value/ValueConversions.java +++ b/src/main/java/carpet/script/value/ValueConversions.java @@ -305,24 +305,24 @@ public class ValueConversions public static Value of(StructureStart structure) { if (structure == null || structure == StructureStart.DEFAULT) return Value.NULL; - BlockBox boundingBox = structure.getBoundingBox(); - if (boundingBox.maxX < boundingBox.minX || boundingBox.maxY < boundingBox.minY || boundingBox.maxZ < boundingBox.minZ) return Value.NULL; + BlockBox boundingBox = structure.setBoundingBoxFromChildren(); + if (boundingBox.method_35417() < boundingBox.method_35420() || boundingBox.method_35418() < boundingBox.method_35415() || boundingBox.method_35419() < boundingBox.method_35416()) return Value.NULL; Map ret = new HashMap<>(); ret.put(new StringValue("box"), ListValue.of( - ListValue.fromTriple(boundingBox.minX, boundingBox.minY, boundingBox.minZ), - ListValue.fromTriple(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ) + ListValue.fromTriple(boundingBox.method_35420(), boundingBox.method_35415(), boundingBox.method_35416()), + ListValue.fromTriple(boundingBox.method_35417(), boundingBox.method_35418(), boundingBox.method_35419()) )); List pieces = new ArrayList<>(); for (StructurePiece piece : structure.getChildren()) { BlockBox box = piece.getBoundingBox(); - if (box.maxX >= box.minX && box.maxY >= box.minY && box.maxZ >= box.minZ) + if (box.method_35417() >= box.method_35420() && box.method_35418() >= box.method_35415() && box.method_35419() >= box.method_35416()) { pieces.add(ListValue.of( new StringValue(NBTSerializableValue.nameFromRegistryId(Registry.STRUCTURE_PIECE.getId(piece.getType()))), (piece.getFacing() == null) ? Value.NULL : new StringValue(piece.getFacing().getName()), - ListValue.fromTriple(box.minX, box.minY, box.minZ), - ListValue.fromTriple(box.maxX, box.maxY, box.maxZ) + ListValue.fromTriple(box.method_35420(), box.method_35415(), box.method_35416()), + ListValue.fromTriple(box.method_35417(), box.method_35418(), box.method_35419()) )); } } diff --git a/src/main/java/carpet/utils/PerimeterDiagnostics.java b/src/main/java/carpet/utils/PerimeterDiagnostics.java index 8fab4bd8..aef09385 100644 --- a/src/main/java/carpet/utils/PerimeterDiagnostics.java +++ b/src/main/java/carpet/utils/PerimeterDiagnostics.java @@ -159,10 +159,10 @@ public class PerimeterDiagnostics private boolean check_entity_spawn(BlockPos pos) { - if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getBiome(pos), worldServer.getStructureAccessor(), ctype, pos).contains(sle)) + if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getBiome(pos), worldServer.getStructureAccessor(), ctype, pos).method_34994().contains(sle)) { sle = null; - for (SpawnSettings.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).method_34994()) { if (el.getType() == sle.type) { @@ -170,7 +170,7 @@ public class PerimeterDiagnostics break; } } - if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getBiome(pos), worldServer.getStructureAccessor(), ctype, pos).contains(sle)) + if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getBiome(pos), worldServer.getStructureAccessor(), ctype, pos).method_34994().contains(sle)) { return false; } diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java index 1c17dd40..63b8831b 100644 --- a/src/main/java/carpet/utils/SpawnReporter.java +++ b/src/main/java/carpet/utils/SpawnReporter.java @@ -420,7 +420,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.getStructureAt(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().method_34994() : chunkGenerator.getEntitySpawnList(biome != null ? biome : serverWorld.getBiome(blockPos), structureAccessor, spawnGroup, blockPos).method_34994(); } public static List report(BlockPos pos, ServerWorld worldIn)