-
Notifications
You must be signed in to change notification settings - Fork 621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wireless Crafting Terminal #5656
Wireless Crafting Terminal #5656
Conversation
838bef6
to
66080f5
Compare
8e4d2d0
to
40c9a5b
Compare
278fcc4
to
7fd4db9
Compare
when I cherry pick my commits to the latest base branch, should I switch to master or stay on fabric/1.17 ? |
@Mari023 Let me know if I should rebase your branch for you. I'd target 1.18 with this, which means -> master :) |
7fd4db9
to
306c964
Compare
|
||
void setFluidSubstitution(boolean canSubstitute); | ||
|
||
default void fixCraftingRecipes() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It came from PatternTerminalPart
I tried moving as much methods as possible from PatternTerminalPart to IPatternTerminalHost
turns out not much was possible
import appeng.menu.me.items.MEPortableCellMenu; | ||
import appeng.menu.me.items.PatternTermMenu; | ||
import appeng.menu.me.items.WirelessTermMenu; | ||
import appeng.menu.me.items.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, spotless should have fixed that.
@Nullable | ||
@Override | ||
public IGuiItemObject getGuiObject(ItemStack is, int playerInventorySlot, Level level, @Nullable BlockPos pos) { | ||
return null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment above. We should investigate and remove this after the merge
public IConfigManager getConfigManager(final ItemStack target) {// TODO maybe provide an easy way for other | ||
// Terminals to overwrite this without making | ||
// their own IWirelessTerminalHandler that | ||
// mostly copies this one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the TODO and make an issue for it? Otherwise this TODO may still be here by 2025 :D
/** | ||
* Can only be used with a host that implements {@link IEnergySource} only call once per broadcastChanges() | ||
*/ | ||
protected void updateItemPowerStatus() { | ||
if ((guiItem instanceof IEnergySource energySource)) { | ||
this.powerTicks++; | ||
if (this.powerTicks > 10) { | ||
energySource.extractAEPower(this.powerMultiplier * this.powerTicks, Actionable.MODULATE, | ||
PowerMultiplier.CONFIG); | ||
this.powerTicks = 0; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Can only be used with a host that extends {@link WirelessTerminalGuiObject} | ||
*/ | ||
protected void checkWirelessRange() { | ||
if (guiItem instanceof WirelessTerminalGuiObject wirelessTerminalGUIObject) { | ||
if (!wirelessTerminalGUIObject.rangeCheck()) { | ||
if (isServer() && this.isValidMenu()) { | ||
this.getPlayerInventory().player.sendMessage(PlayerMessages.OutOfRange.get(), Util.NIL_UUID); | ||
} | ||
|
||
this.setValidMenu(false); | ||
} else { | ||
powerMultiplier = AEConfig.instance().wireless_getDrainRate(wirelessTerminalGUIObject.getRange()); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Can only be used with a host that implements {@link IInventorySlotAware} | ||
*/ | ||
protected boolean checkGuiItemNotInSlot() { | ||
if (guiItem instanceof IInventorySlotAware iInventorySlotAware) { | ||
if (!ensureGuiItemIsInSlot(guiItem, iInventorySlotAware.getInventorySlot())) { | ||
this.setValidMenu(false); | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to find another home for this. AEBaseMenu is already a god-class, we should avoid putting this here
if (hostInterface.isInstance(guiObject)) { | ||
return hostInterface.cast(guiObject); | ||
} | ||
} | ||
|
||
if (hostInterface.isAssignableFrom(WirelessTerminalGuiObject.class)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, if you remove this here (which I think is good), why did you keep the actual WirelessTerminals
class? :D
@@ -78,8 +83,6 @@ public CraftingTermMenu(int id, final Inventory ip, final ITerminalHost host) { | |||
this.addSlot(this.outputSlot = new CraftingTermSlot(this.getPlayerInventory().player, this.getActionSource(), | |||
this.powerSource, host, craftingGridInv, craftingGridInv, this), SlotSemantic.CRAFTING_RESULT); | |||
|
|||
this.createPlayerInventorySlots(ip); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the point behind this was that the player slots were always created last (because they are in order), but I honestly don't remember why that would be important.
/** | ||
* Can only be used with a host that implements {@link IInventorySlotAware} | ||
*/ | ||
protected boolean checkGuiItemNotInSlot() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protected boolean checkGuiItemNotInSlot() { | |
protected boolean hasMenuHostItemBeenRemoved() { |
Closes #401
make a common WirelessTerminalGuiObject, there are probably differencesextending it seams to be enoughmake a common WirelessTerminalItemextending WirelessTerminalItem is enoughthe texture is made by Ridanisaurus based on the Wireless Terminal and originally used in my mod
but there is no way around this as it extends MEPortableCellMenu.It could maybe be put in a common subclass(ItemTerminalMenu, or probably even MEMonitorableMenu to account for wireless fluid terminals)has to be AEBaseMenu for InterfaceTerminalNot directly related to the Wireless Crafting Terminal: