update 1.16

This commit is contained in:
gnembon committed 2020-06-04 02:40:40 -03:00
1 parent 8fe3508fdd
commit 252dc29e18
2 files changed
+5 -11

No files matched your search

@@ -177,7 +177,7 @@ public class ShapeDispatcher
protected int duration = 0; protected int duration = 0;
private int key; private int key;
protected int followEntity; protected int followEntity;
protected DimensionType entityDimension; protected RegistryKey<World> entityDimension;
protected ExpiringShape() { } protected ExpiringShape() { }
@@ -222,7 +222,7 @@ public class ShapeDispatcher
if (options.containsKey("follow")) if (options.containsKey("follow"))
{ {
followEntity = NumericValue.asNumber(options.getOrDefault("follow", optional.get("follow"))).getInt(); followEntity = NumericValue.asNumber(options.getOrDefault("follow", optional.get("follow"))).getInt();
entityDimension = Registry.DIMENSION_TYPE.get(new Identifier(options.get("dim").getString())); entityDimension = RegistryKey.of(Registry.DIMENSION, new Identifier(options.get("dim").getString()));
} }
} }
public int getExpiry() { return duration; } public int getExpiry() { return duration; }
@@ -609,13 +609,7 @@ public class ShapeDispatcher
public static class DimensionParam extends StringParam public static class DimensionParam extends StringParam
{ {
@Override @Override
public Value validate(Map<String, Value> options, CarpetContext cc, Value value) public Value validate(Map<String, Value> options, CarpetContext cc, Value value) { return value; }
{
String dimStr = value.getString();
Optional<DimensionType> dimOp = Registry.DIMENSION_TYPE.getOrEmpty(new Identifier(dimStr));
if (!dimOp.isPresent()) throw new InternalExpressionException("Unknown dimension "+dimStr);
return value;
}
@Override @Override
public boolean appliesTo(ExpiringShape shape) { return true; } public boolean appliesTo(ExpiringShape shape) { return true; }
@Override @Override
@@ -164,11 +164,11 @@ public class ShapesRenderer
{ {
return shape.key(); return shape.key();
}; };
public boolean shouldRender(DimensionType dim) public boolean shouldRender(RegistryKey<World> dim)
{ {
if (shape.followEntity <=0 ) return true; if (shape.followEntity <=0 ) return true;
if (client.world == null) return false; if (client.world == null) return false;
if (client.world.dimension.getType() != dim) return false; if (client.world.method_27983() != dim) return false;
if (client.world.getEntityById(shape.followEntity) == null) return false; if (client.world.getEntityById(shape.followEntity) == null) return false;
return true; return true;
} }