Posted May 14, 20187 yr Let's suppose I have two stone blocks in the player's inventory. How can I now craft stone pressure plate without a human interaction?
May 14, 20187 yr Lets suppose you have two stone blocks, two plank blocks, a stick, and some coal. What should get crafted? Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
May 14, 20187 yr Author It should get crafted on some event. If that matters, I need it to get crafted on PlayerTickEvent when some conditions are satisfied. And the output should go to the player's inventory, preferably some empty slot in the hotbar.
May 14, 20187 yr Author So the class EntityPlayer has the field inventoryContainer. That's what you're telling me about, right? I've tried to do some manipulations with slots, however it seems that the server doesn't allow me to do that in such a way or doesn't know what I've done there. //Take 2 items from the first slot in the hotbar. Just imagine you have 2 stone blocks in your first hotbar slot ItemStack s1 = player.inventoryContainer.getSlotFromInventory(player.inventory, 0).decrStackSize(1); ItemStack s2 = player.inventoryContainer.getSlotFromInventory(player.inventory, 0).decrStackSize(1); // |1|2| //Now put obtained ItemStacks to the crafting grid. It has the following slot numbering: |3|4|. Craft result slot is number 0 player.inventoryContainer.putStackInSlot(1, s1); player.inventoryContainer.putStackInSlot(2, s2); //Finally put the result to the first hotbar slot player.inventory.addItemStackToInventory(player.inventoryContainer.getSlot(0).decrStackSize(0)); Edited May 14, 20187 yr by ZhabaKlava
May 16, 20187 yr maybe try looking at ItemBow how to consume items if they're in inventory and then just give player new item ?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.