item returned values should always be tripples

This commit is contained in:
gnembon committed 2019-09-03 15:18:02 -03:00
1 parent 06b3f7c532
commit 444c3fdde9
2 files changed
+3 -11

No files matched your search

@@ -292,11 +292,7 @@ public class CarpetEventServer
ItemStack itemstack = player.getStackInHand(enumhand);
return Arrays.asList(
((c, t) -> new EntityValue(player)),
((c, t) -> ListValue.of(
new StringValue(Registry.ITEM.getId(itemstack.getItem()).getPath()),
new NumericValue(itemstack.getCount()),
new StringValue(itemstack.toTag(new CompoundTag()).toString())
)),
((c, t) -> ListValue.fromItemStack(itemstack)),
((c, t) -> new StringValue(enumhand == Hand.MAIN_HAND ? "mainhand" : "offhand"))
);
}, player::getCommandSource);
@@ -321,11 +317,7 @@ public class CarpetEventServer
Vec3d vec3d = hitRes.getPos().subtract(blockpos.getX(), blockpos.getY(), blockpos.getZ());
return Arrays.asList(
((c, t) -> new EntityValue(player)),
((c, t) -> ListValue.of(
new StringValue(Registry.ITEM.getId(itemstack.getItem()).getPath()),
new NumericValue(itemstack.getCount()),
new StringValue(itemstack.toTag(new CompoundTag()).toString())
)),
((c, t) -> ListValue.fromItemStack(itemstack)),
((c, t) -> new StringValue(enumhand == Hand.MAIN_HAND ? "mainhand" : "offhand")),
((c, t) -> new BlockValue(null, player.world, blockpos)),
((c, t) -> new StringValue(enumfacing.getName())),
@@ -215,7 +215,7 @@ public class EntityValue extends Value
put("width", (e, a) -> new NumericValue(e.getDimensions(EntityPose.STANDING).width));
put("eye_height", (e, a) -> new NumericValue(e.getEyeHeight(EntityPose.STANDING)));
put("age", (e, a) -> new NumericValue(e.age));
put("item", (e, a) -> (e instanceof ItemEntity)?new StringValue(((ItemEntity) e).getStack().getName().getString()):Value.NULL);
put("item", (e, a) -> (e instanceof ItemEntity)?ListValue.fromItemStack(((ItemEntity) e).getStack()):Value.NULL);
put("count", (e, a) -> (e instanceof ItemEntity)?new NumericValue(((ItemEntity) e).getStack().getCount()):Value.NULL);
put("pickup_delay", (e, a) -> (e instanceof ItemEntity)?new NumericValue(((ItemEntityInterface) e).getPickupDelay()):Value.NULL);
// ItemEntity -> despawn timer via ssGetAge