add item deselect
This commit is contained in:
parent
f123a599a2
commit
ac65a43bbc
20 changed files with 84 additions and 78 deletions
|
@ -24,7 +24,7 @@ public class CommandClear extends Command {
|
|||
if(entity.isPlayer())
|
||||
((EntityNPC)entity).setMouseItem(null);
|
||||
else
|
||||
((EntityNPC)entity).setHeldItem(null);
|
||||
((EntityNPC)entity).clearHeldItem();
|
||||
exec.log("Inventar von %s gelöscht", entity.getRawName());
|
||||
done++;
|
||||
}
|
||||
|
|
|
@ -1108,7 +1108,7 @@ public class Player extends User implements Executor, IPlayer
|
|||
if(this.onPlayerInteract(true, pos)) {
|
||||
this.sendPacket(new SPacketBlockChange(this.entity.worldObj, pos));
|
||||
if(this.entity.getHeldItem() != null && this.entity.getHeldItem().isEmpty())
|
||||
this.entity.setHeldItem(null);
|
||||
this.entity.clearHeldItem();
|
||||
this.entity.openContainer.detectAndSendChanges();
|
||||
return;
|
||||
}
|
||||
|
@ -1223,7 +1223,7 @@ public class Player extends User implements Executor, IPlayer
|
|||
|
||||
if (itemstack1.isEmpty())
|
||||
{
|
||||
this.entity.setHeldItem(null);
|
||||
this.entity.clearHeldItem();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1252,7 +1252,7 @@ public class Player extends User implements Executor, IPlayer
|
|||
|
||||
if (itemstack.isEmpty())
|
||||
{
|
||||
this.entity.setHeldItem(null);
|
||||
this.entity.clearHeldItem();
|
||||
}
|
||||
|
||||
if (!this.entity.isUsingItem())
|
||||
|
@ -1268,7 +1268,7 @@ public class Player extends User implements Executor, IPlayer
|
|||
this.sendPacket(new SPacketBlockChange(this.entity.worldObj, pos));
|
||||
stack.getItem().onItemUse(stack, this.entity, this.entity.worldObj, pos, side, offsetX, offsetY, offsetZ);
|
||||
if(stack.isEmpty())
|
||||
this.entity.setHeldItem(null);
|
||||
this.entity.clearHeldItem();
|
||||
this.entity.openContainer.detectAndSendChanges();
|
||||
return false;
|
||||
}
|
||||
|
@ -1950,10 +1950,13 @@ public class Player extends User implements Executor, IPlayer
|
|||
case ITEM:
|
||||
if(msg.length() > 30)
|
||||
throw new IllegalArgumentException("Ungültiger Name");
|
||||
if(packetIn.getArg() == -1)
|
||||
this.entity.inventoryContainer.renameItem(Equipment.ARMOR_SLOTS + this.entity.getSelectedIndex(), msg);
|
||||
else
|
||||
if(packetIn.getArg() == -1) {
|
||||
if(this.entity.getSelectedIndex() >= 0)
|
||||
this.entity.inventoryContainer.renameItem(Equipment.ARMOR_SLOTS + this.entity.getSelectedIndex(), msg);
|
||||
}
|
||||
else {
|
||||
this.entity.openContainer.renameItem(packetIn.getArg(), msg);
|
||||
}
|
||||
this.entity.openContainer.detectAndSendChanges();
|
||||
break;
|
||||
|
||||
|
@ -2378,12 +2381,15 @@ public class Player extends User implements Executor, IPlayer
|
|||
this.entity.connection.sendPacket(new SPacketBlockChange(worldserver, blockpos));
|
||||
this.entity.connection.sendPacket(new SPacketBlockChange(worldserver, blockpos.offset(enumfacing)));
|
||||
}
|
||||
|
||||
if(this.entity.getSelectedIndex() < 0)
|
||||
return;
|
||||
|
||||
itemstack = this.entity.getHeldItem();
|
||||
|
||||
if (itemstack != null && itemstack.isEmpty())
|
||||
{
|
||||
this.entity.setHeldItem(null);
|
||||
this.entity.clearHeldItem();
|
||||
itemstack = null;
|
||||
}
|
||||
|
||||
|
@ -2608,7 +2614,7 @@ public class Player extends User implements Executor, IPlayer
|
|||
break;
|
||||
|
||||
case SET_ITEMSLOT:
|
||||
if(packetIn.getAuxData() >= 0 && packetIn.getAuxData() < this.entity.getHotbarSize()) {
|
||||
if(packetIn.getAuxData() >= -1 && packetIn.getAuxData() < this.entity.getHotbarSize()) {
|
||||
if(packetIn.getAuxData() != this.entity.getSelectedIndex())
|
||||
this.itemUseCooldown = 0;
|
||||
this.entity.setSelectedIndex(packetIn.getAuxData());
|
||||
|
@ -2657,7 +2663,7 @@ public class Player extends User implements Executor, IPlayer
|
|||
item.getItem().onAction(item, this.entity, this.entity.worldObj,
|
||||
ItemControl.values()[packetIn.getAuxData() % ItemControl.values().length], null);
|
||||
if(item.isEmpty())
|
||||
this.entity.setHeldItem(null);
|
||||
this.entity.clearHeldItem();
|
||||
this.entity.openContainer.detectAndSendChanges();
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue