Merge branch 'master' into 1.16

# Conflicts:
#	src/main/java/carpet/script/utils/ShapeDispatcher.java
This commit is contained in:
gnembon committed 2020-07-19 11:26:22 -03:00
commit 86b6723b6a
3 files changed
+21 -6

No files matched your search

+2 -1
View File
@@ -3405,7 +3405,8 @@ Optional shared shape attributes:
* `snap` - if `follow` is present, indicated on which axis the snapping to entity coordinates occurs, and which axis
will be treated statically, i.e. the coordinate passed in a coord triple is the actual value in the world. Default
value is `'xyz'`, meaning the shape will be drawn relatively to the entity in all three directions. Using `xz` for
instance makes so that the shape follows the entity, but stays at the same, absolute Y coordinate.
instance makes so that the shape follows the entity, but stays at the same, absolute Y coordinate. Preceeding an axis
with `d`, like `dxdydz` would make so that entity position is treated discretely (rounded down).
Available shapes:
* `'line'` - draws a straight line between two points.
+2 -1
View File
@@ -75,7 +75,8 @@ Optional shared shape attributes:
* `snap` - if `follow` is present, indicated on which axis the snapping to entity coordinates occurs, and which axis
will be treated statically, i.e. the coordinate passed in a coord triple is the actual value in the world. Default
value is `'xyz'`, meaning the shape will be drawn relatively to the entity in all three directions. Using `xz` for
instance makes so that the shape follows the entity, but stays at the same, absolute Y coordinate.
instance makes so that the shape follows the entity, but stays at the same, absolute Y coordinate. Preceeding an axis
with `d`, like `dxdydz` would make so that entity position is treated discretely (rounded down).
Available shapes:
* `'line'` - draws a straight line between two points.
@@ -257,6 +257,7 @@ public class ShapeDispatcher
protected int followEntity;
protected String snapTo;
protected boolean snapX, snapY, snapZ;
protected boolean discreteX, discreteY, discreteZ;
protected RegistryKey<World> shapeDimension;
@@ -319,15 +320,18 @@ public class ShapeDispatcher
snapX = snapTo.contains("x");
snapY = snapTo.contains("y");
snapZ = snapTo.contains("z");
discreteX = snapTo.contains("dx");
discreteY = snapTo.contains("dy");
discreteZ = snapTo.contains("dz");
}
}
public int getExpiry() { return duration; }
public Vec3d toAbsolute(Entity e, Vec3d vec, float partialTick)
{
return vec.add(
snapX?MathHelper.lerp(partialTick, e.prevX, e.getX()):0.0,
snapY?MathHelper.lerp(partialTick, e.prevY, e.getY()):0.0,
snapZ?MathHelper.lerp(partialTick, e.prevZ, e.getZ()):0.0
snapX?(discreteX ?MathHelper.floor(e.getX()):MathHelper.lerp(partialTick, e.prevX, e.getX())):0.0,
snapY?(discreteY ?MathHelper.floor(e.getY()):MathHelper.lerp(partialTick, e.prevY, e.getY())):0.0,
snapZ?(discreteZ ?MathHelper.floor(e.getZ()):MathHelper.lerp(partialTick, e.prevZ, e.getZ())):0.0
);
}
public Vec3d relativiseRender(World world, Vec3d vec, float partialTick)
@@ -370,6 +374,10 @@ public class ShapeDispatcher
hash ^= shapeDimension.hashCode(); hash *= 1099511628211L;
hash ^= color; hash *= 1099511628211L;
hash ^= followEntity; hash *= 1099511628211L;
if (followEntity >= 0)
{
hash ^= snapTo.hashCode(); hash *= 1099511628211L;
}
hash ^= Float.hashCode(lineWidth); hash *= 1099511628211L;
if (fa != 0.0) { hash = 31*hash + fillColor; hash *= 1099511628211L; }
return hash;
@@ -830,7 +838,12 @@ public class ShapeDispatcher
put("duration", new NonNegativeIntParam("duration"));
put("color", new ColorParam("color"));
put("follow", new EntityParam("follow"));
put("snap", new StringChoiceParam("snap", "xyz", "xz", "yz", "xy", "x", "y", "z"));
put("snap", new StringChoiceParam("snap",
"xyz", "xz", "yz", "xy", "x", "y", "z",
"dxdydz", "dxdz", "dydz", "dxdy", "dx", "dy", "dz",
"xdz", "dxz", "ydz", "dyz", "xdy", "dxy",
"xydz", "xdyz", "xdydz", "dxyz", "dxydz", "dxdyz"
));
put("line", new PositiveFloatParam("line"));
put("fill", new ColorParam("fill"));