mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 09:03:42 +01:00
Consider testing your PR
- Fixed compiler errors - Maximum placement length of tracks and turns are now configurable (#4241) - Adjusted validation guards and network visualisation to function with longer bends - Track graph no longer shows nodes and edges on f3 unless configured to - Kinetic blocks no longer show debug information on f3 unless configured to
This commit is contained in:
parent
b502cd1c16
commit
e97b75ff72
13 changed files with 35 additions and 15 deletions
|
@ -61,7 +61,11 @@ public class KineticDebugger {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isActive() {
|
public static boolean isActive() {
|
||||||
return Minecraft.getInstance().options.renderDebug && AllConfigs.CLIENT.rainbowDebug.get();
|
return isF3DebugModeActive() && AllConfigs.CLIENT.rainbowDebug.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isF3DebugModeActive() {
|
||||||
|
return Minecraft.getInstance().options.renderDebug;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static KineticTileEntity getSelectedTE() {
|
public static KineticTileEntity getSelectedTE() {
|
||||||
|
|
|
@ -745,7 +745,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
||||||
|
|
||||||
protected abstract float getStalledAngle();
|
protected abstract float getStalledAngle();
|
||||||
|
|
||||||
protected abstract void handleStallInformation(float x, float y, float z, float angle);
|
protected abstract void handleStallInformation(double x, double y, double z, float angle);
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
protected void handleBlockChange(BlockPos localPos, BlockState newState) {
|
protected void handleBlockChange(BlockPos localPos, BlockState newState) {
|
||||||
|
|
|
@ -219,7 +219,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleStallInformation(float x, float y, float z, float angle) {
|
protected void handleStallInformation(double x, double y, double z, float angle) {
|
||||||
setPosRaw(x, y, z);
|
setPosRaw(x, y, z);
|
||||||
this.angle = this.prevAngle = angle;
|
this.angle = this.prevAngle = angle;
|
||||||
}
|
}
|
||||||
|
|
|
@ -515,7 +515,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleStallInformation(float x, float y, float z, float angle) {
|
protected void handleStallInformation(double x, double y, double z, float angle) {
|
||||||
yaw = angle;
|
yaw = angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class GantryContraptionEntity extends AbstractContraptionEntity {
|
||||||
public void lerpTo(double x, double y, double z, float yw, float pt, int inc, boolean t) {}
|
public void lerpTo(double x, double y, double z, float yw, float pt, int inc, boolean t) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleStallInformation(float x, float y, float z, float angle) {
|
protected void handleStallInformation(double x, double y, double z, float angle) {
|
||||||
setPosRaw(x, y, z);
|
setPosRaw(x, y, z);
|
||||||
clientOffsetDiff = 0;
|
clientOffsetDiff = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import com.simibubi.create.content.logistics.trains.entity.Train;
|
||||||
import com.simibubi.create.content.logistics.trains.entity.TrainPacket;
|
import com.simibubi.create.content.logistics.trains.entity.TrainPacket;
|
||||||
import com.simibubi.create.content.logistics.trains.management.display.GlobalTrainDisplayData;
|
import com.simibubi.create.content.logistics.trains.management.display.GlobalTrainDisplayData;
|
||||||
import com.simibubi.create.content.logistics.trains.management.edgePoint.signal.SignalEdgeGroup;
|
import com.simibubi.create.content.logistics.trains.management.edgePoint.signal.SignalEdgeGroup;
|
||||||
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.networking.AllPackets;
|
import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
@ -256,17 +257,21 @@ public class GlobalRailwayManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tickSignalOverlay() {
|
public void tickSignalOverlay() {
|
||||||
if (!KineticDebugger.isActive())
|
if (!isTrackGraphDebugActive())
|
||||||
for (TrackGraph trackGraph : trackNetworks.values())
|
for (TrackGraph trackGraph : trackNetworks.values())
|
||||||
TrackGraphVisualizer.visualiseSignalEdgeGroups(trackGraph);
|
TrackGraphVisualizer.visualiseSignalEdgeGroups(trackGraph);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clientTick() {
|
public void clientTick() {
|
||||||
if (KineticDebugger.isActive())
|
if (isTrackGraphDebugActive())
|
||||||
for (TrackGraph trackGraph : trackNetworks.values())
|
for (TrackGraph trackGraph : trackNetworks.values())
|
||||||
TrackGraphVisualizer.debugViewGraph(trackGraph);
|
TrackGraphVisualizer.debugViewGraph(trackGraph);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isTrackGraphDebugActive() {
|
||||||
|
return KineticDebugger.isF3DebugModeActive() && AllConfigs.CLIENT.showTrackGraphOnF3.get();
|
||||||
|
}
|
||||||
|
|
||||||
public GlobalRailwayManager sided(LevelAccessor level) {
|
public GlobalRailwayManager sided(LevelAccessor level) {
|
||||||
if (level != null && !level.isClientSide())
|
if (level != null && !level.isClientSide())
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -66,7 +66,8 @@ public class TrackGraphVisualizer {
|
||||||
|
|
||||||
if (!edge.node1.location.dimension.equals(edge.node2.location.dimension))
|
if (!edge.node1.location.dimension.equals(edge.node2.location.dimension))
|
||||||
continue;
|
continue;
|
||||||
if (other.hashCode() > hashCode && !ctrl)
|
if (other.hashCode() > hashCode && other.location.getLocation()
|
||||||
|
.distanceTo(camera) <= 50)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Vec3 yOffset = new Vec3(0, (other.hashCode() > hashCode ? 6 : 5) / 64f, 0);
|
Vec3 yOffset = new Vec3(0, (other.hashCode() > hashCode ? 6 : 5) / 64f, 0);
|
||||||
|
|
|
@ -387,7 +387,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleStallInformation(float x, float y, float z, float angle) {}
|
protected void handleStallInformation(double x, double y, double z, float angle) {}
|
||||||
|
|
||||||
Vec3 derailParticleOffset = VecHelper.offsetRandomly(Vec3.ZERO, Create.RANDOM, 1.5f)
|
Vec3 derailParticleOffset = VecHelper.offsetRandomly(Vec3.ZERO, Create.RANDOM, 1.5f)
|
||||||
.multiply(1, .25f, 1);
|
.multiply(1, .25f, 1);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.util.function.Supplier;
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionRelocationPacket;
|
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionRelocationPacket;
|
||||||
import com.simibubi.create.content.logistics.trains.track.BezierTrackPointLocation;
|
import com.simibubi.create.content.logistics.trains.track.BezierTrackPointLocation;
|
||||||
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.networking.AllPackets;
|
import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
import com.simibubi.create.foundation.networking.SimplePacketBase;
|
import com.simibubi.create.foundation.networking.SimplePacketBase;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
@ -83,13 +84,14 @@ public class TrainRelocationPacket extends SimplePacketBase {
|
||||||
if (!train.id.equals(cce.trainId))
|
if (!train.id.equals(cce.trainId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int verifyDistance = AllConfigs.SERVER.trains.maxTrackPlacementLength.get() * 2;
|
||||||
if (!sender.position()
|
if (!sender.position()
|
||||||
.closerThan(Vec3.atCenterOf(pos), 64)) {
|
.closerThan(Vec3.atCenterOf(pos), verifyDistance)) {
|
||||||
Create.LOGGER.warn(messagePrefix + train.name.getString() + ": player too far from clicked pos");
|
Create.LOGGER.warn(messagePrefix + train.name.getString() + ": player too far from clicked pos");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!sender.position()
|
if (!sender.position()
|
||||||
.closerThan(cce.position(), 64 + cce.getBoundingBox()
|
.closerThan(cce.position(), verifyDistance + cce.getBoundingBox()
|
||||||
.getXsize() / 2)) {
|
.getXsize() / 2)) {
|
||||||
Create.LOGGER.warn(messagePrefix + train.name.getString() + ": player too far from carriage entity");
|
Create.LOGGER.warn(messagePrefix + train.name.getString() + ": player too far from carriage entity");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.simibubi.create.AllSoundEvents;
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.content.logistics.trains.BezierConnection;
|
import com.simibubi.create.content.logistics.trains.BezierConnection;
|
||||||
import com.simibubi.create.content.logistics.trains.TrackPropagator;
|
import com.simibubi.create.content.logistics.trains.TrackPropagator;
|
||||||
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.networking.TileEntityConfigurationPacket;
|
import com.simibubi.create.foundation.networking.TileEntityConfigurationPacket;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -47,8 +48,9 @@ public class CurvedTrackDestroyPacket extends TileEntityConfigurationPacket<Trac
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void applySettings(ServerPlayer player, TrackTileEntity te) {
|
protected void applySettings(ServerPlayer player, TrackTileEntity te) {
|
||||||
|
int verifyDistance = AllConfigs.SERVER.trains.maxTrackPlacementLength.get() * 4;
|
||||||
if (!te.getBlockPos()
|
if (!te.getBlockPos()
|
||||||
.closerThan(player.blockPosition(), 128)) {
|
.closerThan(player.blockPosition(), verifyDistance)) {
|
||||||
Create.LOGGER.warn(player.getScoreboardName() + " too far away from destroyed Curve track");
|
Create.LOGGER.warn(player.getScoreboardName() + " too far away from destroyed Curve track");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.simibubi.create.content.logistics.trains.BezierConnection;
|
||||||
import com.simibubi.create.content.logistics.trains.ITrackBlock;
|
import com.simibubi.create.content.logistics.trains.ITrackBlock;
|
||||||
import com.simibubi.create.foundation.advancement.AllAdvancements;
|
import com.simibubi.create.foundation.advancement.AllAdvancements;
|
||||||
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
|
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
|
||||||
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
import com.simibubi.create.foundation.utility.Couple;
|
import com.simibubi.create.foundation.utility.Couple;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
|
@ -101,6 +102,7 @@ public class TrackPlacement {
|
||||||
ItemStack stack, boolean girder, boolean maximiseTurn) {
|
ItemStack stack, boolean girder, boolean maximiseTurn) {
|
||||||
Vec3 lookVec = player.getLookAngle();
|
Vec3 lookVec = player.getLookAngle();
|
||||||
int lookAngle = (int) (22.5 + AngleHelper.deg(Mth.atan2(lookVec.z, lookVec.x)) % 360) / 8;
|
int lookAngle = (int) (22.5 + AngleHelper.deg(Mth.atan2(lookVec.z, lookVec.x)) % 360) / 8;
|
||||||
|
int maxLength = AllConfigs.SERVER.trains.maxTrackPlacementLength.get();
|
||||||
|
|
||||||
if (level.isClientSide && cached != null && pos2.equals(hoveringPos) && stack.equals(lastItem)
|
if (level.isClientSide && cached != null && pos2.equals(hoveringPos) && stack.equals(lastItem)
|
||||||
&& hoveringMaxed == maximiseTurn && lookAngle == hoveringAngle)
|
&& hoveringMaxed == maximiseTurn && lookAngle == hoveringAngle)
|
||||||
|
@ -143,7 +145,7 @@ public class TrackPlacement {
|
||||||
|
|
||||||
if (pos1.equals(pos2))
|
if (pos1.equals(pos2))
|
||||||
return info.withMessage("second_point");
|
return info.withMessage("second_point");
|
||||||
if (pos1.distSqr(pos2) > 32 * 32)
|
if (pos1.distSqr(pos2) > maxLength * maxLength)
|
||||||
return info.withMessage("too_far")
|
return info.withMessage("too_far")
|
||||||
.tooJumbly();
|
.tooJumbly();
|
||||||
if (!state1.hasProperty(TrackBlock.HAS_TE))
|
if (!state1.hasProperty(TrackBlock.HAS_TE))
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class CClient extends ConfigBase {
|
||||||
public final ConfigFloat fanParticleDensity = f(.5f, 0, 1, "fanParticleDensity",
|
public final ConfigFloat fanParticleDensity = f(.5f, 0, 1, "fanParticleDensity",
|
||||||
Comments.fanParticleDensity);
|
Comments.fanParticleDensity);
|
||||||
public final ConfigFloat filterItemRenderDistance = f(10f, 1, "filterItemRenderDistance", Comments.filterItemRenderDistance);
|
public final ConfigFloat filterItemRenderDistance = f(10f, 1, "filterItemRenderDistance", Comments.filterItemRenderDistance);
|
||||||
public final ConfigBool rainbowDebug = b(true, "enableRainbowDebug",
|
public final ConfigBool rainbowDebug = b(false, "enableRainbowDebug",
|
||||||
Comments.rainbowDebug);
|
Comments.rainbowDebug);
|
||||||
public final ConfigInt maxContraptionLightVolume = i(16384, 0, Integer.MAX_VALUE, "maximumContraptionLightVolume",
|
public final ConfigInt maxContraptionLightVolume = i(16384, 0, Integer.MAX_VALUE, "maximumContraptionLightVolume",
|
||||||
Comments.maxContraptionLightVolume);
|
Comments.maxContraptionLightVolume);
|
||||||
|
@ -76,6 +76,7 @@ public class CClient extends ConfigBase {
|
||||||
//train group
|
//train group
|
||||||
public final ConfigGroup trains = group(1, "trains", Comments.trains);
|
public final ConfigGroup trains = group(1, "trains", Comments.trains);
|
||||||
public final ConfigFloat mountedZoomMultiplier = f(3, 0, "mountedZoomMultiplier", Comments.mountedZoomMultiplier);
|
public final ConfigFloat mountedZoomMultiplier = f(3, 0, "mountedZoomMultiplier", Comments.mountedZoomMultiplier);
|
||||||
|
public final ConfigBool showTrackGraphOnF3 = b(false, "showTrackGraphOnF3", Comments.showTrackGraphOnF3);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
@ -96,7 +97,7 @@ public class CClient extends ConfigBase {
|
||||||
"[in Blocks]",
|
"[in Blocks]",
|
||||||
"Maximum Distance to the player at which items in Blocks' filter slots will be displayed"
|
"Maximum Distance to the player at which items in Blocks' filter slots will be displayed"
|
||||||
};
|
};
|
||||||
static String rainbowDebug = "Show colourful debug information while the F3-Menu is open.";
|
static String rainbowDebug = "Show kinetic debug information on blocks while the F3-Menu is open.";
|
||||||
static String maxContraptionLightVolume = "The maximum amount of blocks for which to try and calculate dynamic contraption lighting. Decrease if large contraption cause too much lag";
|
static String maxContraptionLightVolume = "The maximum amount of blocks for which to try and calculate dynamic contraption lighting. Decrease if large contraption cause too much lag";
|
||||||
static String[] mainMenuConfigButtonRow = new String[]{
|
static String[] mainMenuConfigButtonRow = new String[]{
|
||||||
"Choose the menu row that the Create config button appears on in the main menu",
|
"Choose the menu row that the Create config button appears on in the main menu",
|
||||||
|
@ -145,6 +146,7 @@ public class CClient extends ConfigBase {
|
||||||
|
|
||||||
static String trains = "Railway related settings";
|
static String trains = "Railway related settings";
|
||||||
static String mountedZoomMultiplier = "How far away the Camera should zoom when seated on a train";
|
static String mountedZoomMultiplier = "How far away the Camera should zoom when seated on a train";
|
||||||
|
static String showTrackGraphOnF3 = "Display nodes and edges of a Railway Network while f3 debug mode is active";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.foundation.config;
|
||||||
public class CTrains extends ConfigBase {
|
public class CTrains extends ConfigBase {
|
||||||
|
|
||||||
public final ConfigBool trainsCauseDamage = b(true, "trainsCauseDamage", Comments.trainsCauseDamage);
|
public final ConfigBool trainsCauseDamage = b(true, "trainsCauseDamage", Comments.trainsCauseDamage);
|
||||||
|
public final ConfigInt maxTrackPlacementLength = i(32, 16, 128, "maxTrackPlacementLength", Comments.maxTrackPlacementLength);
|
||||||
public final ConfigInt maxAssemblyLength = i(128, 5, "maxAssemblyLength", Comments.maxAssemblyLength);
|
public final ConfigInt maxAssemblyLength = i(128, 5, "maxAssemblyLength", Comments.maxAssemblyLength);
|
||||||
public final ConfigInt maxBogeyCount = i(20, 1, "maxBogeyCount", Comments.maxBogeyCount);
|
public final ConfigInt maxBogeyCount = i(20, 1, "maxBogeyCount", Comments.maxBogeyCount);
|
||||||
public final ConfigFloat manualTrainSpeedModifier = f(.75f, 0, "manualTrainSpeedModifier", Comments.manualTrainSpeedModifier);
|
public final ConfigFloat manualTrainSpeedModifier = f(.75f, 0, "manualTrainSpeedModifier", Comments.manualTrainSpeedModifier);
|
||||||
|
@ -33,6 +34,7 @@ public class CTrains extends ConfigBase {
|
||||||
static String poweredTrainTurningTopSpeed = "The top speed of powered Trains during a turn.";
|
static String poweredTrainTurningTopSpeed = "The top speed of powered Trains during a turn.";
|
||||||
static String poweredTrainAcceleration = "The acceleration of powered Trains.";
|
static String poweredTrainAcceleration = "The acceleration of powered Trains.";
|
||||||
static String trainsCauseDamage = "Whether moving Trains can hurt colliding mobs and players.";
|
static String trainsCauseDamage = "Whether moving Trains can hurt colliding mobs and players.";
|
||||||
|
static String maxTrackPlacementLength = "Maximum length of track that can be placed as one batch or turn.";
|
||||||
static String maxAssemblyLength = "Maximum length of a Train Stations' assembly track.";
|
static String maxAssemblyLength = "Maximum length of a Train Stations' assembly track.";
|
||||||
static String maxBogeyCount = "Maximum amount of bogeys assembled as a single Train.";
|
static String maxBogeyCount = "Maximum amount of bogeys assembled as a single Train.";
|
||||||
static String manualTrainSpeedModifier = "Relative speed of a manually controlled Train compared to a Scheduled one.";
|
static String manualTrainSpeedModifier = "Relative speed of a manually controlled Train compared to a Scheduled one.";
|
||||||
|
|
Loading…
Reference in a new issue