use of net.minecraft.item.ItemSpade in project Minechem by iopleke.
the class AugmentedItem method renderOverlay.
@Override
public void renderOverlay(FontRenderer fontRenderer, TextureManager textureManager, ItemStack itemStack, int left, int top, float z) {
RenderHelper.enableBlend();
RenderHelper.setOpacity(1.0F);
textureManager.bindTexture(TextureMap.locationItemsTexture);
ItemStack wrappedItemStack = getWrappedItemStack(itemStack);
if (wrappedItemStack != null) {
Item wrappedItem = wrappedItemStack.getItem();
if (wrappedItem instanceof ItemAxe) {
RenderHelper.drawTexturedRectUV(left, top, z + 10, 16, 16, augmentIcon[AXEICON]);
} else if (wrappedItem instanceof ItemHoe) {
RenderHelper.drawTexturedRectUV(left, top, z + 10, 16, 16, augmentIcon[HOEICON]);
} else if (wrappedItem instanceof ItemPickaxe) {
RenderHelper.drawTexturedRectUV(left, top, z + 10, 16, 16, augmentIcon[PICKICON]);
} else if (wrappedItem instanceof ItemSpade) {
RenderHelper.drawTexturedRectUV(left, top, z + 10, 16, 16, augmentIcon[SHOVELICON]);
} else if (wrappedItem instanceof ItemSword) {
RenderHelper.drawTexturedRectUV(left, top, z + 10, 16, 16, augmentIcon[SWORDICON]);
} else {
RenderHelper.drawTexturedRectUV(left, top, z + 10, 16, 16, augmentIcon[DEFAULTICON]);
}
}
RenderHelper.resetOpacity();
RenderHelper.disableBlend();
}
use of net.minecraft.item.ItemSpade in project NetherEx by LogicTechCorp.
the class EventHandler method onPlayerRightClickBlock.
@SubscribeEvent
public static void onPlayerRightClickBlock(PlayerInteractEvent.RightClickBlock event) {
World world = event.getWorld();
BlockPos pos = event.getPos();
EntityPlayer player = event.getEntityPlayer();
ItemStack stack = event.getItemStack();
if (stack.getItem() == NetherExItems.TOOL_SHOVEL_BONE || ConfigHandler.block.netherrack.allowAllShovelsToFlatten && stack.getItem() instanceof ItemHoe) {
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
if (block == Blocks.NETHERRACK || block == NetherExBlocks.BLOCK_NETHERRACK || block == NetherExBlocks.BLOCK_HYPHAE) {
for (EnumHand hand : EnumHand.values()) {
if (player.getHeldItem(hand).getItem() instanceof ItemSpade) {
player.swingArm(hand);
}
}
int meta = block == Blocks.NETHERRACK ? 0 : block == NetherExBlocks.BLOCK_HYPHAE ? 3 : NetherExBlocks.BLOCK_NETHERRACK.getMetaFromState(state) + 1;
world.playSound(player, pos, SoundEvents.ITEM_SHOVEL_FLATTEN, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.setBlockState(pos, NetherExBlocks.BLOCK_NETHERRACK_PATH.getDefaultState().withProperty(BlockNetherrackPath.TYPE, BlockNetherrackPath.EnumType.fromMeta(meta)), 11);
stack.damageItem(1, player);
}
}
if (stack.getItem() == NetherExItems.TOOL_HOE_BONE || ConfigHandler.block.soulSand.allowAllHoesToTill && stack.getItem() instanceof ItemHoe) {
if (world.getBlockState(pos).getBlock() == Blocks.SOUL_SAND) {
for (EnumHand hand : EnumHand.values()) {
if (player.getHeldItem(hand).getItem() instanceof ItemHoe) {
player.swingArm(hand);
}
}
world.playSound(player, pos, SoundEvents.ITEM_HOE_TILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.setBlockState(pos, NetherExBlocks.BLOCK_SAND_SOUL_TILLED.getDefaultState(), 11);
stack.damageItem(1, player);
}
}
}
Aggregations