mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-14 11:43:49 +01:00
Pose a Problem
- Fixed Track curves not rendering when optifine is present - Fixed /c killTrain not removing stale contraption entities from the server
This commit is contained in:
parent
1d1cf8e289
commit
494a48c538
2 changed files with 20 additions and 24 deletions
|
@ -449,8 +449,6 @@ public class BezierConnection implements Iterable<BezierConnection.Segment> {
|
|||
if (bakedSegments != null)
|
||||
return bakedSegments;
|
||||
|
||||
PoseStack poseStack = new PoseStack();
|
||||
TransformStack tstack = TransformStack.cast(poseStack);
|
||||
int segmentCount = getSegmentCount();
|
||||
bakedSegments = new SegmentAngles[segmentCount + 1];
|
||||
Couple<Vec3> previousOffsets = null;
|
||||
|
@ -477,16 +475,16 @@ public class BezierConnection implements Iterable<BezierConnection.Segment> {
|
|||
.scale(.5);
|
||||
Vec3 tieAngles = TrackRenderer.getModelAngles(segment.normal, railMiddle.subtract(prevMiddle));
|
||||
angles.lightPosition = new BlockPos(railMiddle);
|
||||
angles.railTransforms = Couple.create(null, null);
|
||||
|
||||
poseStack.pushPose();
|
||||
tstack.translate(prevMiddle)
|
||||
PoseStack poseStack = new PoseStack();
|
||||
TransformStack.cast(poseStack)
|
||||
.translate(prevMiddle)
|
||||
.rotateYRadians(tieAngles.y)
|
||||
.rotateXRadians(tieAngles.x)
|
||||
.rotateZRadians(tieAngles.z)
|
||||
.translate(-1 / 2f, -2 / 16f - 1 / 256f, 0);
|
||||
angles.tieTransform = poseStack.last();
|
||||
angles.railTransforms = Couple.create(null, null);
|
||||
poseStack.popPose();
|
||||
|
||||
// Rails
|
||||
float scale = end ? 2.2f : 2.1f;
|
||||
|
@ -496,15 +494,15 @@ public class BezierConnection implements Iterable<BezierConnection.Segment> {
|
|||
Vec3 diff = railI.subtract(prevI);
|
||||
Vec3 anglesI = TrackRenderer.getModelAngles(segment.normal, diff);
|
||||
|
||||
poseStack.pushPose();
|
||||
tstack.translate(prevI)
|
||||
poseStack = new PoseStack();
|
||||
TransformStack.cast(poseStack)
|
||||
.translate(prevI)
|
||||
.rotateYRadians(anglesI.y)
|
||||
.rotateXRadians(anglesI.x)
|
||||
.rotateZRadians(anglesI.z)
|
||||
.translate(0, -2 / 16f + (i % 2 == 0 ? 1 : -1) / 2048f - 1 / 256f, -1 / 32f)
|
||||
.scale(1, 1, (float) diff.length() * scale);
|
||||
angles.railTransforms.set(first, poseStack.last());
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
previousOffsets = railOffsets;
|
||||
|
@ -518,8 +516,6 @@ public class BezierConnection implements Iterable<BezierConnection.Segment> {
|
|||
if (bakedGirders != null)
|
||||
return bakedGirders;
|
||||
|
||||
PoseStack poseStack = new PoseStack();
|
||||
TransformStack tstack = TransformStack.cast(poseStack);
|
||||
int segmentCount = getSegmentCount();
|
||||
bakedGirders = new GirderAngles[segmentCount + 1];
|
||||
Couple<Couple<Vec3>> previousOffsets = null;
|
||||
|
@ -573,15 +569,15 @@ public class BezierConnection implements Iterable<BezierConnection.Segment> {
|
|||
Vec3 beamDiff = currentBeam.subtract(previousBeam);
|
||||
Vec3 beamAngles = TrackRenderer.getModelAngles(segment.normal, beamDiff);
|
||||
|
||||
poseStack.pushPose();
|
||||
tstack.translate(previousBeam)
|
||||
PoseStack poseStack = new PoseStack();
|
||||
TransformStack.cast(poseStack)
|
||||
.translate(previousBeam)
|
||||
.rotateYRadians(beamAngles.y)
|
||||
.rotateXRadians(beamAngles.x)
|
||||
.rotateZRadians(beamAngles.z)
|
||||
.translate(0, 2 / 16f + (segment.index % 2 == 0 ? 1 : -1) / 2048f - 1 / 1024f, -1 / 32f)
|
||||
.scale(1, 1, (float) beamDiff.length() * scale);
|
||||
angles.beams.set(first, poseStack.last());
|
||||
poseStack.popPose();
|
||||
|
||||
// Caps
|
||||
for (boolean top : Iterate.trueAndFalse) {
|
||||
|
@ -592,8 +588,9 @@ public class BezierConnection implements Iterable<BezierConnection.Segment> {
|
|||
Vec3 diff = current.subtract(previous);
|
||||
Vec3 capAngles = TrackRenderer.getModelAngles(segment.normal, diff);
|
||||
|
||||
poseStack.pushPose();
|
||||
tstack.translate(previous)
|
||||
poseStack = new PoseStack();
|
||||
TransformStack.cast(poseStack)
|
||||
.translate(previous)
|
||||
.rotateYRadians(capAngles.y)
|
||||
.rotateXRadians(capAngles.x)
|
||||
.rotateZRadians(capAngles.z)
|
||||
|
@ -602,7 +599,6 @@ public class BezierConnection implements Iterable<BezierConnection.Segment> {
|
|||
.scale(1, 1, (float) diff.length() * scale);
|
||||
angles.beamCaps.get(top)
|
||||
.set(first, poseStack.last());
|
||||
poseStack.popPose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ import com.simibubi.create.foundation.utility.Couple;
|
|||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
|
@ -221,6 +220,11 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!Create.RAILWAYS.sided(level).trains.containsKey(carriage.train.id)) {
|
||||
discard();
|
||||
return;
|
||||
}
|
||||
|
||||
tickActors();
|
||||
boolean isStalled = isStalled();
|
||||
carriage.stalled = isStalled;
|
||||
|
@ -266,10 +270,6 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity {
|
|||
|
||||
carriageData.approach(this, carriage, 1f / getType().updateInterval());
|
||||
|
||||
if (!Create.RAILWAYS.sided(null).trains.containsKey(carriage.train.id)) {
|
||||
discard();
|
||||
return;
|
||||
}
|
||||
if (!carriage.train.derailed)
|
||||
carriage.updateContraptionAnchors();
|
||||
|
||||
|
@ -588,7 +588,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity {
|
|||
GlobalStation currentStation = carriage.train.getCurrentStation();
|
||||
if (currentStation != null && spaceDown) {
|
||||
sendPrompt(player, Lang.translate("train.arrived_at",
|
||||
new TextComponent(currentStation.name).withStyle(ChatFormatting.DARK_GREEN)), false);
|
||||
new TextComponent(currentStation.name).withStyle(s -> s.withColor(0x704630))), false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -600,7 +600,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity {
|
|||
if (currentStation != null && targetSpeed != 0) {
|
||||
stationMessage = false;
|
||||
sendPrompt(player, Lang.translate("train.departing_from",
|
||||
new TextComponent(currentStation.name).withStyle(ChatFormatting.DARK_GREEN)), false);
|
||||
new TextComponent(currentStation.name).withStyle(s -> s.withColor(0x704630))), false);
|
||||
}
|
||||
|
||||
if (currentStation == null) {
|
||||
|
|
Loading…
Reference in a new issue