fixes
This commit is contained in:
parent
936154e5ce
commit
d404c1743a
16 changed files with 331 additions and 892 deletions
|
@ -1117,6 +1117,9 @@ public class Player extends User implements Executor, IPlayer
|
|||
{
|
||||
if(this.onPlayerInteract(true, pos)) {
|
||||
this.sendPacket(new SPacketBlockChange(this.entity.worldObj, pos));
|
||||
if(this.entity.getCurrentEquippedItem() != null && this.entity.getCurrentEquippedItem().isEmpty())
|
||||
this.entity.inventory.mainInventory[this.entity.inventory.currentItem] = null;
|
||||
this.entity.openContainer.detectAndSendChanges();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1277,6 +1280,9 @@ public class Player extends User implements Executor, IPlayer
|
|||
if(this.onPlayerInteract(false, pos)) {
|
||||
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.inventory.mainInventory[this.entity.inventory.currentItem] = null;
|
||||
this.entity.openContainer.detectAndSendChanges();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1333,8 +1339,7 @@ public class Player extends User implements Executor, IPlayer
|
|||
}
|
||||
|
||||
private boolean onPlayerInteract(boolean primary, BlockPos pos) {
|
||||
if(this.isAdmin() && this.entity.getCurrentEquippedItem() != null &&
|
||||
this.entity.getCurrentEquippedItem().getItem().onAction(this.entity.getCurrentEquippedItem(), this.entity, this.entity.worldObj, primary ? ItemControl.PRIMARY : ItemControl.SECONDARY, pos))
|
||||
if(this.entity.getCurrentEquippedItem() != null && this.entity.getCurrentEquippedItem().getItem().onAction(this.entity.getCurrentEquippedItem(), this.entity, this.entity.worldObj, primary ? ItemControl.PRIMARY : ItemControl.SECONDARY, pos))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -2662,9 +2667,13 @@ public class Player extends User implements Executor, IPlayer
|
|||
|
||||
case ITEM_ACTION:
|
||||
ItemStack item = this.entity.getCurrentEquippedItem();
|
||||
if(item != null)
|
||||
if(item != null) {
|
||||
item.getItem().onAction(item, this.entity, this.entity.worldObj,
|
||||
ItemControl.values()[packetIn.getAuxData() % ItemControl.values().length], null);
|
||||
if(item.isEmpty())
|
||||
this.entity.inventory.mainInventory[this.entity.inventory.currentItem] = null;
|
||||
this.entity.openContainer.detectAndSendChanges();
|
||||
}
|
||||
break;
|
||||
|
||||
case GOD:
|
||||
|
@ -2707,13 +2716,32 @@ public class Player extends User implements Executor, IPlayer
|
|||
break;
|
||||
|
||||
case REPAIR:
|
||||
if(this.isAdmin() && this.entity.getCurrentEquippedItem() != null) {
|
||||
ItemStack itemstack = this.entity.getCurrentEquippedItem();
|
||||
int diff = itemstack.getMaxStackSize() - itemstack.getSize();
|
||||
itemstack.setSize(itemstack.getMaxStackSize());
|
||||
itemstack.setRepairCost(0);
|
||||
if(itemstack.getItem().getMaxDamage() > 0)
|
||||
itemstack.setItemDamage(0);
|
||||
if(this.isAdmin()) {
|
||||
if(packetIn.getAuxData() != 0) {
|
||||
for(ItemStack stack : this.entity.inventory.mainInventory) {
|
||||
if(stack != null) {
|
||||
stack.setSize(stack.getMaxStackSize());
|
||||
stack.setRepairCost(0);
|
||||
if(stack.getItem().getMaxDamage() > 0)
|
||||
stack.setItemDamage(0);
|
||||
}
|
||||
}
|
||||
for(ItemStack stack : this.entity.inventory.armorInventory) {
|
||||
if(stack != null) {
|
||||
stack.setSize(stack.getMaxStackSize());
|
||||
stack.setRepairCost(0);
|
||||
if(stack.getItem().getMaxDamage() > 0)
|
||||
stack.setItemDamage(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(this.entity.getCurrentEquippedItem() != null) {
|
||||
ItemStack stack = this.entity.getCurrentEquippedItem();
|
||||
stack.setSize(stack.getMaxStackSize());
|
||||
stack.setRepairCost(0);
|
||||
if(stack.getItem().getMaxDamage() > 0)
|
||||
stack.setItemDamage(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue