Merge pull request #43 from gnembon/inventory

touchups and docs
This commit is contained in:
gnembon authored and GitHub committed 2019-07-02 09:09:25 -03:00
commit 558f1bc344
2 files changed
+8 -2

No files matched your search

+2 -2
View File
@@ -1846,7 +1846,7 @@ public class Expression implements Cloneable
addBinaryFunction("get", (v1, v2) -> addBinaryFunction("get", (v1, v2) ->
{ {
if (v1 instanceof LazyListValue || !(v1 instanceof ListValue)) if (v1 instanceof LazyListValue || !(v1 instanceof ListValue))
throw new InternalExpressionException("First argument of element should be a list"); throw new InternalExpressionException("First argument of get should be a list");
List<Value> items = ((ListValue)v1).getItems(); List<Value> items = ((ListValue)v1).getItems();
long index = NumericValue.asNumber(v2).getLong(); long index = NumericValue.asNumber(v2).getLong();
int numitems = items.size(); int numitems = items.size();
@@ -1860,7 +1860,7 @@ public class Expression implements Cloneable
addBinaryFunction("element", (v1, v2) -> addBinaryFunction("element", (v1, v2) ->
{ {
if (v1 instanceof LazyListValue || !(v1 instanceof ListValue)) if (v1 instanceof LazyListValue || !(v1 instanceof ListValue))
throw new InternalExpressionException("First argument of element should be a list"); throw new InternalExpressionException("First argument of get should be a list");
List<Value> items = ((ListValue)v1).getItems(); List<Value> items = ((ListValue)v1).getItems();
long index = NumericValue.asNumber(v2).getLong(); long index = NumericValue.asNumber(v2).getLong();
int numitems = items.size(); int numitems = items.size();
@@ -349,14 +349,17 @@ public class BlockValue extends Value
this.sneakPlace = sneakPlace; this.sneakPlace = sneakPlace;
} }
@Override
public BlockPos getBlockPos() { public BlockPos getBlockPos() {
return this.hit.getBlockPos(); return this.hit.getBlockPos();
} }
@Override
public Direction getPlayerLookDirection() { public Direction getPlayerLookDirection() {
return facing.getOpposite(); return facing.getOpposite();
} }
@Override
public Direction[] getPlacementDirections() { public Direction[] getPlacementDirections() {
switch(this.facing) { switch(this.facing) {
case DOWN: case DOWN:
@@ -375,14 +378,17 @@ public class BlockValue extends Value
} }
} }
@Override
public Direction getPlayerFacing() { public Direction getPlayerFacing() {
return this.facing.getAxis() == Direction.Axis.Y ? Direction.NORTH : this.facing; return this.facing.getAxis() == Direction.Axis.Y ? Direction.NORTH : this.facing;
} }
@Override
public boolean isPlayerSneaking() { public boolean isPlayerSneaking() {
return sneakPlace; return sneakPlace;
} }
@Override
public float getPlayerYaw() { public float getPlayerYaw() {
return (float)(this.facing.getHorizontal() * 90); return (float)(this.facing.getHorizontal() * 90);
} }