Search in sources :

Example 46 with EntityItem

use of net.minecraft.entity.item.EntityItem in project LogisticsPipes by RS485.

the class MainProxy method dropItems.

public static EntityItem dropItems(World worldObj, ItemStack stack, int xCoord, int yCoord, int zCoord) {
    EntityItem item = new EntityItem(worldObj, xCoord, yCoord, zCoord, stack);
    worldObj.spawnEntityInWorld(item);
    return item;
}
Also used : EntityItem(net.minecraft.entity.item.EntityItem)

Example 47 with EntityItem

use of net.minecraft.entity.item.EntityItem in project LogisticsPipes by RS485.

the class FluidContainerRenderer method doRenderItem.

public void doRenderItem(ItemStack itemstack, Minecraft mc, ItemRenderType type, Object[] data) {
    useThis = false;
    if (renderItem == null) {
        renderItem = new RenderItem() {

            @Override
            public boolean shouldBob() {
                return false;
            }

            ;

            @Override
            public boolean shouldSpreadItems() {
                return false;
            }

            ;
        };
        renderItem.setRenderManager(RenderManager.instance);
    }
    if (type == ItemRenderType.INVENTORY) {
        renderItem.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, itemstack, 0, 0);
    } else {
        GL11.glPushMatrix();
        dummyEntityItem.setEntityItemStack(itemstack);
        dummyEntityItem.hoverStart = 0;
        GL11.glScalef(2F, 2F, 2F);
        GL11.glRotatef(((((EntityItem) data[1]).age) / 20.0F + ((EntityItem) data[1]).hoverStart) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
        renderItem.doRender(dummyEntityItem, 0, 0, 0, 0, 0);
        GL11.glPopMatrix();
    }
    useThis = true;
}
Also used : RenderItem(net.minecraft.client.renderer.entity.RenderItem) EntityItem(net.minecraft.entity.item.EntityItem)

Example 48 with EntityItem

use of net.minecraft.entity.item.EntityItem in project LogisticsPipes by RS485.

the class FluidContainerRenderer method doRenderFluid.

public void doRenderFluid(FluidStack liquid, Minecraft mc, ItemRenderType type, Object[] data) {
    GL11.glPushMatrix();
    if (type == ItemRenderType.ENTITY) {
        GL11.glRotatef(((((EntityItem) data[1]).age) / 20.0F + ((EntityItem) data[1]).hoverStart) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
        GL11.glScaled(0.063, 0.065, 1);
        GL11.glTranslated(-8, -4, -0.02);
    }
    GL11.glDisable(GL11.GL_LIGHTING);
    ResourceLocation resourcelocation = mc.renderEngine.getResourceLocation(liquid.getFluid().getSpriteNumber());
    mc.renderEngine.bindTexture(resourcelocation);
    int i1 = liquid.getFluid().getColor();
    float f = (i1 >> 16 & 255) / 255.0F;
    float f1 = (i1 >> 8 & 255) / 255.0F;
    float f2 = (i1 & 255) / 255.0F;
    GL11.glColor4f(f, f1, f2, 1.0F);
    IIcon icon = liquid.getFluid().getIcon();
    if (icon != null) {
        renderIcon(5, 2, icon, 6, 12, 0);
        if (type == ItemRenderType.ENTITY) {
            GL11.glPopMatrix();
            GL11.glPushMatrix();
            GL11.glRotatef(((((EntityItem) data[1]).age) / 20.0F + ((EntityItem) data[1]).hoverStart) * (180F / (float) Math.PI) + 180, 0.0F, 1.0F, 0.0F);
            GL11.glScaled(0.063, 0.065, 1);
            GL11.glTranslated(-8, -4, -0.042);
            renderIcon(5, 2, icon, 6, 12, 0);
        }
    }
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
}
Also used : IIcon(net.minecraft.util.IIcon) ResourceLocation(net.minecraft.util.ResourceLocation) EntityItem(net.minecraft.entity.item.EntityItem)

Example 49 with EntityItem

use of net.minecraft.entity.item.EntityItem in project LogisticsPipes by RS485.

the class PipeTransportLogistics method dropItem.

private void dropItem(LPTravelingItemServer item) {
    if (container.getWorldObj().isRemote) {
        return;
    }
    item.setSpeed(0.05F);
    item.setContainer(container);
    EntityItem entity = item.toEntityItem();
    if (entity != null) {
        container.getWorldObj().spawnEntityInWorld(entity);
    }
}
Also used : EntityItem(net.minecraft.entity.item.EntityItem)

Example 50 with EntityItem

use of net.minecraft.entity.item.EntityItem in project LogisticsPipes by RS485.

the class ItemIdentifierInventory method dropItems.

public static void dropItems(World world, ItemStack stack, int i, int j, int k) {
    if (stack.stackSize <= 0) {
        return;
    }
    float f1 = 0.7F;
    double d = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D;
    double d1 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D;
    double d2 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D;
    EntityItem entityitem = new EntityItem(world, i + d, j + d1, k + d2, stack);
    entityitem.delayBeforeCanPickup = 10;
    world.spawnEntityInWorld(entityitem);
}
Also used : EntityItem(net.minecraft.entity.item.EntityItem)

Aggregations

EntityItem (net.minecraft.entity.item.EntityItem)284 ItemStack (net.minecraft.item.ItemStack)178 TileEntity (net.minecraft.tileentity.TileEntity)45 EntityPlayer (net.minecraft.entity.player.EntityPlayer)36 Entity (net.minecraft.entity.Entity)26 ArrayList (java.util.ArrayList)19 BlockPos (net.minecraft.util.math.BlockPos)19 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)18 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)16 World (net.minecraft.world.World)16 Random (java.util.Random)15 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)14 Item (net.minecraft.item.Item)13 IInventory (net.minecraft.inventory.IInventory)12 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)12 List (java.util.List)11 Block (net.minecraft.block.Block)11 EntityLivingBase (net.minecraft.entity.EntityLivingBase)11 IBlockState (net.minecraft.block.state.IBlockState)10 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)6