This commit is contained in:
gnembon committed 2020-11-06 00:06:53 -04:00
1 parent 79dc85274d
commit 2cdea92da7
55 files changed
+453 -287

No files matched your search

@@ -346,7 +346,7 @@ public class EntityValue extends Value
private static final Map<String, BiFunction<Entity, Value, Value>> featureAccessors = new HashMap<String, BiFunction<Entity, Value, Value>>() {{
//put("test", (e, a) -> a == null ? Value.NULL : new StringValue(a.getString()));
put("removed", (entity, arg) -> new NumericValue(entity.removed));
put("removed", (entity, arg) -> new NumericValue(entity.isRemoved()));
put("uuid",(e, a) -> new StringValue(e.getUuidAsString()));
put("id",(e, a) -> new NumericValue(e.getEntityId()));
put("pos", (e, a) -> ListValue.of(new NumericValue(e.getX()), new NumericValue(e.getY()), new NumericValue(e.getZ())));
@@ -620,7 +620,7 @@ public class EntityValue extends Value
put("selected_slot", (e, a) -> {
if (e instanceof PlayerEntity)
return new NumericValue(((PlayerEntity) e).inventory.selectedSlot);
return new NumericValue(((PlayerEntity) e).method_31548().selectedSlot); //getInventory
return Value.NULL;
});
@@ -796,7 +796,7 @@ public class EntityValue extends Value
}
private static final Map<String, BiConsumer<Entity, Value>> featureModifiers = new HashMap<String, BiConsumer<Entity, Value>>() {{
put("remove", (entity, value) -> entity.remove());
put("remove", (entity, value) -> entity.discard()); // using discard here - will see other options if valid
put("age", (e, v) -> e.age = Math.abs((int)NumericValue.asNumber(v).getLong()) );
put("health", (e, v) -> {
float health = (float) NumericValue.asNumber(v).getDouble();
@@ -145,7 +145,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
Block block = blockState.getBlock();
if (block instanceof InventoryProvider) {
inventory = ((InventoryProvider)block).getInventory(blockState, world, blockPos);
} else if (block.hasBlockEntity()) {
} else if (blockState.method_31709()) { //hasBlockEntity()
BlockEntity blockEntity = BlockValue.getBlockEntity(world, blockPos);
if (blockEntity instanceof Inventory) {
inventory = (Inventory)blockEntity;
@@ -181,7 +181,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
if (v1 instanceof EntityValue)
{
Entity e = ((EntityValue) v1).getEntity();
if (e instanceof PlayerEntity) inv = ((PlayerEntity) e).inventory;
if (e instanceof PlayerEntity) inv = ((PlayerEntity) e).method_31548();
else if (e instanceof Inventory) inv = (Inventory) e;
else if (e instanceof VillagerEntity) inv = ((VillagerEntity) e).getInventory();
@@ -231,7 +231,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
return new InventoryLocator(
player,
player.getBlockPos(),
isEnder ? player.getEnderChestInventory() : player.inventory,
isEnder ? player.getEnderChestInventory() : player.method_31548(),
offset + 1,
isEnder
);