mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-02-04 17:34:58 +01:00
upside down bogeys work in nether portals
fixed coupling anchor offsets
This commit is contained in:
parent
da26c0ccbf
commit
d556f08876
4 changed files with 19 additions and 8 deletions
|
@ -374,7 +374,13 @@ public class Carriage {
|
||||||
TrackNodeLocation pivot = dce.findPivot(dimension, start == getLeadingPoint());
|
TrackNodeLocation pivot = dce.findPivot(dimension, start == getLeadingPoint());
|
||||||
if (pivot == null)
|
if (pivot == null)
|
||||||
return null;
|
return null;
|
||||||
Vec3 startVec = start.getPosition(start != getLeadingPoint() && (leadingBogey().isUpsideDown() != trailingBogey().isUpsideDown()));
|
boolean flipped = false;
|
||||||
|
if (!leadingUpsideDown && trailingUpsideDown) { // nu // fixme this code sucks and needs to be better
|
||||||
|
flipped = start != getLeadingPoint() && (leadingBogey().isUpsideDown() != trailingBogey().isUpsideDown());
|
||||||
|
} else if (leadingUpsideDown && !trailingUpsideDown) { // un
|
||||||
|
flipped = start != getLeadingPoint() && (leadingBogey().isUpsideDown() != trailingBogey().isUpsideDown());
|
||||||
|
}
|
||||||
|
Vec3 startVec = start.getPosition(flipped);
|
||||||
Vec3 portalVec = pivot.getLocation()
|
Vec3 portalVec = pivot.getLocation()
|
||||||
.add(0, DebugValueCommand.tmpPortalOffset(leadingUpsideDown, trailingUpsideDown, isLeading), 0);
|
.add(0, DebugValueCommand.tmpPortalOffset(leadingUpsideDown, trailingUpsideDown, isLeading), 0);
|
||||||
// same side - other side
|
// same side - other side
|
||||||
|
|
|
@ -151,7 +151,9 @@ public class CarriageBogey {
|
||||||
|
|
||||||
public void updateCouplingAnchor(Vec3 entityPos, float entityXRot, float entityYRot, int bogeySpacing,
|
public void updateCouplingAnchor(Vec3 entityPos, float entityXRot, float entityYRot, int bogeySpacing,
|
||||||
float partialTicks, boolean leading) {
|
float partialTicks, boolean leading) {
|
||||||
Vec3 thisOffset = type.getConnectorAnchorOffset(isUpsideDown());
|
boolean selfUpsideDown = isUpsideDown();
|
||||||
|
boolean leadingUpsideDown = carriage.leadingBogey().isUpsideDown();
|
||||||
|
Vec3 thisOffset = type.getConnectorAnchorOffset(selfUpsideDown);
|
||||||
thisOffset = thisOffset.multiply(1, 1, leading ? -1 : 1);
|
thisOffset = thisOffset.multiply(1, 1, leading ? -1 : 1);
|
||||||
|
|
||||||
thisOffset = VecHelper.rotate(thisOffset, pitch.getValue(partialTicks), Axis.X);
|
thisOffset = VecHelper.rotate(thisOffset, pitch.getValue(partialTicks), Axis.X);
|
||||||
|
@ -163,6 +165,8 @@ public class CarriageBogey {
|
||||||
thisOffset = VecHelper.rotate(thisOffset, 180, Axis.Y);
|
thisOffset = VecHelper.rotate(thisOffset, 180, Axis.Y);
|
||||||
thisOffset = VecHelper.rotate(thisOffset, -entityXRot, Axis.X);
|
thisOffset = VecHelper.rotate(thisOffset, -entityXRot, Axis.X);
|
||||||
thisOffset = VecHelper.rotate(thisOffset, entityYRot + 90, Axis.Y);
|
thisOffset = VecHelper.rotate(thisOffset, entityYRot + 90, Axis.Y);
|
||||||
|
if (selfUpsideDown != leadingUpsideDown)
|
||||||
|
thisOffset = thisOffset.add(0, selfUpsideDown ? -2 : 2, 0);
|
||||||
|
|
||||||
couplingAnchors.set(leading, entityPos.add(thisOffset));
|
couplingAnchors.set(leading, entityPos.add(thisOffset));
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class CarriageCouplingRenderer {
|
||||||
|
|
||||||
float margin = 3 / 16f;
|
float margin = 3 / 16f;
|
||||||
double couplingDistance = train.carriageSpacing.get(i) - 2 * margin
|
double couplingDistance = train.carriageSpacing.get(i) - 2 * margin
|
||||||
- bogey1.type.getConnectorAnchorOffset(bogey1.isUpsideDown()).z - bogey2.type.getConnectorAnchorOffset(bogey1.isUpsideDown()).z;
|
- bogey1.type.getConnectorAnchorOffset(bogey1.isUpsideDown()).z - bogey2.type.getConnectorAnchorOffset(bogey2.isUpsideDown()).z;
|
||||||
int couplingSegments = (int) Math.round(couplingDistance * 4);
|
int couplingSegments = (int) Math.round(couplingDistance * 4);
|
||||||
double stretch = ((anchor2.distanceTo(anchor) - 2 * margin) * 4) / couplingSegments;
|
double stretch = ((anchor2.distanceTo(anchor) - 2 * margin) * 4) / couplingSegments;
|
||||||
for (int j = 0; j < couplingSegments; j++) {
|
for (int j = 0; j < couplingSegments; j++) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.CommandBlockEntity;
|
import net.minecraft.world.level.block.entity.CommandBlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
public class DebugValueCommand {
|
public class DebugValueCommand { //fixme this is *very* temporary
|
||||||
|
|
||||||
public static float value = 0;
|
public static float value = 0;
|
||||||
|
|
||||||
|
@ -41,8 +41,9 @@ public class DebugValueCommand {
|
||||||
|
|
||||||
// same side - other side
|
// same side - other side
|
||||||
// n(ormal)-n(ormal)
|
// n(ormal)-n(ormal)
|
||||||
// u(pside down)-u(pside down) what about un ? not tested yet un doesn't work with + 1 or -1. HALP
|
// u(pside down)-u(pside down)
|
||||||
// 1 works for: nn n nu
|
// nu works with special handling, now to get un to work!
|
||||||
|
// 1 works for: nn n
|
||||||
//-1 works for: uu u
|
//-1 works for: uu u
|
||||||
public static double tmpPortalOffset(boolean leadingUpsideDown, boolean trailingUpsideDown, boolean isLeading) {
|
public static double tmpPortalOffset(boolean leadingUpsideDown, boolean trailingUpsideDown, boolean isLeading) {
|
||||||
double portalOffset = 0.0;
|
double portalOffset = 0.0;
|
||||||
|
@ -52,9 +53,9 @@ public class DebugValueCommand {
|
||||||
return -1.0;
|
return -1.0;
|
||||||
} else if (leadingUpsideDown && !trailingUpsideDown) { // un
|
} else if (leadingUpsideDown && !trailingUpsideDown) { // un
|
||||||
if (isLeading) {
|
if (isLeading) {
|
||||||
return 0.1;
|
return -1.0;
|
||||||
} else {
|
} else {
|
||||||
return 0.2;
|
return -1.0;
|
||||||
}
|
}
|
||||||
} else if (!leadingUpsideDown && trailingUpsideDown) { // nu
|
} else if (!leadingUpsideDown && trailingUpsideDown) { // nu
|
||||||
if (isLeading) {
|
if (isLeading) {
|
||||||
|
|
Loading…
Reference in a new issue