Search in sources :

Example 6 with MetaTileEntityHolder

use of gregtech.api.metatileentity.MetaTileEntityHolder in project GregTech by GregTechCE.

the class WrenchBehaviour method onItemUseFirst.

@Override
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
    if (!world.isRemote && !world.isAirBlock(pos)) {
        ItemStack stack = player.getHeldItem(hand);
        TileEntity tileEntity = world.getTileEntity(pos);
        if (tileEntity instanceof MetaTileEntityHolder)
            // machines handle wrench click manually
            return EnumActionResult.PASS;
        if (world.getBlockState(pos).getBlock().rotateBlock(world, pos, side)) {
            GTUtility.doDamageItem(stack, this.cost, false);
            return EnumActionResult.SUCCESS;
        }
    }
    return EnumActionResult.PASS;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) MetaTileEntityHolder(gregtech.api.metatileentity.MetaTileEntityHolder) ItemStack(net.minecraft.item.ItemStack)

Aggregations

MetaTileEntityHolder (gregtech.api.metatileentity.MetaTileEntityHolder)6 MetaTileEntity (gregtech.api.metatileentity.MetaTileEntity)3 ItemStack (net.minecraft.item.ItemStack)2 TileEntity (net.minecraft.tileentity.TileEntity)2 ModularUI (gregtech.api.gui.ModularUI)1 ModularUIContainer (gregtech.api.gui.impl.ModularUIContainer)1 IPipeTile (gregtech.api.pipenet.tile.IPipeTile)1 TileEntityPipeBase (gregtech.api.pipenet.tile.TileEntityPipeBase)1 BlockInfo (gregtech.api.util.BlockInfo)1 MetaTileEntityTransformer (gregtech.common.metatileentities.electric.MetaTileEntityTransformer)1 BlockFluidPipe (gregtech.common.pipelike.fluidpipe.BlockFluidPipe)1 TileEntityFluidPipeTickable (gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipeTickable)1 MultiblockShapeInfo (gregtech.integration.jei.multiblock.MultiblockShapeInfo)1 ArrayList (java.util.ArrayList)1 IProbeInfo (mcjty.theoneprobe.api.IProbeInfo)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 BlockPos (net.minecraft.util.math.BlockPos)1