keybinds work

This commit is contained in:
PrototypeTrousers
2023-01-31 23:24:27 -03:00
parent d6f2ed30e5
commit a0ec9ceb51
16 changed files with 275 additions and 83 deletions
@@ -48,6 +48,7 @@ import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
import appeng.util.inv.IAEAppEngInventory;
import appeng.util.inv.InvOperation;
import baubles.api.BaublesApi;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
@@ -66,7 +67,7 @@ import java.nio.BufferOverflowException;
public class ContainerMEPortableFluidCell extends AEBaseContainer implements IAEAppEngInventory, IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<IAEFluidStack>, IUpgradeableCellContainer {
private final WirelessTerminalGuiObject wirelessTerminalGUIObject;
protected final WirelessTerminalGuiObject wirelessTerminalGUIObject;
private final IConfigManager clientCM;
private final IMEMonitor<IAEFluidStack> monitor;
@@ -129,7 +130,9 @@ public class ContainerMEPortableFluidCell extends AEBaseContainer implements IAE
if (monitorable != null) {
final int slotIndex = ((IInventorySlotAware) monitorable).getInventorySlot();
this.lockPlayerInventorySlot(slotIndex);
if (!((IInventorySlotAware) monitorable).isBaubleSlot()) {
this.lockPlayerInventorySlot(slotIndex);
}
this.slot = slotIndex;
} else {
this.slot = -1;
@@ -149,9 +152,13 @@ public class ContainerMEPortableFluidCell extends AEBaseContainer implements IAE
@Override
public void detectAndSendChanges() {
if (Platform.isServer()) {
final ItemStack currentItem = this.slot < 0 ? this.getPlayerInv().getCurrentItem() : this.getPlayerInv().getStackInSlot(this.slot);
if (this.wirelessTerminalGUIObject == null || currentItem.isEmpty()) {
final ItemStack currentItem;
if (wirelessTerminalGUIObject.isBaubleSlot()) {
currentItem = BaublesApi.getBaublesHandler(this.getPlayerInv().player).getStackInSlot(this.slot);
} else {
currentItem = this.slot < 0 ? this.getPlayerInv().getCurrentItem() : this.getPlayerInv().getStackInSlot(this.slot);
}
if (currentItem.isEmpty()) {
this.setValidContainer(false);
} else if (!this.wirelessTerminalGUIObject.getItemStack().isEmpty() && currentItem != this.wirelessTerminalGUIObject.getItemStack()) {
if (ItemStack.areItemsEqual(this.wirelessTerminalGUIObject.getItemStack(), currentItem)) {
@@ -19,36 +19,14 @@
package appeng.fluids.container;
import appeng.core.AEConfig;
import appeng.core.localization.PlayerMessages;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.util.Platform;
import net.minecraft.entity.player.InventoryPlayer;
public class ContainerWirelessFluidTerminal extends ContainerMEPortableFluidCell {
private final WirelessTerminalGuiObject wirelessTerminalGUIObject;
public ContainerWirelessFluidTerminal(final InventoryPlayer ip, final WirelessTerminalGuiObject gui) {
super(ip, gui);
this.wirelessTerminalGUIObject = gui;
}
@Override
public void detectAndSendChanges() {
if (Platform.isServer()) {
super.detectAndSendChanges();
if (!this.wirelessTerminalGUIObject.rangeCheck()) {
if (Platform.isServer() && this.isValidContainer()) {
this.getPlayerInv().player.sendMessage(PlayerMessages.OutOfRange.get());
}
this.setValidContainer(false);
} else {
this.setPowerMultiplier(AEConfig.instance().wireless_getDrainRate(this.wirelessTerminalGUIObject.getRange()));
}
}
}
}