This commit is contained in:
gnembon committed 2021-03-31 22:02:09 -03:00
1 parent b49b99aea6
commit 0320de5d6d
23 files changed
+78 -89

No files matched your search

+2 -2
View File
@@ -4,8 +4,8 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
# or better: https://modmuss50.me/fabric.html # or better: https://modmuss50.me/fabric.html
minecraft_version=21w11a minecraft_version=21w13a
yarn_mappings=21w11a+build.46 yarn_mappings=21w13a+build.2
loader_version=0.11.3 loader_version=0.11.3
fabric_version=0.32.5+1.17 fabric_version=0.32.5+1.17
-3
View File
@@ -184,9 +184,6 @@ public class CarpetSettings
@Rule( desc = "Players absorb XP instantly, without delay", category = CREATIVE ) @Rule( desc = "Players absorb XP instantly, without delay", category = CREATIVE )
public static boolean xpNoCooldown = false; 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 ) @Rule( desc = "XP orbs combine with other into bigger orbs", category = FEATURE )
public static boolean combineXPOrbs = false; public static boolean combineXPOrbs = false;
@@ -470,7 +470,7 @@ public class ScriptCommand
CarpetScriptHost host = getHost(context); CarpetScriptHost host = getHost(context);
BlockBox area = BlockBox.create(a, b); BlockBox area = BlockBox.create(a, b);
CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin); 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) if (int_1 > CarpetSettings.fillLimit)
{ {
Messenger.m(source, "r too many blocks to evaluate: " + int_1); Messenger.m(source, "r too many blocks to evaluate: " + int_1);
@@ -480,11 +480,11 @@ public class ScriptCommand
CarpetSettings.impendingFillSkipUpdates = !CarpetSettings.fillUpdates; CarpetSettings.impendingFillSkipUpdates = !CarpetSettings.fillUpdates;
try 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 try
{ {
@@ -519,29 +519,29 @@ public class ScriptCommand
CarpetScriptHost host = getHost(context); CarpetScriptHost host = getHost(context);
BlockBox area = BlockBox.create(a, b); BlockBox area = BlockBox.create(a, b);
CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin); 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) if (int_1 > CarpetSettings.fillLimit)
{ {
Messenger.m(source, "r too many blocks to evaluate: "+ int_1); Messenger.m(source, "r too many blocks to evaluate: "+ int_1);
return 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(); BlockPos.Mutable mbpos = origin.mutableCopy();
ServerWorld world = source.getWorld(); 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 try
{ {
if (cexpr.fillAndScanCommand(host, x, y, z)) 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) catch (CarpetExpressionException e)
@@ -555,12 +555,12 @@ public class ScriptCommand
} }
} }
} }
final int maxx = area.getBlockCountX()-1; final int maxx = area.getBlockCountY()-1; //x
final int maxy = area.getBlockCountY()-1; final int maxy = area.method_35414()-1; //y
final int maxz = area.getBlockCountZ()-1; final int maxz = area.getBlockCountX()-1; //z
if ("outline".equalsIgnoreCase(mode)) 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 x = 0; x <= maxx; x++)
{ {
for (int y = 0; y <= maxy; y++) for (int y = 0; y <= maxy; y++)
@@ -596,7 +596,7 @@ public class ScriptCommand
{ {
if (volume[x][y][z]) 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( if (replacement == null || replacement.test(
new CachedBlockPosition( world, mbpos, true))) new CachedBlockPosition( world, mbpos, true)))
{ {
@@ -624,7 +624,7 @@ public class ScriptCommand
{ {
if (volume[x][y][z]) 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(); Block blokc = world.getBlockState(mbpos).getBlock();
world.updateNeighbors(mbpos, blokc); 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; return 1;
} }
} }
@@ -1,8 +1,9 @@
package carpet.fakes; package carpet.fakes;
import net.minecraft.class_6067;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
public interface InventoryBearerInterface public interface InventoryBearerInterface
{ {
Inventory getCMInventory(); Inventory getCMInventory(); // can be removed in 1.17 due to class_6067
} }
@@ -226,7 +226,7 @@ public class BlockRotator
{ {
Direction sourceFace = source.getBlockState().get(DispenserBlock.FACING); Direction sourceFace = source.getBlockState().get(DispenserBlock.FACING);
World world = source.getWorld(); World world = source.getWorld();
BlockPos blockpos = source.getBlockPos().offset(sourceFace); BlockPos blockpos = source.getBlockPos().method_35851(sourceFace); // offset
BlockState iblockstate = world.getBlockState(blockpos); BlockState iblockstate = world.getBlockState(blockpos);
Block block = iblockstate.getBlock(); Block block = iblockstate.getBlock();
@@ -162,7 +162,7 @@ public class FeatureGenerator
{ {
if (!computeBox) return StructureStart.DEFAULT; if (!computeBox) return StructureStart.DEFAULT;
StructureManager manager = world.getStructureManager(); StructureManager manager = world.getStructureManager();
StructureStart<T> structureStart3 = structure.getStructureStartFactory().create((StructureFeature<T>) configuredFeature.feature, chunkPos, BlockBox.empty(), 0, seed); StructureStart<T> structureStart3 = structure.getStructureStartFactory().create((StructureFeature<T>) configuredFeature.feature, chunkPos, 0, seed);
structureStart3.init(world.getRegistryManager(), generator, manager, chunkPos, biome, (T) configuredFeature.config, world); structureStart3.init(world.getRegistryManager(), generator, manager, chunkPos, biome, (T) configuredFeature.config, world);
if (!structureStart3.hasChildren()) return null; if (!structureStart3.hasChildren()) return null;
return structureStart3; return structureStart3;
@@ -4,7 +4,9 @@ import carpet.CarpetSettings;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
import net.minecraft.class_6012;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.world.MobSpawnerLogic;
import net.minecraft.world.biome.SpawnSettings; import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.gen.feature.BastionRemnantFeature; import net.minecraft.world.gen.feature.BastionRemnantFeature;
@@ -18,7 +20,7 @@ import java.util.List;
@Mixin(BastionRemnantFeature.class) @Mixin(BastionRemnantFeature.class)
public abstract class BastionRemnantFeatureMixin extends JigsawFeature public abstract class BastionRemnantFeatureMixin extends JigsawFeature
{ {
private static final List<SpawnSettings.SpawnEntry> spawnList = Lists.newArrayList( private static final class_6012<SpawnSettings.SpawnEntry> spawnList = class_6012.method_34989(
new SpawnSettings.SpawnEntry(EntityType.PIGLIN_BRUTE, 5, 1, 2), new SpawnSettings.SpawnEntry(EntityType.PIGLIN_BRUTE, 5, 1, 2),
new SpawnSettings.SpawnEntry(EntityType.PIGLIN, 10, 2, 4), new SpawnSettings.SpawnEntry(EntityType.PIGLIN, 10, 2, 4),
new SpawnSettings.SpawnEntry(EntityType.HOGLIN, 2, 1, 2) new SpawnSettings.SpawnEntry(EntityType.HOGLIN, 2, 1, 2)
@@ -30,10 +32,10 @@ public abstract class BastionRemnantFeatureMixin extends JigsawFeature
} }
@Override @Override
public List<SpawnSettings.SpawnEntry> getMonsterSpawns() public class_6012<SpawnSettings.SpawnEntry> getMonsterSpawns()
{ {
if (CarpetSettings.piglinsSpawningInBastions) if (CarpetSettings.piglinsSpawningInBastions)
return spawnList; return spawnList;
return Collections.emptyList(); return SpawnSettings.field_30982; // empty spawn list
} }
} }
@@ -3,6 +3,7 @@ package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
import net.minecraft.class_6012;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.SpawnSettings; import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.gen.feature.DefaultFeatureConfig;
@@ -16,11 +17,11 @@ import java.util.List;
@Mixin(DesertPyramidFeature.class) @Mixin(DesertPyramidFeature.class)
public abstract class DesertPyramidFeatureMixin extends StructureFeature<DefaultFeatureConfig> public abstract class DesertPyramidFeatureMixin extends StructureFeature<DefaultFeatureConfig>
{ {
private static final List<SpawnSettings.SpawnEntry> MONSTER_SPAWNS; private static final class_6012<SpawnSettings.SpawnEntry> MONSTER_SPAWNS;
static 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<DefaultFeatureConfig> codec) public DesertPyramidFeatureMixin(Codec<DefaultFeatureConfig> codec)
@@ -30,13 +31,13 @@ public abstract class DesertPyramidFeatureMixin extends StructureFeature<Default
@Override @Override
public List<SpawnSettings.SpawnEntry> getMonsterSpawns() public class_6012<SpawnSettings.SpawnEntry> getMonsterSpawns()
{ {
if (CarpetSettings.huskSpawningInTemples) if (CarpetSettings.huskSpawningInTemples)
{ {
return MONSTER_SPAWNS; return MONSTER_SPAWNS;
} }
return Collections.emptyList(); return SpawnSettings.field_30982; // empty spawn list
} }
} }
@@ -3,6 +3,7 @@ package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
import net.minecraft.class_6012;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.SpawnSettings; import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.gen.feature.DefaultFeatureConfig;
@@ -16,7 +17,7 @@ import java.util.List;
@Mixin(EndCityFeature.class) @Mixin(EndCityFeature.class)
public abstract class EndCityFeatureMixin extends StructureFeature<DefaultFeatureConfig> public abstract class EndCityFeatureMixin extends StructureFeature<DefaultFeatureConfig>
{ {
private static final List<SpawnSettings.SpawnEntry> spawnList = Lists.newArrayList(new SpawnSettings.SpawnEntry(EntityType.SHULKER, 10, 4, 4)); private static final class_6012<SpawnSettings.SpawnEntry> spawnList = class_6012.method_34989(new SpawnSettings.SpawnEntry(EntityType.SHULKER, 10, 4, 4));
public EndCityFeatureMixin(Codec<DefaultFeatureConfig> codec) public EndCityFeatureMixin(Codec<DefaultFeatureConfig> codec)
{ {
@@ -24,10 +25,10 @@ public abstract class EndCityFeatureMixin extends StructureFeature<DefaultFeatur
} }
@Override @Override
public List<SpawnSettings.SpawnEntry> getMonsterSpawns() public class_6012<SpawnSettings.SpawnEntry> getMonsterSpawns()
{ {
if (CarpetSettings.shulkerSpawningInEndCities) if (CarpetSettings.shulkerSpawningInEndCities)
return spawnList; return spawnList;
return Collections.emptyList(); return SpawnSettings.field_30982; // empty spawn list
} }
} }
@@ -7,6 +7,7 @@ import net.minecraft.entity.ai.pathing.Path;
import net.minecraft.entity.mob.MobEntity; import net.minecraft.entity.mob.MobEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
@@ -22,18 +23,18 @@ public abstract class EntityNavigation_pathfindingMixin
@Shadow @Final protected MobEntity entity; @Shadow @Final protected MobEntity entity;
@Shadow /*@Nullable*/ protected abstract Path findPathToAny(Set<BlockPos> set_1, int int_1, boolean boolean_1, int int_2); @Shadow protected @Nullable abstract Path method_35142(Set<BlockPos> set, int i, boolean bl, int j);
@Redirect(method = "findPathTo(Lnet/minecraft/util/math/BlockPos;I)Lnet/minecraft/entity/ai/pathing/Path;", at = @At( @Redirect(method = "findPathTo(Lnet/minecraft/util/math/BlockPos;I)Lnet/minecraft/entity/ai/pathing/Path;", at = @At(
value = "INVOKE", 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<BlockPos> set_1, int int_1, boolean boolean_1, int int_2) private Path pathToBlock(EntityNavigation entityNavigation, Set<BlockPos> set_1, int int_1, boolean boolean_1, int int_2)
{ {
if (!LoggerRegistry.__pathfinding) 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(); 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(); long finish = System.nanoTime();
float duration = (1.0F*((finish - start)/1000))/1000; float duration = (1.0F*((finish - start)/1000))/1000;
set_1.forEach(b -> PathfindingVisualizer.slowPath(entity, Vec3d.ofBottomCenter(b), duration, path != null)); // ground centered position 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( @Redirect(method = "findPathTo(Lnet/minecraft/entity/Entity;I)Lnet/minecraft/entity/ai/pathing/Path;", at = @At(
value = "INVOKE", 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<BlockPos> set_1, int int_1, boolean boolean_1, int int_2) private Path pathToEntity(EntityNavigation entityNavigation, Set<BlockPos> set_1, int int_1, boolean boolean_1, int int_2)
{ {
if (!LoggerRegistry.__pathfinding) 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(); 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(); long finish = System.nanoTime();
float duration = (1.0F*((finish - start)/1000))/1000; float duration = (1.0F*((finish - start)/1000))/1000;
set_1.forEach(b -> PathfindingVisualizer.slowPath(entity, Vec3d.ofBottomCenter(b), duration, path != null)); set_1.forEach(b -> PathfindingVisualizer.slowPath(entity, Vec3d.ofBottomCenter(b), duration, path != null));
@@ -84,22 +84,4 @@ public abstract class ExperienceOrbEntityMixin implements ExperienceOrbInterface
playerEntity.addExperience(experience); 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<EquipmentSlot, ItemStack> 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();
}
}
} }
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.class_6012;
import net.minecraft.entity.SpawnGroup; import net.minecraft.entity.SpawnGroup;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
@@ -25,7 +26,7 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator
} }
@Override @Override
public List<SpawnSettings.SpawnEntry> getEntitySpawnList(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos) public class_6012<SpawnSettings.SpawnEntry> getEntitySpawnList(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos)
{ {
if (CarpetSettings.flatWorldStructureSpawning) if (CarpetSettings.flatWorldStructureSpawning)
{ {
@@ -33,7 +33,7 @@ public abstract class FluidBlock_renewableBlackstoneMixin
for(Direction direction : Direction.values()) for(Direction direction : Direction.values())
{ {
if (direction != Direction.DOWN) { if (direction != Direction.DOWN) {
BlockPos blockPos = pos.offset(direction); BlockPos blockPos = pos.method_35851(direction); // offset
if (world.getBlockState(blockPos).isOf(Blocks.BLUE_ICE)) { if (world.getBlockState(blockPos).isOf(Blocks.BLUE_ICE)) {
world.setBlockState(pos, Blocks.BLACKSTONE.getDefaultState()); world.setBlockState(pos, Blocks.BLACKSTONE.getDefaultState());
playExtinguishSound(world, pos); playExtinguishSound(world, pos);
@@ -36,7 +36,7 @@ public abstract class HopperBlockEntityMixin extends LootableContainerBlockEntit
if (CarpetSettings.hopperCounters) { if (CarpetSettings.hopperCounters) {
DyeColor wool_color = WoolTool.getWoolColorAtPosition( DyeColor wool_color = WoolTool.getWoolColorAtPosition(
world, world,
blockPos.offset(blockState.get(HopperBlock.FACING))); blockPos.method_35851(blockState.get(HopperBlock.FACING))); // offset
if (wool_color != null) if (wool_color != null)
{ {
for (int i = 0; i < inventory.size(); ++i) for (int i = 0; i < inventory.size(); ++i)
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.class_6012;
import net.minecraft.entity.SpawnGroup; import net.minecraft.entity.SpawnGroup;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.Biome; 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) @Inject(method = "getEntitySpawnList", at = @At("HEAD"), cancellable = true)
private void isInsidePyramid(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos, CallbackInfoReturnable<List<SpawnSettings.SpawnEntry>> cir) private void isInsidePyramid(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos, CallbackInfoReturnable<class_6012<SpawnSettings.SpawnEntry>> cir)
{ {
if (CarpetSettings.huskSpawningInTemples && group == SpawnGroup.MONSTER) if (CarpetSettings.huskSpawningInTemples && group == SpawnGroup.MONSTER)
{ {
@@ -196,7 +196,7 @@ public abstract class PistonHandler_customStickyMixin
// stickyDirection = blockState_1.get(FacingBlock.FACING); // 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
} }
@@ -50,13 +50,13 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
} }
world.getChunk(j, k).addStructureReference((StructureFeature) (Object)this, chId); world.getChunk(j, k).addStructureReference((StructureFeature) (Object)this, chId);
BlockBox box = structurestart.getBoundingBox(); BlockBox box = structurestart.setBoundingBoxFromChildren(); // getBB
if (!wireOnly) if (!wireOnly)
{ {
structurestart.generateStructure(world, world.getStructureAccessor(), generator, rand,box, new ChunkPos(j, k)); structurestart.generateStructure(world, world.getStructureAccessor(), generator, rand,box, new ChunkPos(j, k));
} }
//structurestart.notifyPostProcessAt(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(); //int i = getRadius();
for (int k1 = j - i; k1 <= j + i; ++k1) for (int k1 = j - i; k1 <= j + i; ++k1)
@@ -105,7 +105,7 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
if (biome == null) if (biome == null)
biome_1 = generator.getBiomeSource().getBiomeForNoiseGen((chunkpos.getStartX() + 9) >> 2, 0, (chunkpos.getStartZ() + 9) >> 2 ); 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) if (config == null)
config = new DefaultFeatureConfig(); config = new DefaultFeatureConfig();
structurestart1.init(worldIn.getRegistryManager(), generator, worldIn.getStructureManager() , chunkpos, biome_1, config, ichunk); structurestart1.init(worldIn.getRegistryManager(), generator, worldIn.getStructureManager() , chunkpos, biome_1, config, ichunk);
@@ -216,10 +216,10 @@ public class BlockIterators {
List<Value> neighbours = new ArrayList<>(); List<Value> neighbours = new ArrayList<>();
neighbours.add(new BlockValue(null, world, center.up())); neighbours.add(new BlockValue(null, world, center.up()));
neighbours.add(new BlockValue(null, world, center.down())); neighbours.add(new BlockValue(null, world, center.down()));
neighbours.add(new BlockValue(null, world, center.north())); neighbours.add(new BlockValue(null, world, center.method_35861())); // north
neighbours.add(new BlockValue(null, world, center.south())); neighbours.add(new BlockValue(null, world, center.method_35859())); // sourh
neighbours.add(new BlockValue(null, world, center.east())); neighbours.add(new BlockValue(null, world, center.method_35855())); // east
neighbours.add(new BlockValue(null, world, center.west())); neighbours.add(new BlockValue(null, world, center.method_35857())); // west
Value retval = ListValue.wrap(neighbours); Value retval = ListValue.wrap(neighbours);
return (c_, t_) -> retval; return (c_, t_) -> retval;
}); });
@@ -1304,10 +1304,10 @@ public class WorldAccess {
StructureStart<?> start = entry.getValue(); StructureStart<?> start = entry.getValue();
if (start == StructureStart.DEFAULT) if (start == StructureStart.DEFAULT)
continue; continue;
BlockBox box = start.getBoundingBox(); BlockBox box = start.setBoundingBoxFromChildren();
structureList.put( structureList.put(
new StringValue(NBTSerializableValue.nameFromRegistryId(Registry.STRUCTURE_FEATURE.getId(entry.getKey()))), 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); Value ret = MapValue.wrap(structureList);
@@ -1356,10 +1356,10 @@ public class WorldAccess {
} }
StructureStart<?> start = structures.get(structure); StructureStart<?> start = structures.get(structure);
ChunkPos structureChunkPos = start.getPos(); // new ChunkPos(start.getChunkX(), start.getChunkZ()); ChunkPos structureChunkPos = start.getPos(); // new ChunkPos(start.getChunkX(), start.getChunkZ());
BlockBox box = start.getBoundingBox(); BlockBox box = start.setBoundingBoxFromChildren();
for (int chx = box.minX / 16; chx <= box.maxX / 16; chx++) 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); ChunkPos chpos = new ChunkPos(chx, chz);
// getting a chunk will convert it to full, allowing to modify references // getting a chunk will convert it to full, allowing to modify references
@@ -15,12 +15,14 @@ import net.minecraft.block.ChestBlock;
import net.minecraft.block.InventoryProvider; import net.minecraft.block.InventoryProvider;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.ChestBlockEntity; import net.minecraft.block.entity.ChestBlockEntity;
import net.minecraft.class_6067;
import net.minecraft.command.argument.ItemStackArgument; import net.minecraft.command.argument.ItemStackArgument;
import net.minecraft.command.argument.ItemStringReader; import net.minecraft.command.argument.ItemStringReader;
import net.minecraft.command.argument.NbtPathArgumentType; import net.minecraft.command.argument.NbtPathArgumentType;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.mob.MobEntity; import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.passive.MerchantEntity;
import net.minecraft.entity.passive.VillagerEntity; import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
@@ -224,7 +226,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
Entity e = ((EntityValue) v1).getEntity(); Entity e = ((EntityValue) v1).getEntity();
if (e instanceof PlayerEntity) inv = ((PlayerEntity) e).getInventory(); if (e instanceof PlayerEntity) inv = ((PlayerEntity) e).getInventory();
else if (e instanceof Inventory) inv = (Inventory) e; 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 InventoryBearerInterface) inv = ((InventoryBearerInterface)e).getCMInventory();
else if (e instanceof LivingEntity) return new InventoryLocator(e, e.getBlockPos(), new EquipmentInventory((MobEntity) e), offset+1); else if (e instanceof LivingEntity) return new InventoryLocator(e, e.getBlockPos(), new EquipmentInventory((MobEntity) e), offset+1);
if (inv == null) if (inv == null)
@@ -305,24 +305,24 @@ public class ValueConversions
public static Value of(StructureStart<?> structure) public static Value of(StructureStart<?> structure)
{ {
if (structure == null || structure == StructureStart.DEFAULT) return Value.NULL; if (structure == null || structure == StructureStart.DEFAULT) return Value.NULL;
BlockBox boundingBox = structure.getBoundingBox(); BlockBox boundingBox = structure.setBoundingBoxFromChildren();
if (boundingBox.maxX < boundingBox.minX || boundingBox.maxY < boundingBox.minY || boundingBox.maxZ < boundingBox.minZ) return Value.NULL; if (boundingBox.method_35417() < boundingBox.method_35420() || boundingBox.method_35418() < boundingBox.method_35415() || boundingBox.method_35419() < boundingBox.method_35416()) return Value.NULL;
Map<Value, Value> ret = new HashMap<>(); Map<Value, Value> ret = new HashMap<>();
ret.put(new StringValue("box"), ListValue.of( ret.put(new StringValue("box"), ListValue.of(
ListValue.fromTriple(boundingBox.minX, boundingBox.minY, boundingBox.minZ), ListValue.fromTriple(boundingBox.method_35420(), boundingBox.method_35415(), boundingBox.method_35416()),
ListValue.fromTriple(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ) ListValue.fromTriple(boundingBox.method_35417(), boundingBox.method_35418(), boundingBox.method_35419())
)); ));
List<Value> pieces = new ArrayList<>(); List<Value> pieces = new ArrayList<>();
for (StructurePiece piece : structure.getChildren()) for (StructurePiece piece : structure.getChildren())
{ {
BlockBox box = piece.getBoundingBox(); 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( pieces.add(ListValue.of(
new StringValue(NBTSerializableValue.nameFromRegistryId(Registry.STRUCTURE_PIECE.getId(piece.getType()))), new StringValue(NBTSerializableValue.nameFromRegistryId(Registry.STRUCTURE_PIECE.getId(piece.getType()))),
(piece.getFacing() == null) ? Value.NULL : new StringValue(piece.getFacing().getName()), (piece.getFacing() == null) ? Value.NULL : new StringValue(piece.getFacing().getName()),
ListValue.fromTriple(box.minX, box.minY, box.minZ), ListValue.fromTriple(box.method_35420(), box.method_35415(), box.method_35416()),
ListValue.fromTriple(box.maxX, box.maxY, box.maxZ) ListValue.fromTriple(box.method_35417(), box.method_35418(), box.method_35419())
)); ));
} }
} }
@@ -159,10 +159,10 @@ public class PerimeterDiagnostics
private boolean check_entity_spawn(BlockPos pos) 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; 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) if (el.getType() == sle.type)
{ {
@@ -170,7 +170,7 @@ public class PerimeterDiagnostics
break; 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; return false;
} }
@@ -420,7 +420,7 @@ public class SpawnReporter
// yeeted from SpawnHelper - temporary fix // yeeted from SpawnHelper - temporary fix
private static List<SpawnSettings.SpawnEntry> method_29950(ServerWorld serverWorld, StructureAccessor structureAccessor, ChunkGenerator chunkGenerator, SpawnGroup spawnGroup, BlockPos blockPos, /*@Nullable*/ Biome biome) { private static List<SpawnSettings.SpawnEntry> 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<BaseText> report(BlockPos pos, ServerWorld worldIn) public static List<BaseText> report(BlockPos pos, ServerWorld worldIn)