Search in sources :

Example 6 with ListenerIterator

use of com.builtbroken.mc.prefab.tile.listeners.ListenerIterator in project Engine by VoltzEngine-Project.

the class BlockBase method removedByPlayer.

@Override
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
    ListenerIterator it = new ListenerIterator(world, x, y, z, this, "break");
    boolean removed = false;
    while (it.hasNext()) {
        ITileEventListener next = it.next();
        if (next instanceof IBlockListener) {
            if (((IDestroyedListener) next).removedByPlayer(player, willHarvest)) {
                removed = true;
            }
        }
    }
    return super.removedByPlayer(world, player, x, y, z, willHarvest) || removed;
}
Also used : ListenerIterator(com.builtbroken.mc.prefab.tile.listeners.ListenerIterator)

Example 7 with ListenerIterator

use of com.builtbroken.mc.prefab.tile.listeners.ListenerIterator in project Engine by VoltzEngine-Project.

the class BlockBase method getIcon.

@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
    final int meta = world.getBlockMetadata(x, y, z);
    ListenerIterator it = new ListenerIterator(world, x, y, z, this, "icon");
    while (it.hasNext()) {
        ITileEventListener next = it.next();
        if (next instanceof IIconListener) {
            IIcon icon = ((IIconListener) next).getTileIcon(side, meta);
            if (icon != null) {
                return icon;
            }
        }
    }
    return getIcon(side, meta);
}
Also used : ListenerIterator(com.builtbroken.mc.prefab.tile.listeners.ListenerIterator) IIcon(net.minecraft.util.IIcon) IIconListener(com.builtbroken.mc.api.tile.listeners.client.IIconListener) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Aggregations

ListenerIterator (com.builtbroken.mc.prefab.tile.listeners.ListenerIterator)7 IJsonGenObject (com.builtbroken.mc.lib.json.imp.IJsonGenObject)2 IGuiTile (com.builtbroken.mc.api.tile.access.IGuiTile)1 ITileEventListener (com.builtbroken.mc.api.tile.listeners.ITileEventListener)1 IIconListener (com.builtbroken.mc.api.tile.listeners.client.IIconListener)1 ITileRenderListener (com.builtbroken.mc.api.tile.listeners.client.ITileRenderListener)1 IModelState (com.builtbroken.mc.client.json.imp.IModelState)1 IRenderState (com.builtbroken.mc.client.json.imp.IRenderState)1 RenderData (com.builtbroken.mc.client.json.render.RenderData)1 BlockBase (com.builtbroken.mc.framework.block.BlockBase)1 SideOnly (cpw.mods.fml.relauncher.SideOnly)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ItemStack (net.minecraft.item.ItemStack)1 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)1 ChatComponentText (net.minecraft.util.ChatComponentText)1 IIcon (net.minecraft.util.IIcon)1