Search in sources :

Example 16 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project LogisticsPipes by RS485.

the class LogisticsFluidContainer method addInformation.

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
    super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
    if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
        FluidStack stack = SimpleServiceLocator.logisticsFluidManager.getFluidFromContainer(ItemIdentifierStack.getFromStack(par1ItemStack));
        if (stack != null) {
            par3List.add("Type:  " + stack.getFluid().getLocalizedName(stack));
            par3List.add("Value: " + stack.amount + "mB");
        }
    }
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 17 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project LogisticsPipes by RS485.

the class LogisticsBlockGenericPipe method addHitEffects.

/**
	 * Spawn a digging particle effect in the world, this is a wrapper around
	 * EffectRenderer.addBlockHitEffects to allow the block more control over
	 * the particles. Useful when you have entirely different texture sheets for
	 * different sides/locations in the world.
	 *
	 * @param worldObj
	 *            The current world
	 * @param target
	 *            The target the player is looking at {x/y/z/side/sub}
	 * @param effectRenderer
	 *            A reference to the current effect renderer.
	 * @return True to prevent vanilla digging particles form spawning.
	 */
@SideOnly(Side.CLIENT)
@Override
public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) {
    int x = target.blockX;
    int y = target.blockY;
    int z = target.blockZ;
    CoreUnroutedPipe pipe = LogisticsBlockGenericPipe.getPipe(worldObj, x, y, z);
    if (pipe == null) {
        return false;
    }
    IIcon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
    int sideHit = target.sideHit;
    Block block = LogisticsPipes.LogisticsPipeBlock;
    float b = 0.1F;
    double px = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (b * 2.0F)) + b + block.getBlockBoundsMinX();
    double py = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (b * 2.0F)) + b + block.getBlockBoundsMinY();
    double pz = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (b * 2.0F)) + b + block.getBlockBoundsMinZ();
    if (sideHit == 0) {
        py = y + block.getBlockBoundsMinY() - b;
    }
    if (sideHit == 1) {
        py = y + block.getBlockBoundsMaxY() + b;
    }
    if (sideHit == 2) {
        pz = z + block.getBlockBoundsMinZ() - b;
    }
    if (sideHit == 3) {
        pz = z + block.getBlockBoundsMaxZ() + b;
    }
    if (sideHit == 4) {
        px = x + block.getBlockBoundsMinX() - b;
    }
    if (sideHit == 5) {
        px = x + block.getBlockBoundsMaxX() + b;
    }
    EntityDiggingFX fx = new EntityDiggingFX(worldObj, px, py, pz, 0.0D, 0.0D, 0.0D, block, sideHit, worldObj.getBlockMetadata(x, y, z));
    fx.setParticleIcon(icon);
    effectRenderer.addEffect(fx.applyColourMultiplier(x, y, z).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
    return true;
}
Also used : EntityDiggingFX(net.minecraft.client.particle.EntityDiggingFX) IIcon(net.minecraft.util.IIcon) Block(net.minecraft.block.Block) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 18 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project LogisticsPipes by RS485.

the class LogisticsBlockGenericSubMultiBlock method getSelectedBoundingBoxFromPool.

@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
    DoubleCoordinates pos = new DoubleCoordinates(x, y, z);
    TileEntity tile = pos.getTileEntity(world);
    if (tile instanceof LogisticsTileGenericSubMultiBlock) {
        List<LogisticsTileGenericPipe> mainPipeList = ((LogisticsTileGenericSubMultiBlock) tile).getMainPipe();
        for (LogisticsTileGenericPipe mainPipe : mainPipeList) {
            if (mainPipe != null && mainPipe.pipe != null && mainPipe.pipe.isMultiBlock()) {
                if (LogisticsPipes.LogisticsPipeBlock.doRayTrace(world, mainPipe.xCoord, mainPipe.yCoord, mainPipe.zCoord, Minecraft.getMinecraft().thePlayer) != null) {
                    return LogisticsPipes.LogisticsPipeBlock.getSelectedBoundingBoxFromPool(world, mainPipe.xCoord, mainPipe.yCoord, mainPipe.zCoord);
                }
            }
        }
    }
    return super.getSelectedBoundingBoxFromPool(world, x, y, z).expand(-0.85F, -0.85F, -0.85F);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 19 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project LogisticsPipes by RS485.

the class LogisticsBlockGenericSubMultiBlock method getIcon.

@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings({ "all" })
public IIcon getIcon(IBlockAccess iblockaccess, int i, int j, int k, int l) {
    DoubleCoordinates pos = new DoubleCoordinates(i, j, k);
    TileEntity tile = pos.getTileEntity(iblockaccess);
    if (tile instanceof LogisticsTileGenericSubMultiBlock) {
        List<LogisticsTileGenericPipe> mainPipe = ((LogisticsTileGenericSubMultiBlock) tile).getMainPipe();
        if (!mainPipe.isEmpty() && mainPipe.get(0).pipe != null && mainPipe.get(0).pipe.isMultiBlock()) {
            return LogisticsPipes.LogisticsPipeBlock.getIcon(iblockaccess, mainPipe.get(0).xCoord, mainPipe.get(0).yCoord, mainPipe.get(0).zCoord, l);
        }
    }
    return null;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 20 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project LogisticsPipes by RS485.

the class LogisticsBlockGenericPipe method addDestroyEffects.

/**
	 * Spawn particles for when the block is destroyed. Due to the nature of how
	 * this is invoked, the x/y/z locations are not always guaranteed to host
	 * your block. So be sure to do proper sanity checks before assuming that
	 * the location is this block.
	 *
	 * @param worldObj
	 *            The current world
	 * @param x
	 *            X position to spawn the particle
	 * @param y
	 *            Y position to spawn the particle
	 * @param z
	 *            Z position to spawn the particle
	 * @param meta
	 *            The metadata for the block before it was destroyed.
	 * @param effectRenderer
	 *            A reference to the current effect renderer.
	 * @return True to prevent vanilla break particles from spawning.
	 */
@SideOnly(Side.CLIENT)
@Override
public boolean addDestroyEffects(World worldObj, int x, int y, int z, int meta, EffectRenderer effectRenderer) {
    CoreUnroutedPipe pipe = LogisticsBlockGenericPipe.getPipe(worldObj, x, y, z);
    if (pipe == null) {
        return false;
    }
    PlayerConfig config = LogisticsPipes.getClientPlayerConfig();
    if (config.isUseNewRenderer()) {
        LogisticsNewRenderPipe.renderDestruction(pipe, worldObj, x, y, z, effectRenderer);
    } else {
        IIcon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
        byte its = 4;
        for (int i = 0; i < its; ++i) {
            for (int j = 0; j < its; ++j) {
                for (int k = 0; k < its; ++k) {
                    if (pipe.isMultiBlock()) {
                        LPPositionSet<DoubleCoordinatesType<CoreMultiBlockPipe.SubBlockTypeForShare>> set = ((CoreMultiBlockPipe) pipe).getRotatedSubBlocks();
                        set.add(new DoubleCoordinatesType<>(0, 0, 0, CoreMultiBlockPipe.SubBlockTypeForShare.NON_SHARE));
                        for (DoubleCoordinates pos : set) {
                            int localx = x + pos.getXInt();
                            int localy = y + pos.getYInt();
                            int localz = z + pos.getZInt();
                            double px = localx + (i + 0.5D) / its;
                            double py = localy + (j + 0.5D) / its;
                            double pz = localz + (k + 0.5D) / its;
                            int random = rand.nextInt(6);
                            EntityDiggingFX fx = new EntityDiggingFX(worldObj, px, py, pz, px - localx - 0.5D, py - localy - 0.5D, pz - localz - 0.5D, LogisticsPipes.LogisticsPipeBlock, random, meta);
                            fx.setParticleIcon(icon);
                            effectRenderer.addEffect(fx.applyColourMultiplier(x, y, z));
                        }
                    } else {
                        double px = x + (i + 0.5D) / its;
                        double py = y + (j + 0.5D) / its;
                        double pz = z + (k + 0.5D) / its;
                        int random = rand.nextInt(6);
                        EntityDiggingFX fx = new EntityDiggingFX(worldObj, px, py, pz, px - x - 0.5D, py - y - 0.5D, pz - z - 0.5D, LogisticsPipes.LogisticsPipeBlock, random, meta);
                        fx.setParticleIcon(icon);
                        effectRenderer.addEffect(fx.applyColourMultiplier(x, y, z));
                    }
                }
            }
        }
    }
    return true;
}
Also used : EntityDiggingFX(net.minecraft.client.particle.EntityDiggingFX) DoubleCoordinatesType(network.rs485.logisticspipes.world.DoubleCoordinatesType) IIcon(net.minecraft.util.IIcon) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates) PlayerConfig(logisticspipes.config.PlayerConfig) 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