mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-03-04 06:44:40 +01:00
Autocompletely
- Restocker gauge UI now suggests the address of the frog port on top of its packager
This commit is contained in:
parent
adb3de0461
commit
3d47f58daa
4 changed files with 25 additions and 5 deletions
|
@ -27,8 +27,12 @@ public class AddressEditBox extends EditBox {
|
|||
private String prevValue = "=)";
|
||||
|
||||
public AddressEditBox(Screen screen, Font pFont, int pX, int pY, int pWidth, int pHeight, boolean anchorToBottom) {
|
||||
this(screen, pFont, pX, pY, pWidth, pHeight, anchorToBottom, null);
|
||||
}
|
||||
|
||||
public AddressEditBox(Screen screen, Font pFont, int pX, int pY, int pWidth, int pHeight, boolean anchorToBottom, String localAddress) {
|
||||
super(pFont, pX, pY, pWidth, pHeight, Component.empty());
|
||||
destinationSuggestions = AddressEditBoxHelper.createSuggestions(screen, this, anchorToBottom);
|
||||
destinationSuggestions = AddressEditBoxHelper.createSuggestions(screen, this, anchorToBottom, localAddress);
|
||||
destinationSuggestions.setAllowSuggestions(true);
|
||||
destinationSuggestions.updateCommandInfo();
|
||||
mainResponder = t -> {
|
||||
|
|
|
@ -38,7 +38,7 @@ public class AddressEditBoxHelper {
|
|||
NEARBY_CLIPBOARDS.put(blockPos, new WeakReference<>(blockEntity));
|
||||
}
|
||||
|
||||
public static DestinationSuggestions createSuggestions(Screen screen, EditBox pInput, boolean anchorToBottom) {
|
||||
public static DestinationSuggestions createSuggestions(Screen screen, EditBox pInput, boolean anchorToBottom, String localAddress) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Player player = mc.player;
|
||||
List<IntAttached<String>> options = new ArrayList<>();
|
||||
|
@ -50,6 +50,11 @@ public class AddressEditBoxHelper {
|
|||
if (player == null)
|
||||
return destinationSuggestions;
|
||||
|
||||
if (localAddress != null) {
|
||||
options.add(IntAttached.with(-1, localAddress));
|
||||
alreadyAdded.add(localAddress);
|
||||
}
|
||||
|
||||
for (int i = 0; i < Inventory.INVENTORY_SIZE; i++)
|
||||
appendAddresses(options, alreadyAdded, player.getInventory()
|
||||
.getItem(i));
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.simibubi.create.content.logistics.BigItemStack;
|
|||
import com.simibubi.create.content.logistics.factoryBoard.FactoryPanelBlock.PanelSlot;
|
||||
import com.simibubi.create.content.logistics.filter.FilterItem;
|
||||
import com.simibubi.create.content.logistics.filter.FilterItemStack;
|
||||
import com.simibubi.create.content.logistics.packagePort.frogport.FrogportBlockEntity;
|
||||
import com.simibubi.create.content.logistics.packager.InventorySummary;
|
||||
import com.simibubi.create.content.logistics.packager.PackagerBlockEntity;
|
||||
import com.simibubi.create.content.logistics.packager.PackagingRequest;
|
||||
|
@ -1057,4 +1058,14 @@ public class FactoryPanelBehaviour extends FilteringBehaviour implements MenuPro
|
|||
.getName();
|
||||
}
|
||||
|
||||
public String getFrogAddress() {
|
||||
PackagerBlockEntity packager = panelBE().getRestockedPackager();
|
||||
if (packager == null)
|
||||
return null;
|
||||
if (packager.getLevel().getBlockEntity(packager.getBlockPos().above()) instanceof FrogportBlockEntity fpbe)
|
||||
if (fpbe.addressFilter != null && !fpbe.addressFilter.isBlank())
|
||||
return fpbe.addressFilter + "";
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -154,8 +154,8 @@ public class FactoryPanelScreen extends AbstractSimiScreen {
|
|||
int y = guiTop;
|
||||
|
||||
if (addressBox == null) {
|
||||
addressBox =
|
||||
new AddressEditBox(this, new NoShadowFontWrapper(font), x + 36, y + windowHeight - 51, 108, 10, false);
|
||||
String frogAddress = behaviour.getFrogAddress();
|
||||
addressBox = new AddressEditBox(this, new NoShadowFontWrapper(font), x + 36, y + windowHeight - 51, 108, 10, false, frogAddress);
|
||||
addressBox.setValue(behaviour.recipeAddress);
|
||||
addressBox.setTextColor(0x555555);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue