19w41a first pass

This commit is contained in:
gnembon committed 2019-10-09 19:43:37 -03:00
1 parent 5ebfb7d1c0
commit 7b649f9ccd
28 files changed
+164 -178

No files matched your search

@@ -180,11 +180,11 @@ public class EntityValue extends Value
put("removed", (entity, arg) -> new NumericValue(entity.removed));
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.x), new NumericValue(e.y), new NumericValue(e.z)));
put("location", (e, a) -> ListValue.of(new NumericValue(e.x), new NumericValue(e.y), new NumericValue(e.z), new NumericValue(e.yaw), new NumericValue(e.pitch)));
put("x", (e, a) -> new NumericValue(e.x));
put("y", (e, a) -> new NumericValue(e.y));
put("z", (e, a) -> new NumericValue(e.z));
put("pos", (e, a) -> ListValue.of(new NumericValue(e.method_23317()), new NumericValue(e.method_23318()), new NumericValue(e.method_23321())));
put("location", (e, a) -> ListValue.of(new NumericValue(e.method_23317()), new NumericValue(e.method_23318()), new NumericValue(e.method_23321()), new NumericValue(e.yaw), new NumericValue(e.pitch)));
put("x", (e, a) -> new NumericValue(e.method_23317()));
put("y", (e, a) -> new NumericValue(e.method_23317()));
put("z", (e, a) -> new NumericValue(e.method_23317()));
put("motion", (e, a) ->
{
Vec3d velocity = e.getVelocity();
@@ -422,7 +422,7 @@ public class EntityValue extends Value
private static void updatePosition(Entity e)
{
if (e instanceof ServerPlayerEntity)
((ServerPlayerEntity)e).networkHandler.requestTeleport(e.x, e.y, e.z, e.yaw, e.pitch);
((ServerPlayerEntity)e).networkHandler.requestTeleport(e.method_23317(), e.method_23318(), e.method_23321(), e.yaw, e.pitch);
else
((ServerWorld)e.getEntityWorld()).method_14178().sendToNearbyPlayers(e,new EntityPositionS2CPacket(e));
}
@@ -446,14 +446,16 @@ public class EntityValue extends Value
throw new InternalExpressionException("expected a list of 5 parameters as second argument");
}
List<Value> coords = ((ListValue) v).getItems();
e.x = NumericValue.asNumber(coords.get(0)).getDouble();
e.y = NumericValue.asNumber(coords.get(1)).getDouble();
e.z = NumericValue.asNumber(coords.get(2)).getDouble();
e.method_23327(
NumericValue.asNumber(coords.get(0)).getDouble(),
NumericValue.asNumber(coords.get(1)).getDouble(),
NumericValue.asNumber(coords.get(2)).getDouble()
);
e.pitch = (float) NumericValue.asNumber(coords.get(4)).getDouble();
e.prevPitch = e.pitch;
e.yaw = (float) NumericValue.asNumber(coords.get(3)).getDouble();
e.prevYaw = e.yaw;
e.setPosition(e.x, e.y, e.z);
e.setPosition(e.method_23317(), e.method_23318(), e.method_23321());
updatePosition(e);
});
put("pos", (e, v) ->
@@ -463,28 +465,30 @@ public class EntityValue extends Value
throw new InternalExpressionException("expected a list of 3 parameters as second argument");
}
List<Value> coords = ((ListValue) v).getItems();
e.x = NumericValue.asNumber(coords.get(0)).getDouble();
e.y = NumericValue.asNumber(coords.get(1)).getDouble();
e.z = NumericValue.asNumber(coords.get(2)).getDouble();
e.setPosition(e.x, e.y, e.z);
e.method_23327(
NumericValue.asNumber(coords.get(0)).getDouble(),
NumericValue.asNumber(coords.get(1)).getDouble(),
NumericValue.asNumber(coords.get(2)).getDouble()
);
e.setPosition(e.method_23317(), e.method_23318(), e.method_23321());
updatePosition(e);
});
put("x", (e, v) ->
{
e.x = NumericValue.asNumber(v).getDouble();
e.setPosition(e.x, e.y, e.z);
//e.x = NumericValue.asNumber(v).getDouble();
e.setPosition(NumericValue.asNumber(v).getDouble(), e.method_23318(), e.method_23321());
updatePosition(e);
});
put("y", (e, v) ->
{
e.y = NumericValue.asNumber(v).getDouble();
e.setPosition(e.x, e.y, e.z);
//e.y = NumericValue.asNumber(v).getDouble();
e.setPosition(e.method_23317(), NumericValue.asNumber(v).getDouble(), e.method_23321());
updatePosition(e);
});
put("z", (e, v) ->
{
e.z = NumericValue.asNumber(v).getDouble();
e.setPosition(e.x, e.y, e.z);
//e.z = NumericValue.asNumber(v).getDouble();
e.setPosition(e.method_23317(), e.method_23318(), NumericValue.asNumber(v).getDouble());
updatePosition(e);
});
put("pitch", (e, v) ->
@@ -510,10 +514,7 @@ public class EntityValue extends Value
throw new InternalExpressionException("expected a list of 3 parameters as second argument");
}
List<Value> coords = ((ListValue) v).getItems();
e.x += NumericValue.asNumber(coords.get(0)).getDouble();
e.y += NumericValue.asNumber(coords.get(1)).getDouble();
e.z += NumericValue.asNumber(coords.get(2)).getDouble();
e.setPosition(e.x, e.y, e.z);
e.setPosition(NumericValue.asNumber(coords.get(0)).getDouble(),NumericValue.asNumber(coords.get(1)).getDouble(), NumericValue.asNumber(coords.get(2)).getDouble());
updatePosition(e);
});