Posted October 6, 20159 yr I am wondering the best way to loop through a Item's isEffectiveOn() Block <set> in order to manually change the mining speed. Please help with your ideas? thanks. I am currently doing.... if (isEffective(helditem, block)) { event.newSpeed = event.originalSpeed * 0.3f; } private boolean isEffective(ItemStack helditem, Block block) { if (helditem.getItem() instanceof ItemTool) { Set tooltypes = helditem.getItem().getToolClasses(helditem); Iterator<String> i = tooltypes.iterator(); while (i.hasNext()) { if (block.isToolEffective(i.next(), block.getDefaultState())) { return true; } } } return false; }
October 6, 20159 yr Author 1. following tutorials it said to do this, and I have done this due to that my tool really is a tool and I take advantage of harvest levels, tool material etc. To me this seems simpler and more compatibly friendly 2. thanks fixed that 3. I had seen and fixed that but forgot to edit this post to show it 4. this is how I learnt to iterate through sets when learning java
October 6, 20159 yr Author I just assumed using as much vanilla code as possible was best for comparability, so should I never extend ItemTool? and instead just extend Item?
October 6, 20159 yr Author ohh I see sorry, misread what you meant I have marked this one as solved but I am still having issues on the other topics you have been helping me with
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.