Search in sources :

Example 21 with BlockLocation

use of riskyken.armourersWorkshop.common.blocks.BlockLocation in project Armourers-Workshop by RiskyKen.

the class ItemShadeNoiseTool method onItemUse.

@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
    Block block = world.getBlock(x, y, z);
    if (block instanceof IPantableBlock) {
        if (!world.isRemote) {
            UndoManager.begin(player);
        }
        if ((Boolean) ToolOptions.FULL_BLOCK_MODE.readFromNBT(stack.getTagCompound())) {
            for (int i = 0; i < 6; i++) {
                usedOnBlockSide(stack, player, world, new BlockLocation(x, y, z), block, i);
            }
        } else {
            usedOnBlockSide(stack, player, world, new BlockLocation(x, y, z), block, side);
        }
        if (!world.isRemote) {
            UndoManager.end(player);
            world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, LibSounds.BURN, 1.0F, 1.0F);
        }
        return true;
    }
    if (block == ModBlocks.armourerBrain & player.isSneaking()) {
        if (!world.isRemote) {
            TileEntity te = world.getTileEntity(x, y, z);
            if (te != null && te instanceof TileEntityArmourer) {
                ((TileEntityArmourer) te).toolUsedOnArmourer(this, world, stack, player);
            }
        }
        return true;
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) MessageClientToolPaintBlock(riskyken.armourersWorkshop.common.network.messages.client.MessageClientToolPaintBlock) Block(net.minecraft.block.Block) IPantableBlock(riskyken.armourersWorkshop.api.common.painting.IPantableBlock) BlockLocation(riskyken.armourersWorkshop.common.blocks.BlockLocation) IPantableBlock(riskyken.armourersWorkshop.api.common.painting.IPantableBlock)

Aggregations

BlockLocation (riskyken.armourersWorkshop.common.blocks.BlockLocation)21 Block (net.minecraft.block.Block)14 IPantableBlock (riskyken.armourersWorkshop.api.common.painting.IPantableBlock)10 TileEntity (net.minecraft.tileentity.TileEntity)8 TileEntityArmourer (riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer)7 MessageClientToolPaintBlock (riskyken.armourersWorkshop.common.network.messages.client.MessageClientToolPaintBlock)5 ArrayList (java.util.ArrayList)4 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)3 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 NBTTagList (net.minecraft.nbt.NBTTagList)2 IPantable (riskyken.armourersWorkshop.api.common.painting.IPantable)2 BlockColourable (riskyken.armourersWorkshop.common.blocks.BlockColourable)2 BlockSkinnable (riskyken.armourersWorkshop.common.blocks.BlockSkinnable)2 PaintType (riskyken.armourersWorkshop.common.painting.PaintType)2 TileEntitySkinnable (riskyken.armourersWorkshop.common.tileentities.TileEntitySkinnable)2 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1 SideOnly (cpw.mods.fml.relauncher.SideOnly)1 Color (java.awt.Color)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ItemStack (net.minecraft.item.ItemStack)1