Search in sources :

Example 1 with IFrontRotation

use of com.github.technus.tectech.thing.metaTileEntity.IFrontRotation in project TecTech by Technus.

the class FrontRotationTriggerItem method onItemUseFirst.

@Override
public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) {
    TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
    if (tTileEntity == null || aPlayer instanceof FakePlayer) {
        return aPlayer instanceof EntityPlayerMP;
    }
    if (aPlayer instanceof EntityPlayerMP) {
        if (tTileEntity instanceof IGregTechTileEntity) {
            IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity();
            if (metaTE instanceof IFrontRotation) {
                ((IFrontRotation) metaTE).rotateAroundFrontPlane(!aPlayer.isSneaking());
                System.out.println("DID SHIT");
                return true;
            }
        } else if (tTileEntity instanceof IFrontRotation) {
            ((IFrontRotation) tTileEntity).rotateAroundFrontPlane(!aPlayer.isSneaking());
            return true;
        }
    }
    return false;
}
Also used : IGregTechTileEntity(gregtech.api.interfaces.tileentity.IGregTechTileEntity) IMetaTileEntity(gregtech.api.interfaces.metatileentity.IMetaTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) IGregTechTileEntity(gregtech.api.interfaces.tileentity.IGregTechTileEntity) IFrontRotation(com.github.technus.tectech.thing.metaTileEntity.IFrontRotation) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) FakePlayer(net.minecraftforge.common.util.FakePlayer) IMetaTileEntity(gregtech.api.interfaces.metatileentity.IMetaTileEntity)

Aggregations

IFrontRotation (com.github.technus.tectech.thing.metaTileEntity.IFrontRotation)1 IMetaTileEntity (gregtech.api.interfaces.metatileentity.IMetaTileEntity)1 IGregTechTileEntity (gregtech.api.interfaces.tileentity.IGregTechTileEntity)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 TileEntity (net.minecraft.tileentity.TileEntity)1 FakePlayer (net.minecraftforge.common.util.FakePlayer)1