21w13a
This commit is contained in:
1 parent
b49b99aea6
commit
0320de5d6d
23 files changed
+78
-89
No files matched your search
@@ -216,10 +216,10 @@ public class BlockIterators {
|
||||
List<Value> 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;
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<Value, Value> 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<Value> 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())
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user