mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Fixes #103
This commit is contained in:
parent
208929c378
commit
d97836762d
@ -43,7 +43,7 @@ public class CatenaryBrush implements Brush, ResettableTool {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.vertex == null) {
|
if (this.vertex == null) {
|
||||||
vertex = getVertex(pos1, pos2, slack);
|
vertex = getVertex(pos1.toVector3(), pos2.toVector3(), slack);
|
||||||
if (this.direction) {
|
if (this.direction) {
|
||||||
BBC.BRUSH_CATENARY_DIRECTION.send(editSession.getPlayer(), 2);
|
BBC.BRUSH_CATENARY_DIRECTION.send(editSession.getPlayer(), 2);
|
||||||
return;
|
return;
|
||||||
@ -79,8 +79,8 @@ public class CatenaryBrush implements Brush, ResettableTool {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockVector3 getVertex(BlockVector3 pos1, BlockVector3 pos2, double lenPercent) {
|
public static BlockVector3 getVertex(Vector3 pos1, Vector3 pos2, double lenPercent) {
|
||||||
if (lenPercent <= 1) return MathUtils.midpoint(pos1, pos2);
|
if (lenPercent <= 1) return pos1.add(pos2).divide(2).toBlockPoint();
|
||||||
double curveLen = pos1.distance(pos2) * lenPercent;
|
double curveLen = pos1.distance(pos2) * lenPercent;
|
||||||
double dy = pos2.getY() - pos1.getY();
|
double dy = pos2.getY() - pos1.getY();
|
||||||
double dx = pos2.getX() - pos1.getX();
|
double dx = pos2.getX() - pos1.getX();
|
||||||
@ -93,6 +93,6 @@ public class CatenaryBrush implements Brush, ResettableTool {
|
|||||||
double z = (dh/2)/a;
|
double z = (dh/2)/a;
|
||||||
double oY = (dy - curveLen * (Math.cosh(z) / Math.sinh(z))) / 2;
|
double oY = (dy - curveLen * (Math.cosh(z) / Math.sinh(z))) / 2;
|
||||||
double vertY = a * 1 + oY;
|
double vertY = a * 1 + oY;
|
||||||
return pos1.add(pos2.subtract(pos1).multiply(MathMan.roundInt(vertX / dh)).add(0, MathMan.roundInt(vertY), 0)).round();
|
return pos1.add(pos2.subtract(pos1).multiply(vertX / dh).add(0, vertY, 0)).round().toBlockPoint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user