Fixed crash when moving a wireless item with the number keys. Fixes #1766
This commit is contained in:
@@ -49,7 +49,7 @@ public abstract class ContainerBase extends Container {
|
||||
int x = xInventory + i * 18;
|
||||
int y = yInventory + 4 + (3 * 18);
|
||||
|
||||
if (i == player.inventory.currentItem && isHeldItemDisabled()) {
|
||||
if (isHeldItemDisabled() && i == player.inventory.currentItem) {
|
||||
addSlotToContainer(new SlotDisabled(player.inventory, id, x, y));
|
||||
} else {
|
||||
addSlotToContainer(new Slot(player.inventory, id, x, y));
|
||||
@@ -71,6 +71,12 @@ public abstract class ContainerBase extends Container {
|
||||
public ItemStack slotClick(int id, int dragType, ClickType clickType, EntityPlayer player) {
|
||||
Slot slot = id >= 0 ? getSlot(id) : null;
|
||||
|
||||
// Prevent swapping disabled held item with the number keys
|
||||
// (dragType is the slot we're swapping with)
|
||||
if (isHeldItemDisabled() && clickType == ClickType.SWAP && dragType == player.inventory.currentItem) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (slot instanceof SlotFilter) {
|
||||
if (slot.getStack().getItem() == RSItems.FILTER) {
|
||||
return super.slotClick(id, dragType, clickType, player);
|
||||
|
||||
Reference in New Issue
Block a user