Java Code Examples for net.minecraft.item.ItemStack#getDestroySpeed()
The following examples show how to use
net.minecraft.item.ItemStack#getDestroySpeed() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AutoToolModule.java From seppuku with GNU General Public License v3.0 | 6 votes |
private int getToolInventory(BlockPos pos) { int index = -1; float speed = 1.0f; for (int i = 9; i < 36; i++) { final ItemStack stack = Minecraft.getMinecraft().player.inventoryContainer.getSlot(i).getStack(); if (stack != null && stack != ItemStack.EMPTY) { final float digSpeed = EnchantmentHelper.getEnchantmentLevel(Enchantments.EFFICIENCY, stack); final float destroySpeed = stack.getDestroySpeed(Minecraft.getMinecraft().world.getBlockState(pos)); if ((digSpeed + destroySpeed) > speed) { speed = (digSpeed + destroySpeed); index = i; } } } return index; }
Example 2
Source File: AutoToolModule.java From seppuku with GNU General Public License v3.0 | 6 votes |
private int getToolHotbar(BlockPos pos) { int index = -1; float speed = 1.0f; for (int i = 0; i <= 9; i++) { final ItemStack stack = Minecraft.getMinecraft().player.inventory.getStackInSlot(i); if (stack != null && stack != ItemStack.EMPTY) { final float digSpeed = EnchantmentHelper.getEnchantmentLevel(Enchantments.EFFICIENCY, stack); final float destroySpeed = stack.getDestroySpeed(Minecraft.getMinecraft().world.getBlockState(pos)); if ((digSpeed + destroySpeed) > speed) { speed = (digSpeed + destroySpeed); index = i; } } } return index; }
Example 3
Source File: WItem.java From ForgeWurst with GNU General Public License v3.0 | 4 votes |
public static float getDestroySpeed(ItemStack stack, IBlockState state) { return isNullOrEmpty(stack) ? 1 : stack.getDestroySpeed(state); }
Example 4
Source File: AutoToolModule.java From seppuku with GNU General Public License v3.0 | 3 votes |
private float getDestroySpeed(IBlockState state, ItemStack stack) { float f = 1.0F; f *= stack.getDestroySpeed(state); return f; }