Search in sources :

Example 1 with IEntityProof

use of blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IEntityProof in project ImmersiveEngineering by BluSunrize.

the class EventHandler method digSpeedEvent.

@SubscribeEvent()
public void digSpeedEvent(PlayerEvent.BreakSpeed event) {
    ItemStack current = event.getEntityPlayer().getHeldItem(EnumHand.MAIN_HAND);
    //Stop the combustion drill from working underwater
    if (current != null && current.getItem().equals(IEContent.itemDrill) && current.getItemDamage() == 0 && event.getEntityPlayer().isInsideOfMaterial(Material.WATER))
        if (((ItemDrill) IEContent.itemDrill).getUpgrades(current).getBoolean("waterproof"))
            event.setNewSpeed(event.getOriginalSpeed() * 5);
        else
            event.setCanceled(true);
    if (event.getState().getBlock() == IEContent.blockMetalDecoration2 && IEContent.blockMetalDecoration2.getMetaFromState(event.getState()) == BlockTypes_MetalDecoration2.RAZOR_WIRE.getMeta())
        if (!OreDictionary.itemMatches(new ItemStack(IEContent.itemTool, 1, 1), current, false))
            event.setCanceled(true);
    TileEntity te = event.getEntityPlayer().getEntityWorld().getTileEntity(event.getPos());
    if (te instanceof IEntityProof && !((IEntityProof) te).canEntityDestroy(event.getEntityPlayer()))
        event.setCanceled(true);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IEntityProof(blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IEntityProof) ItemStack(net.minecraft.item.ItemStack) ItemDrill(blusunrize.immersiveengineering.common.items.ItemDrill) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

IEntityProof (blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IEntityProof)1 ItemDrill (blusunrize.immersiveengineering.common.items.ItemDrill)1 ItemStack (net.minecraft.item.ItemStack)1 TileEntity (net.minecraft.tileentity.TileEntity)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1