Search in sources :

Example 1 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project BluePower by Qmunity.

the class BlockContainerBase method getIcon.

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
    if (textures == null)
        return super.getIcon(world, x, y, z, side);
    TileEntity te = get(world, x, y, z);
    RendererBlockBase.EnumFaceType faceType = EnumFaceType.SIDE;
    boolean powered = false;
    boolean ejecting = false;
    if (te instanceof IRotatable) {
        ForgeDirection rotation = ((IRotatable) te).getFacingDirection();
        if (rotation.ordinal() == side)
            faceType = EnumFaceType.FRONT;
        if (rotation.getOpposite().ordinal() == side)
            faceType = EnumFaceType.BACK;
    }
    if (te instanceof IBluePowered) {
        powered = ((IBluePowered) te).isPowered();
    }
    if (te instanceof IEjectAnimator) {
        ejecting = ((IEjectAnimator) te).isEjecting();
    }
    return getIcon(faceType, ejecting, powered, side, te);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) EnumFaceType(com.bluepowermod.client.render.RendererBlockBase.EnumFaceType) IBluePowered(com.bluepowermod.tile.IBluePowered) IRotatable(com.bluepowermod.tile.IRotatable) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) IEjectAnimator(com.bluepowermod.tile.IEjectAnimator) RendererBlockBase(com.bluepowermod.client.render.RendererBlockBase) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 2 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project BluePower by Qmunity.

the class BlockContainerBase method registerBlockIcons.

@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
    textures = new HashMap<String, IIcon>();
    for (EnumFaceType faceType : EnumFaceType.values()) {
        boolean ejecting = false;
        boolean powered = false;
        do {
            do {
                String iconName = getIconName(faceType, ejecting, powered);
                if (!textures.containsKey(iconName)) {
                    textures.put(iconName, iconRegister.registerIcon(iconName));
                }
                powered = !powered;
            } while (powered && IBluePowered.class.isAssignableFrom(getTileEntity()));
            ejecting = !ejecting;
        } while (ejecting && IEjectAnimator.class.isAssignableFrom(getTileEntity()));
    }
}
Also used : IBluePowered(com.bluepowermod.tile.IBluePowered) IIcon(net.minecraft.util.IIcon) EnumFaceType(com.bluepowermod.client.render.RendererBlockBase.EnumFaceType) IEjectAnimator(com.bluepowermod.tile.IEjectAnimator) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 3 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project BluePower by Qmunity.

the class BlockCPU method getIcon.

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
    TileCPU tile = (TileCPU) world.getTileEntity(x, y, z);
    ForgeDirection dir = tile.getFacingDirection();
    if (dir.ordinal() == side) {
        return frontTexture;
    } else if (dir.getOpposite().ordinal() == side) {
        return backTexture;
    } else if (ForgeDirection.UP.ordinal() == side) {
        return topTexture;
    } else if (ForgeDirection.DOWN.ordinal() == side) {
        return bottomTexture;
    } else {
        return sideTexture;
    }
}
Also used : TileCPU(com.bluepowermod.tile.tier3.TileCPU) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 4 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project BluePower by Qmunity.

the class BlockMonitor method getIcon.

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
    TileMonitor tile = (TileMonitor) world.getTileEntity(x, y, z);
    ForgeDirection dir = tile.getFacingDirection();
    if (dir.ordinal() == side) {
        return frontTexture;
    } else if (dir.getOpposite().ordinal() == side) {
        return backTexture;
    } else if (ForgeDirection.UP.ordinal() == side) {
        return topTexture;
    } else if (ForgeDirection.DOWN.ordinal() == side) {
        return bottomTexture;
    } else {
        return sideTexture;
    }
}
Also used : TileMonitor(com.bluepowermod.tile.tier3.TileMonitor) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 5 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project BluePower by Qmunity.

the class BlockAlloyFurnace method getIcon.

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
    TileAlloyFurnace te = (TileAlloyFurnace) world.getTileEntity(x, y, z);
    ForgeDirection forgeSide = ForgeDirection.getOrientation(side);
    if (forgeSide == ForgeDirection.UP)
        return textureTop;
    if (forgeSide == ForgeDirection.DOWN)
        return textureBottom;
    if (forgeSide == te.getFacingDirection())
        return te.getIsActive() ? textureFrontOn : textureFrontOff;
    return textureSide;
}
Also used : TileAlloyFurnace(com.bluepowermod.tile.tier1.TileAlloyFurnace) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Aggregations

SideOnly (cpw.mods.fml.relauncher.SideOnly)204 ItemStack (net.minecraft.item.ItemStack)52 IIcon (net.minecraft.util.IIcon)17 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)17 Vec3dCube (uk.co.qmunity.lib.vec.Vec3dCube)13 Block (net.minecraft.block.Block)12 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)10 TileEntity (net.minecraft.tileentity.TileEntity)10 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)9 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)8 ArrayList (java.util.ArrayList)8 Rotation (uk.co.qmunity.lib.transform.Rotation)8 AMParticle (am2.particles.AMParticle)6 IconFlipped (net.minecraft.client.renderer.IconFlipped)6 ItemBlock (net.minecraft.item.ItemBlock)6 Minecraft (net.minecraft.client.Minecraft)5 Tessellator (net.minecraft.client.renderer.Tessellator)5 EntityPlayer (net.minecraft.entity.player.EntityPlayer)5 GuiScreen (net.minecraft.client.gui.GuiScreen)4 RenderHelper (uk.co.qmunity.lib.client.render.RenderHelper)4