Posted December 2, 20168 yr Hey guys, i got a few questions regarding a generator im making that uses anything that is burnable #1 how can i check say coal or charcoal was in the slot? #2 how can i make it consume that item and turn it into energy? like a coal generator lets say, and generate the amount energy i want with the value i specify
December 2, 20168 yr Author how can i check say coal or charcoal was in the slot?Coal and charcoal use the same item, just different metdata. So just check for Items.COAL without checking metadata and you will cover both. how can i make it consume that item and turn it into energy? like a coal generator lets say, and generate the amount energy i want with the value i specifyTo consume an item you can use the extractItem method on your IItemHandler . How to generate energy from that depends on how you have energy implemented in your system. In the simplest case you only have to increment an int field in your TileEntity class. Im not sure what method to use to check if the item is in that slot
December 2, 20168 yr To get an item from a slot you use IItemHandler::getStackInSlot (duh). To get an Item from an ItemStack you use ItemStack::getItem (also duh). Quick question I have seen you do this but what do the "::" mean is it the same as using "#"? VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
December 2, 20168 yr To get an item from a slot you use IItemHandler::getStackInSlot (duh). To get an Item from an ItemStack you use ItemStack::getItem (also duh). Quick question I have seen you do this but what do the "::" mean is it the same as using "#"? That is pretty much what it means. The :: is actually an operator added in Java 8 to reference methods so they can be used for various things e.g. passing a Function as a parameter of a method. Probably not the best explanation, but this is what I know of them. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
December 2, 20168 yr To get an item from a slot you use IItemHandler::getStackInSlot (duh). To get an Item from an ItemStack you use ItemStack::getItem (also duh). Quick question I have seen you do this but what do the "::" mean is it the same as using "#"? That is pretty much what it means. The :: is actually an operator added in Java 8 to reference methods so they can be used for various things e.g. passing a Function as a parameter of a method. Probably not the best explanation, but this is what I know of them. Ahh and then that prompted me to look up lambda expressions which are pretty cool. (Been meaning to do that for a while now though). Thanks. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
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.