Package net.mcft.copy.betterstorage.item

Examples of net.mcft.copy.betterstorage.item.ItemBackpack


          backpack = new ItemStack(BetterStorageItems.itemEnderBackpack);
          // Remove drop chance for the backpack.
          ((EntityLiving)entity).setEquipmentDropChance(EquipmentSlot.CHEST, 0.0F);
        } else {
          backpack = new ItemStack(BetterStorageItems.itemBackpack, 1, RandomUtils.getInt(120, 240));
          ItemBackpack backpackType = (ItemBackpack)backpack.getItem();
          if (RandomUtils.getBoolean(0.15)) {
            // Give the backpack a random color.
            int r = RandomUtils.getInt(32, 224);
            int g = RandomUtils.getInt(32, 224);
            int b = RandomUtils.getInt(32, 224);
            int color = (r << 16) | (g << 8) | b;
            StackUtils.set(backpack, color, "display", "color");
          }
          contents = new ItemStack[backpackType.getBackpackColumns() * backpackType.getBackpackRows()];
          // Set drop chance for the backpack to 100%.
          ((EntityLiving)entity).setEquipmentDropChance(EquipmentSlot.CHEST, 1.0F);
        }
       
        // If the entity spawned with enchanted armor,
View Full Code Here


    ItemStack backpack = ItemBackpack.getBackpackData(event.entityPlayer).backpack;
    if (backpack != null) {
     
      EntityPlayer player = event.entityPlayer;
      float partial = event.partialRenderTick;
      ItemBackpack backpackType = (ItemBackpack)backpack.getItem();
      int color = backpackType.getColor(backpack);
      ModelBackpackArmor model = (ModelBackpackArmor)backpackType.getArmorModel(player, backpack, 0);
     
      model.onGround = ReflectionUtils.invoke(
          RendererLivingEntity.class, event.renderer, "func_77040_d", "renderSwingProgress",
          EntityLivingBase.class, float.class, player, partial);
      model.setLivingAnimations(player, 0, 0, partial);
     
      RenderUtils.bindTexture(new ResourceLocation(backpackType.getArmorTexture(backpack, player, 0, null)));
      RenderUtils.setColorFromInt((color >= 0) ? color : 0xFFFFFF);
      model.render(player, 0, 0, 0, 0, 0, 0);
     
      if (color >= 0) {
        RenderUtils.bindTexture(new ResourceLocation(backpackType.getArmorTexture(backpack, player, 0, "overlay")));
        GL11.glColor3f(1.0F, 1.0F, 1.0F);
        model.render(player, 0, 0, 0, 0, 0, 0);
      }
     
      if (backpack.isItemEnchanted()) {
View Full Code Here

public class TileEntityBackpackRenderer extends TileEntitySpecialRenderer {
 
  public void renderTileEntityAt(TileEntityBackpack backpack, double x, double y, double z, float partialTicks) {
   
    if ((backpack.getWorldObj() == null) && (backpack.blockType == null)) return;
    ItemBackpack item = ((TileBackpack)backpack.getBlockType()).getItemType();
    ItemStack stack = ((backpack.stack != null) ? backpack.stack : new ItemStack(item));
    ModelBackpack backpackModel = item.getModel();
   
    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glTranslated(x, y + 2.0, z + 1.0);
    GL11.glScalef(1.0F, -1.0F, -1.0F);
    GL11.glTranslated(0.5, 0.5, 0.5);
   
    ForgeDirection orientation = ForgeDirection.getOrientation(backpack.getBlockMetadata());
    int rotation = DirectionUtils.getRotation(orientation);
    GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F);
   
    float angle = backpack.prevLidAngle + (backpack.lidAngle - backpack.prevLidAngle) * partialTicks;
    angle = 1.0F - angle;
    angle = 1.0F - angle * angle;
    backpackModel.setLidRotation((float)(angle * Math.PI / 4.0));
   
    int renderPasses = item.getRenderPasses(0);
    for (int pass = 0; pass < renderPasses; pass++) {
      String type = ((pass == 0) ? null : "overlay");
      bindTexture(new ResourceLocation(item.getArmorTexture(stack, null, 0, type)));
      RenderUtils.setColorFromInt(item.getColorFromItemStack(stack, pass));
      backpackModel.renderAll();
    }
   
    if ((backpack.stack != null) &&
        (backpack.stack.isItemEnchanted())) {
View Full Code Here

TOP

Related Classes of net.mcft.copy.betterstorage.item.ItemBackpack

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.