Skip to content

Commit

Permalink
fix: issue with PathwayRequester
Browse files Browse the repository at this point in the history
  • Loading branch information
Uhutown committed Nov 20, 2023
1 parent b449f1a commit e67d9fd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.troblecodings.core.I18Wrapper;
import com.troblecodings.core.WriteBuffer;
import com.troblecodings.guilib.ecs.DrawUtil.DisableIntegerable;
import com.troblecodings.guilib.ecs.DrawUtil.SizeIntegerables;
import com.troblecodings.guilib.ecs.GuiBase;
import com.troblecodings.guilib.ecs.GuiElements;
Expand Down Expand Up @@ -48,15 +49,27 @@ private void initOwn() {
inner.add(GuiElements.createSpacerV(20));

final IIntegerable<String> start = SizeIntegerables.of("StartPoint",
container.validStarts.size(), e -> container.validStarts.get(e).toShortString());
container.validStarts.size(), e -> {
if (e == -1)
return "Disabled";
return container.validStarts.get(e).toShortString();
});
final IIntegerable<String> end = SizeIntegerables.of("EndPoint",
container.validStarts.size(), e -> container.validEnds.get(e).toShortString());
container.validStarts.size(), e -> {
if (e == -1)
return "Disabled";
return container.validEnds.get(e).toShortString();
});

if (!container.validStarts.isEmpty()) {
inner.add(GuiElements.createEnumElement(start, e -> {
inner.add(GuiElements.createEnumElement(new DisableIntegerable<>(start), e -> {
if (e == -1) {
container.start = new Point(-1, -1);
return;
}
container.start = container.validStarts.get(e);
}, container.start != null ? container.start.equals(new Point()) ? 0
: container.validStarts.indexOf(container.start) : 0));
}, container.start != null ? container.start.equals(new Point(-1, -1)) ? -1
: container.validStarts.indexOf(container.start) : -1));
} else {
final UIEntity infoLabelEntity = new UIEntity();
infoLabelEntity.setInheritWidth(true);
Expand All @@ -68,10 +81,14 @@ private void initOwn() {
}

if (!container.validEnds.isEmpty()) {
inner.add(GuiElements.createEnumElement(end, e -> {
inner.add(GuiElements.createEnumElement(new DisableIntegerable<>(end), e -> {
if (e == -1) {
container.end = new Point(-1, -1);
return;
}
container.end = container.validEnds.get(e);
}, container.end != null ? container.end.equals(new Point()) ? 0
: container.validEnds.indexOf(container.end) : 0));
}, container.end != null ? container.end.equals(new Point(-1, -1)) ? -1
: container.validEnds.indexOf(container.end) : -1));
} else {
final UIEntity infoLabelEntity = new UIEntity();
infoLabelEntity.setInheritWidth(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public class PathwayRequesterTileEntity extends SyncableTileEntity
implements ILinkableTile, IChunkLoadable {

private BlockPos linkedSignalBox;
private Map.Entry<Point, Point> pathway = Maps.immutableEntry(new Point(), new Point());
private Map.Entry<Point, Point> pathway = Maps.immutableEntry(new Point(-1, -1),
new Point(-1, -1));

public PathwayRequesterTileEntity(final TileEntityInfo info) {
super(info);
Expand Down

0 comments on commit e67d9fd

Please sign in to comment.