Fixed bowls of water being hideous because they weren't going into the main hand

This commit is contained in:
Ellpeck 2016-07-20 22:31:27 +02:00
parent 4bf0fce0d2
commit a0f66373b6

View file

@ -42,6 +42,7 @@ public class ItemWaterBowl extends ItemBase{
@SubscribeEvent
public void onPlayerInteractEvent(PlayerInteractEvent event){
System.out.println("ACTIVE");
if(event.getWorld() != null){
if(ConfigBoolValues.WATER_BOWL.isEnabled()){
if(event.getItemStack() != null && event.getItemStack().getItem() == Items.BOWL){
@ -60,7 +61,10 @@ public class ItemWaterBowl extends ItemBase{
event.getItemStack().stackSize--;
ItemStack bowl = new ItemStack(InitItems.itemWaterBowl);
if(!event.getEntityPlayer().inventory.addItemStackToInventory(bowl.copy())){
if(event.getItemStack().stackSize <= 0){
event.getEntityPlayer().setHeldItem(event.getHand(), bowl);
}
else if(!event.getEntityPlayer().inventory.addItemStackToInventory(bowl.copy())){
EntityItem entityItem = new EntityItem(event.getWorld(), event.getEntityPlayer().posX, event.getEntityPlayer().posY, event.getEntityPlayer().posZ, bowl.copy());
entityItem.setPickupDelay(0);
event.getWorld().spawnEntityInWorld(entityItem);