adapt to new TrackApi#20
Open
Deepseasaltyfish wants to merge 12 commits intoTeamOpenIndustry:1.12.2-forgefrom
Open
adapt to new TrackApi#20Deepseasaltyfish wants to merge 12 commits intoTeamOpenIndustry:1.12.2-forgefrom
Deepseasaltyfish wants to merge 12 commits intoTeamOpenIndustry:1.12.2-forgefrom
Conversation
…ompat, fix crash when spawning train on MinecraftRail in some case
cam72cam
reviewed
Mar 4, 2026
|
|
||
| static ITrack get(World world, Vec3d pos, boolean allowMCRail) { | ||
| trackapi.lib.ITrack track = Util.getTileEntity(world.internal, pos.internal(), allowMCRail); | ||
| trackapi.lib.ITrackV2 track = (trackapi.lib.ITrackV2) Util.getTileEntity(world.internal, pos.internal(), allowMCRail); |
Member
There was a problem hiding this comment.
Util.findTrackBlocks can be used to avoid the cast
cam72cam
reviewed
Mar 4, 2026
| public net.minecraft.util.math.Vec3d getNextPosition(net.minecraft.util.math.Vec3d pos, net.minecraft.util.math.Vec3d mot) { | ||
| return track() != null ? track().getNextPosition(pos, mot) : pos; | ||
| public double[] getTrackGauges() { | ||
| double[] fallback = new double[1]; |
Member
There was a problem hiding this comment.
I'd rewrite this whole thing as an if statement to avoid the allocation, instead of taking the ternary approach
cam72cam
reviewed
Mar 4, 2026
|
|
||
| @Deprecated | ||
| @Override | ||
| public double getTrackGauge() { |
Member
There was a problem hiding this comment.
This can be removed as the default method does effectively the same thing now.
cam72cam
reviewed
Mar 4, 2026
| return new trackapi.lib.ITrackV2() { | ||
| @Deprecated | ||
| @Override | ||
| public double getTrackGauge() { |
cam72cam
reviewed
Mar 4, 2026
| return new ITrack() { | ||
| @Deprecated | ||
| @Override | ||
| public double getTrackGauge() { |
Author
|
multiple gauges haven't been really implemented yet, then we should temporarily use getTrackGauges()[0] in IR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ITrack => ITrackV2
add IRPathingData