Improvements to the usability of the number entry widgets (Priority, Level Emitter, Craft Amount): (#4737)
- Fixed tab order - Introduced focus state for corner buttons - Allowed the player to enter any text, but add validation that only persist it if it is a valid number - Enter will now confirm these dialogs and return to the previous dialog - The text field is automatically focused and its contents are selected
This commit is contained in:
@@ -65,10 +65,8 @@ import appeng.container.slot.PlayerInvSlot;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.ConfigValuePacket;
|
||||
import appeng.core.sync.packets.InventoryActionPacket;
|
||||
import appeng.core.sync.packets.TargetItemStackPacket;
|
||||
import appeng.helpers.ICustomNameObject;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.me.helpers.PlayerSource;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
@@ -86,11 +84,9 @@ public abstract class AEBaseContainer extends Container {
|
||||
private final IGuiItemObject obj;
|
||||
private final HashMap<Integer, SyncData> syncData = new HashMap<>();
|
||||
private boolean isContainerValid = true;
|
||||
private String customName;
|
||||
private ContainerLocator locator;
|
||||
private IMEInventoryHandler<IAEItemStack> cellInv;
|
||||
private IEnergySource powerSrc;
|
||||
private boolean sentCustomName;
|
||||
private int ticksSinceCheck = 900;
|
||||
private IAEItemStack clientRequestedTargetItem = null;
|
||||
|
||||
@@ -297,9 +293,7 @@ public abstract class AEBaseContainer extends Container {
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
this.sendCustomName();
|
||||
|
||||
if (Platform.isServer()) {
|
||||
if (isServer()) {
|
||||
if (this.tileEntity != null
|
||||
&& this.tileEntity.getWorld().getTileEntity(this.tileEntity.getPos()) != this.tileEntity) {
|
||||
this.setValidContainer(false);
|
||||
@@ -866,43 +860,6 @@ public abstract class AEBaseContainer extends Container {
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
private void sendCustomName() {
|
||||
// FIXME: Trash this, this is handled by NamedContainerProvider now
|
||||
if (!this.sentCustomName) {
|
||||
this.sentCustomName = true;
|
||||
if (Platform.isServer()) {
|
||||
ICustomNameObject name = null;
|
||||
|
||||
if (this.part instanceof ICustomNameObject) {
|
||||
name = (ICustomNameObject) this.part;
|
||||
}
|
||||
|
||||
if (this.tileEntity instanceof ICustomNameObject) {
|
||||
name = (ICustomNameObject) this.tileEntity;
|
||||
}
|
||||
|
||||
if (this.obj instanceof ICustomNameObject) {
|
||||
name = (ICustomNameObject) this.obj;
|
||||
}
|
||||
|
||||
if (this instanceof ICustomNameObject) {
|
||||
name = (ICustomNameObject) this;
|
||||
}
|
||||
|
||||
if (name != null) {
|
||||
if (name.hasCustomInventoryName()) {
|
||||
this.setCustomName(name.getCustomInventoryName().getString());
|
||||
}
|
||||
|
||||
if (this.getCustomName() != null) {
|
||||
NetworkHandler.instance().sendTo(new ConfigValuePacket("CustomName", this.getCustomName()),
|
||||
(ServerPlayerEntity) this.getPlayerInventory().player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void swapSlotContents(final int slotA, final int slotB) {
|
||||
final Slot a = this.getSlot(slotA);
|
||||
final Slot b = this.getSlot(slotB);
|
||||
@@ -992,14 +949,6 @@ public abstract class AEBaseContainer extends Container {
|
||||
this.cellInv = cellInv;
|
||||
}
|
||||
|
||||
public String getCustomName() {
|
||||
return this.customName;
|
||||
}
|
||||
|
||||
public void setCustomName(final String customName) {
|
||||
this.customName = customName;
|
||||
}
|
||||
|
||||
public PlayerInventory getPlayerInventory() {
|
||||
return this.invPlayer;
|
||||
}
|
||||
@@ -1028,4 +977,18 @@ public abstract class AEBaseContainer extends Container {
|
||||
this.powerSrc = powerSrc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this container instance lives on the client.
|
||||
*/
|
||||
protected boolean isClient() {
|
||||
return invPlayer.player.getEntityWorld().isRemote();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this container instance lives on the server.
|
||||
*/
|
||||
protected boolean isServer() {
|
||||
return !isClient();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user