Skip to content

adapt to new TrackApi#20

Open
Deepseasaltyfish wants to merge 12 commits intoTeamOpenIndustry:1.12.2-forgefrom
Deepseasaltyfish:roll_offset
Open

adapt to new TrackApi#20
Deepseasaltyfish wants to merge 12 commits intoTeamOpenIndustry:1.12.2-forgefrom
Deepseasaltyfish:roll_offset

Conversation

@Deepseasaltyfish
Copy link

ITrack => ITrackV2
add IRPathingData


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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Util.findTrackBlocks can be used to avoid the cast

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];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rewrite this whole thing as an if statement to avoid the allocation, instead of taking the ternary approach


@Deprecated
@Override
public double getTrackGauge() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed as the default method does effectively the same thing now.

return new trackapi.lib.ITrackV2() {
@Deprecated
@Override
public double getTrackGauge() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed

return new ITrack() {
@Deprecated
@Override
public double getTrackGauge() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed

@Deepseasaltyfish
Copy link
Author

multiple gauges haven't been really implemented yet, then we should temporarily use getTrackGauges()[0] in IR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants