private static int getFuelTime(ItemStack stack) {
   if (stack == null) return 0;
   if (stack.getItem() == Item.getItemFromBlock(Blocks.packed_ice)) return 3000;
   if (stack.getItem() == Item.getItemFromBlock(Blocks.ice)) return 2000;
   if (stack.getItem() == FurnitureItems.itemCoolPack) return 400;
   return 0;
 }
  private void stageReturnWood() {
    theFolk.isWorking = false;

    if (step == 1) {
      theFolk.statusText = "Delivering wood back to base";
      theFolk.gotoXYZ(theFolk.employedAt, null);
      step = 2;
    } else if (step == 2) {
      if (theFolk.gotoMethod == GotoMethod.WALK) {
        theFolk.updateLocationFromEntity();
      }

      int dist = theFolk.location.getDistanceTo(theFolk.employedAt);

      if (dist <= 1) {
        step = 3;
      } else {
        if (theFolk.destination == null && theFolk.theEntity != null) {
          // step=1;
        }
      }
    } else if (step == 3) {
      theFolk.stayPut = true;
      int count = getInventoryCount(theFolk, Item.getItemFromBlock(Blocks.log));
      millChests = inventoriesFindClosest(theFolk.employedAt, 6);
      inventoriesTransferFromFolk(
          theFolk.inventory, millChests, new ItemStack(Item.getItemFromBlock(Blocks.log)));
      pay = (float) count * 0.03f;
      SimukraftReloaded.states.credits -= pay;
      SimukraftReloaded.sendChat(
          theFolk.name + " has delivered " + count + " logs at the lumbermill");
      theStage = Stage.SCANFORTREE;
      step = 1;
    }
  }
  @Override
  public void parentBlockHarvestItem(
      World world,
      IvTileEntityMultiBlock tileEntity,
      int x,
      int y,
      int z,
      Block block,
      int metadata) {
    if (tileEntity instanceof TileEntityStatue) {
      Entity statueEntity = ((TileEntityStatue) tileEntity).getStatueEntity();

      if (statueEntity != null) {
        Item item = null;

        if (statueMaterial == 0) item = Item.getItemFromBlock(YGCBlocks.statueStone);
        else if (statueMaterial == 1) item = Item.getItemFromBlock(YGCBlocks.statuePlanks);
        else if (statueMaterial == 2) item = Item.getItemFromBlock(YGCBlocks.statueGold);

        if (item != null) {
          ItemStack stack = new ItemStack(item);
          ItemStatue.setStatueEntity(stack, statueEntity);

          dropBlockAsItem(world, x, y, z, stack);
        }
      }
    }
  }
  @Override
  public int getItemBurnTime(ItemStack p_145952_0_) {
    if (p_145952_0_ == null) {
      return 0;
    } else {
      Item item = p_145952_0_.getItem();

      if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) {
        Block block = Block.getBlockFromItem(item);

        if (block == Blocks.wooden_slab) {
          return 100;
        }

        if (block.getMaterial() == Material.wood) {
          return 200;
        }

        if (block == Blocks.coal_block) {
          return 8000;
        }
      }
      if (item == Items.stick) return 75;
      if (item == Items.coal) return 800;
      if (item == Item.getItemFromBlock(Blocks.sapling)) return 100;
      if (item == Item.getItemFromBlock(ZombieModpackWorld.zombieFlesh)) {
        return 700;
      }
      return 0;
    }
  }
 @Override
 @SideOnly(Side.CLIENT)
 public Item getItem(World par1World, int par2, int par3, int par4) {
   return isBlockSingleSlab(this)
       ? Item.getItemFromBlock(this)
       : (this == BlockRegistry.chocoSmoothSandStoneSlabdouble
           ? Item.getItemFromBlock(BlockRegistry.chocoSmoothSandStoneSlabsingle)
           : Item.getItemFromBlock(BlockRegistry.chocoSmoothSandStoneSlabsingle));
 }
Example #6
0
  @Override
  public void preInit() {
    super.preInit();

    EventUtil.register(ClientTimerHandler.INSTANCE, EventUtil.Type.BOTH);

    File file = new File(Subsistence.configPath + "foliage.json");
    if (file.exists()) {
      FoliageHandler.initialize(file);
    } else {
      FoliageHandler.initialize(null);
    }

    AdvancedModelLoader.registerModelHandler(new FixedTechneModelLoader());

    // TILE
    ClientRegistry.bindTileEntitySpecialRenderer(TileTable.class, new RenderTileTable());
    ClientRegistry.bindTileEntitySpecialRenderer(TileSieveTable.class, new RenderTileSieveTable());
    ClientRegistry.bindTileEntitySpecialRenderer(
        TileSinteringOven.class, new RenderTileSinteringOven());
    ClientRegistry.bindTileEntitySpecialRenderer(TileHammerMill.class, new RenderTileHammerMill());
    ClientRegistry.bindTileEntitySpecialRenderer(TileHandCrank.class, new RenderTileCrank());
    ClientRegistry.bindTileEntitySpecialRenderer(
        TileKineticCrank.class, new RenderTileKineticCrank());
    ClientRegistry.bindTileEntitySpecialRenderer(TileWaterMill.class, new RenderTileWaterMill());
    ClientRegistry.bindTileEntitySpecialRenderer(TileKiln.class, new RenderTileKiln());
    ClientRegistry.bindTileEntitySpecialRenderer(TileMetalPress.class, new RenderTileMetalPress());
    ClientRegistry.bindTileEntitySpecialRenderer(
        TileSpawnMarker.class, new RenderTileSpawnMarker());
    ClientRegistry.bindTileEntitySpecialRenderer(TileMetalShaft.class, new RenderTileMetalShaft());
    ClientRegistry.bindTileEntitySpecialRenderer(TileCompost.class, new RenderTileCompost());
    ClientRegistry.bindTileEntitySpecialRenderer(TileBarrel.class, new RenderTileBarrel());

    // ITEM
    MinecraftForgeClient.registerItemRenderer(
        Item.getItemFromBlock(SubsistenceBlocks.table), new RenderItemTable());
    MinecraftForgeClient.registerItemRenderer(
        Item.getItemFromBlock(SubsistenceBlocks.tableSieve), new RenderItemSieveTable());
    MinecraftForgeClient.registerItemRenderer(
        Item.getItemFromBlock(SubsistenceBlocks.sinteringOven), new RenderItemSinteringOven());
    MinecraftForgeClient.registerItemRenderer(
        Item.getItemFromBlock(SubsistenceBlocks.hammerMill), new RenderItemHammerMill());
    MinecraftForgeClient.registerItemRenderer(
        Item.getItemFromBlock(SubsistenceBlocks.kineticCrank), new RenderItemKineticCrank());
    MinecraftForgeClient.registerItemRenderer(
        Item.getItemFromBlock(SubsistenceBlocks.kiln), new RenderItemKiln());
    MinecraftForgeClient.registerItemRenderer(
        Item.getItemFromBlock(SubsistenceBlocks.metalPress), new RenderItemMetalPress());
    MinecraftForgeClient.registerItemRenderer(
        Item.getItemFromBlock(SubsistenceBlocks.spawnMarker), new RenderItemSpawnMarker());
    MinecraftForgeClient.registerItemRenderer(
        Item.getItemFromBlock(SubsistenceBlocks.compost), new RenderItemCompost());
    MinecraftForgeClient.registerItemRenderer(
        Item.getItemFromBlock(SubsistenceBlocks.barrel), new RenderItemBarrel());
    MinecraftForgeClient.registerItemRenderer(
        SubsistenceItems.barrelLid, new RenderItemBarrelLid());
  }
  @SubscribeEvent
  public void notifyPickup(PlayerEvent.ItemSmeltedEvent event) {

    // Analyzer Achievements
    if (Revival.isDNA(event.smelting.getItem())) {
      event.player.addStat(FossilAchievementHandler.dinoDna, 1);
    }
    if (event.smelting.getItem() == FAItemRegistry.stoneboard) {
      event.player.addStat(FossilAchievementHandler.tablet, 1);
    }
    if (event.smelting.getItem() == FAItemRegistry.fossilSeed
        || event.smelting.getItem() == FAItemRegistry.fossilSeed_fern) {
      event.player.addStat(FossilAchievementHandler.fossilSeeds, 1);
    }
    if (event.smelting.getItem() == FAItemRegistry.failuresaurusFlesh) {
      event.player.addStat(FossilAchievementHandler.failuresaurusAnalyzer, 1);
    }

    // Cultivator Achievements
    if (EnumDinoType.isDinoEgg(event.smelting.getItem())) {
      event.player.addStat(FossilAchievementHandler.dinoEgg, 1);
    }
    if (event.smelting.getItem() == FAItemRegistry.embryoCow
        || event.smelting.getItem() == FAItemRegistry.embryoElasmotherium
        || event.smelting.getItem() == FAItemRegistry.embryoHorse
        || event.smelting.getItem() == FAItemRegistry.embryoMammoth
        || event.smelting.getItem() == FAItemRegistry.embryoPig
        || event.smelting.getItem() == FAItemRegistry.embryoQuagga
        || event.smelting.getItem() == FAItemRegistry.embryoSheep
        || event.smelting.getItem() == FAItemRegistry.embryoSmilodon) {
      event.player.addStat(FossilAchievementHandler.mammalEmbryo, 1);
    }

    if (event.smelting.getItem() == FAItemRegistry.cultivatedChickenEgg
        || event.smelting.getItem() == FAItemRegistry.cultivatedConfuciusornisEgg
        || event.smelting.getItem() == FAItemRegistry.cultivatedDodoEgg
        || event.smelting.getItem() == FAItemRegistry.cultivatedTerrorBirdEgg) {
      event.player.addStat(FossilAchievementHandler.birdEgg, 1);
    }

    // Workbench Achievements
    if (event.smelting.getItem() == FAItemRegistry.ancientSword) {
      event.player.addStat(FossilAchievementHandler.fixedSword, 1);
    }
    if (event.smelting.getItem() == FAItemRegistry.ancienthelmet) {
      event.player.addStat(FossilAchievementHandler.fixedHelmet, 1);
    }
    if (event.smelting.getItem() == Item.getItemFromBlock(FABlockRegistry.vaseAmphoraBlock)
        || event.smelting.getItem() == Item.getItemFromBlock(FABlockRegistry.vaseKylixBlock)
        || event.smelting.getItem() == Item.getItemFromBlock(FABlockRegistry.vaseVoluteBlock)) {
      event.player.addStat(FossilAchievementHandler.fixedVase, 1);
    }
  }
Example #8
0
  @Override
  public void postInit(FMLPostInitializationEvent event) {
    super.postInit(event);

    MinecraftForgeClient.registerItemRenderer(Objects.itemLens, new ItemRendererMultiPass());
    MinecraftForgeClient.registerItemRenderer(
        Objects.itemColorConfigurator, new ItemRendererMultiPass());
    MinecraftForgeClient.registerItemRenderer(
        Item.getItemFromBlock(Objects.blockLight), new ItemRendererBlockLight());
    MinecraftForgeClient.registerItemRenderer(
        Item.getItemFromBlock(Objects.blockColoredLamp), new ItemRendererBlockColoredLamp());
  }
 @Override
 public void registerItemBlockTexture(
     Block block, String blockclassname, String subtype, int meta) {
   Minecraft.getMinecraft()
       .getRenderItem()
       .getItemModelMesher()
       .register(
           Item.getItemFromBlock(block),
           meta,
           new ModelResourceLocation(
               "vintagecraft:" + blockclassname + "/" + subtype, "inventory"));
   ModelBakery.addVariantName(
       Item.getItemFromBlock(block), "vintagecraft:" + blockclassname + "/" + subtype);
 }
  public void onCrafting(EntityPlayer player, ItemStack stack) {
    stack.onCrafting(player.worldObj, player, stack.stackSize);

    if (stack.getItem() == Item.getItemFromBlock(Blocks.crafting_table)) {
      player.addStat(AchievementList.buildWorkBench, 1);
    }

    if (stack.getItem() instanceof ItemPickaxe) {
      player.addStat(AchievementList.buildPickaxe, 1);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.furnace)) {
      player.addStat(AchievementList.buildFurnace, 1);
    }

    if (stack.getItem() instanceof ItemHoe) {
      player.addStat(AchievementList.buildHoe, 1);
    }

    if (stack.getItem() == Items.bread) {
      player.addStat(AchievementList.makeBread, 1);
    }

    if (stack.getItem() == Items.cake) {
      player.addStat(AchievementList.bakeCake, 1);
    }

    if (stack.getItem() instanceof ItemPickaxe
        && ((ItemPickaxe) stack.getItem()).func_150913_i() != Item.ToolMaterial.WOOD) {
      player.addStat(AchievementList.buildBetterPickaxe, 1);
    }

    if (stack.getItem() instanceof ItemSword) {
      player.addStat(AchievementList.buildSword, 1);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.enchanting_table)) {
      player.addStat(AchievementList.enchantments, 1);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.bookshelf)) {
      player.addStat(AchievementList.bookcase, 1);
    }

    if (stack.getItem() == Item.getItemFromBlock(CraftingPillars.blockCraftingPillar)) {
      player.addStat(CraftingPillars.achievementRecursion, 1);
      System.out.println("achivement recursion");
    }
  }
 @Override
 public void setInventorySlotContents(int i, ItemStack stack) {
   if (i == 0
       && stack != null
       && (stack.getItem() == ModItems.draconicIngot
           || stack.getItem() == Item.getItemFromBlock(ModBlocks.draconicBlock)
           || (stack.getItem() == ModItems.nugget && stack.getItemDamage() == 1))) {
     if (stack.getItem() == ModItems.nugget) reactor.reactorFuel += stack.stackSize * 16;
     if (stack.getItem() == ModItems.draconicIngot)
       reactor.reactorFuel += stack.stackSize * 144;
     if (stack.getItem() == Item.getItemFromBlock(ModBlocks.draconicBlock))
       reactor.reactorFuel += stack.stackSize * 1296;
     reactor.validateStructure();
   } else getStorage()[i] = stack;
 }
Example #12
0
  // Sticky jars
  private static void registerDefaultStickyJars() {
    registerStickyJar(ConfigItems.itemJarFilled, 0);
    registerStickyJar(ConfigItems.itemJarFilled, 3);

    Item itemBlockJar = Item.getItemFromBlock(ConfigBlocks.blockJar);
    registerStickyJar(itemBlockJar, 0, new ItemStack(itemBlockJar, 1, 0), "JARLABEL");
    registerStickyJar(itemBlockJar, 3, new ItemStack(itemBlockJar, 1, 3), "JARVOID");

    Item itemRemoteJar = Item.getItemFromBlock(RegisteredBlocks.blockRemoteJar);
    registerStickyJar(
        itemRemoteJar,
        0,
        new ItemStack(itemRemoteJar),
        SimpleResearchItem.getFullName("REMOTEJAR"));
  }
  @Override
  public List<String> handleTextData(
      ItemStack stack,
      World world,
      EntityPlayer player,
      MovingObjectPosition mop,
      List<String> currenttip,
      ItemInfo.Layout layout) {
    if (stack.getItem() == Item.getItemFromBlock(GCBlocks.fluidTank)) {
      if (layout == ItemInfo.Layout.BODY) {
        TileEntity tile = world.getTileEntity(mop.getBlockPos());
        if (tile instanceof TileEntityFluidTank) {
          TileEntityFluidTank tank = (TileEntityFluidTank) tile;
          FluidTankInfo[] infos = tank.getTankInfo(EnumFacing.DOWN);
          if (infos.length == 1) {
            FluidTankInfo info = infos[0];
            currenttip.add(info.fluid != null ? info.fluid.getLocalizedName() : "Empty");
            currenttip.add((info.fluid != null ? info.fluid.amount : 0) + " / " + info.capacity);
          }
        }
      }
    } else if (stack.getItem() == Item.getItemFromBlock(GCBlocks.oxygenPipe)
        || stack.getItem() == Item.getItemFromBlock(GCBlocks.oxygenPipePull)) {
      if (layout == ItemInfo.Layout.BODY) {
        TileEntity tile = world.getTileEntity(mop.getBlockPos());
        if (tile instanceof TileEntityFluidPipe) {
          TileEntityFluidPipe pipe = (TileEntityFluidPipe) tile;
          currenttip.add(((BlockFluidPipe) pipe.getBlockType()).getMode().toString());
          if (pipe.hasNetwork()) {
            FluidNetwork network = ((FluidNetwork) pipe.getNetwork());
            currenttip.add(
                "Network: "
                    + (network.buffer != null ? network.buffer.amount : 0)
                    + " / "
                    + network.getCapacity());
          } else {
            currenttip.add(
                "Pipe: "
                    + (pipe.getBuffer() != null
                        ? pipe.getBuffer().amount + " / " + pipe.buffer.getCapacity()
                        : "None"));
          }
        }
      }
    }

    return currenttip;
  }
 @Override
 protected void drawSlot(int id, int x, int y, int var4, int var5, int var6) {
   Block block = blocks.get(id);
   ItemStack itemStack = new ItemStack(Item.getItemFromBlock(block));
   GlStateManager.enableRescaleNormal();
   GlStateManager.enableBlend();
   RenderHelper.enableGUIStandardItemLighting();
   GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
   if (itemStack.getItem() != null)
     try {
       Minecraft.getMinecraft()
           .getRenderItem()
           .renderItemAndEffectIntoGUI(itemStack, x + 4, y + 4);
     } catch (Exception e) {
       e.printStackTrace();
     }
   else mc.fontRendererObj.drawString("?", x + 10, y + 9, 10526880);
   Minecraft.getMinecraft()
       .getRenderItem()
       .func_175030_a(Minecraft.getMinecraft().fontRendererObj, itemStack, x + 4, y + 4);
   RenderHelper.disableStandardItemLighting();
   GlStateManager.disableRescaleNormal();
   GlStateManager.disableBlend();
   glDisable(GL_LIGHTING);
   mc.fontRendererObj.drawString(
       "Name: "
           + (itemStack.getItem() == null ? block.getLocalizedName() : itemStack.getDisplayName()),
       x + 31,
       y + 3,
       10526880);
   int blockID = Block.getIdFromBlock(block);
   mc.fontRendererObj.drawString("ID: " + blockID, x + 31, y + 15, 10526880);
 }
Example #15
0
  private static void func_151181_c() {
    Iterator var0 = Block.blockRegistry.iterator();

    while (var0.hasNext()) {
      Block var1 = (Block) var0.next();
      Item var2 = Item.getItemFromBlock(var1);

      if (var2 != null) {
        int var3 = Block.getIdFromBlock(var1);
        String var4 = func_180204_a(var2);

        if (var4 != null && var1.getEnableStats()) {
          mineBlockStatArray[var3] =
              (new StatCrafting(
                      "stat.mineBlock.",
                      var4,
                      new ChatComponentTranslation(
                          "stat.mineBlock",
                          new Object[] {(new ItemStack(var1)).getChatComponent()}),
                      var2))
                  .registerStat();
          objectMineStats.add((StatCrafting) mineBlockStatArray[var3]);
        }
      }
    }

    replaceAllSimilarBlocks(mineBlockStatArray);
  }
 public void setItemName(int metadata, String name) {
   Item item = Item.getItemFromBlock(this);
   if (item != null) {
     ((ItemBlockBase) item)
         .setMetaName(metadata, (new StringBuilder()).append("tile.").append(name).toString());
   }
 }
Example #17
0
 @Override
 public void registrarRender() {
   ClientRegistry.bindTileEntitySpecialRenderer(
       TileEntityBlocoAnimal.class, new TileEntityAnimalRenderer());
   MinecraftForgeClient.registerItemRenderer(
       Item.getItemFromBlock(AnimalMagic.blocoAnimal), new ItemBlocoAnimalRenderer());
 }
Example #18
0
  @EventHandler
  public void init(FMLInitializationEvent event) {
    MinecraftForge.EVENT_BUS.register(new ExampleTurtleMod());
    MinecraftForge.EVENT_BUS.register(new TurtleTips());
    MinecraftForge.EVENT_BUS.register(new TurtleChatMod());

    if (event.getSide() == Side.CLIENT) {
      RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
      renderItem
          .getItemModelMesher()
          .register(
              PurpleSword.instance,
              0,
              new ModelResourceLocation(MODID + ":" + PurpleSword.instance.name, "inventory"));
      renderItem
          .getItemModelMesher()
          .register(
              Item.getItemFromBlock(PurpleBlock.instance),
              0,
              new ModelResourceLocation(MODID + ":" + PurpleBlock.instance.name, "inventory"));
    }

    // Register all the devoxx4kids mods
    MinecraftForge.EVENT_BUS.register(new ArrowShotgun());
    MinecraftForge.EVENT_BUS.register(new ChatItems());
    MinecraftForge.EVENT_BUS.register(new CreeperSpawnAlert());
    MinecraftForge.EVENT_BUS.register(new DragonSpawner());
    MinecraftForge.EVENT_BUS.register(new EnchantmentArrowFast());
    MinecraftForge.EVENT_BUS.register(new OverpoweredIronGolems());
    MinecraftForge.EVENT_BUS.register(new RainWater());
    MinecraftForge.EVENT_BUS.register(new SharpSnowballs());
    MinecraftForge.EVENT_BUS.register(new SkeletonWar());
    MinecraftForge.EVENT_BUS.register(new WallClimber());
    FMLCommonHandler.instance().bus().register(new WallClimber());
  }
 public int getItemBurnTime(ItemStack itemstack) {
   if (itemstack == null) {
     return 0;
   } else {
     Item item = itemstack.getItem();
     if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) {
       Block block = Block.getBlockFromItem(item);
       if (block == Blocks.wooden_slab) {
         return 8000 / NuclearCraft.crusherCrushEfficiency;
       }
       if (block.getMaterial() == Material.wood) {
         return 16000 / NuclearCraft.crusherCrushEfficiency;
       }
       if (block == Blocks.coal_block) {
         return 960000 / NuclearCraft.crusherCrushEfficiency;
       }
     }
     if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD"))
       return 8000 / NuclearCraft.crusherCrushEfficiency;
     if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD"))
       return 8000 / NuclearCraft.crusherCrushEfficiency;
     if (item instanceof ItemHoe && ((ItemHoe) item).getToolMaterialName().equals("WOOD"))
       return 8000 / NuclearCraft.crusherCrushEfficiency;
     if (item == Items.stick) return 4000 / NuclearCraft.crusherCrushEfficiency;
     if (item == Items.coal) return 96000 / NuclearCraft.crusherCrushEfficiency;
     if (item == Items.lava_bucket) return 1200000 / NuclearCraft.crusherCrushEfficiency;
     if (item == Item.getItemFromBlock(Blocks.sapling))
       return 4000 / NuclearCraft.crusherCrushEfficiency;
     if (item == Items.blaze_rod) return 144000 / NuclearCraft.crusherCrushEfficiency;
     return (GameRegistry.getFuelValue(itemstack) * 48) / NuclearCraft.crusherCrushEfficiency;
   }
 }
 /** ********** STUFF ********** */
 @Override
 @SideOnly(Side.CLIENT)
 public void getSubBlocks(Item item, CreativeTabs tab, List list) {
   if (item != Item.getItemFromBlock(BlockRegistry.chocoSmoothSandStoneSlabdouble)) {
     list.add(new ItemStack(item, 1, 0));
   }
 }
  // tileEntity
  public boolean onBlockActivated(
      World par1World,
      int par2,
      int par3,
      int par4,
      EntityPlayer par5EntityPlayer,
      int par6,
      float par7,
      float par8,
      float par9) {
    ItemStack item = par5EntityPlayer.inventory.getCurrentItem();

    if (par1World.getBlockMetadata(par2, par3, par4) == 0) {
      if (item == null) {
        return false;
      } else if (this.checkFoodstaff(item) && this.getUnderMaterial(par1World, par2, par3, par4)) {
        this.setFoodstaff(par1World, par2, par3, par4, par5EntityPlayer, item);
        this.updateTeaapn(par1World, par2, par3, par4);
        return true;
      } else {
        return false;
      }
    } else if (item == null) {
      this.getFoodPlate(par1World, par2, par3, par4, par5EntityPlayer);
      return true;
    } else if (item.getItem() == Item.getItemFromBlock(DCsAppleMilk.foodPlate)) {
      this.getFoodPlate(par1World, par2, par3, par4, par5EntityPlayer);
      this.updateTeaapn(par1World, par2, par3, par4);
      return true;
    } else {
      return false;
    }
  }
  @SideOnly(Side.CLIENT)
  @Override
  public void renderHUD(Minecraft mc, ScaledResolution res) {
    super.renderHUD(mc, res);

    IBlockState filter = getUnderlyingBlock();
    ItemStack recieverStack =
        new ItemStack(
            Item.getItemFromBlock(filter.getBlock()),
            1,
            filter.getBlock().getMetaFromState(filter));
    int color = getColor();

    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    if (recieverStack.getItem() != null) {
      String stackName = recieverStack.getDisplayName();
      int width = 16 + mc.fontRendererObj.getStringWidth(stackName) / 2;
      int x = res.getScaledWidth() / 2 - width;
      int y = res.getScaledHeight() / 2 + 30;

      mc.fontRendererObj.drawStringWithShadow(stackName, x + 20, y + 5, color);
      RenderHelper.enableGUIStandardItemLighting();
      mc.getRenderItem().renderItemAndEffectIntoGUI(recieverStack, x, y);
      RenderHelper.disableStandardItemLighting();
    }

    GlStateManager.disableLighting();
    GlStateManager.disableBlend();
  }
  @Mod.EventHandler
  public void remap(FMLMissingMappingsEvent event) {
    for (FMLMissingMappingsEvent.MissingMapping mapping : event.get()) {
      if (mapping.name.equals("BuildCraft|Silicon:null")) {
        if (mapping.type == GameRegistry.Type.ITEM) {
          mapping.remap(Item.getItemFromBlock(assemblyTableBlock));
        } else {
          mapping.remap(assemblyTableBlock);
        }
      }

      // Silicon -> Robotics migration code
      if (mapping.type == GameRegistry.Type.ITEM) {
        if (mapping.name.equals("BuildCraft|Silicon:robot")) {
          mapping.remap((Item) Item.itemRegistry.getObject("BuildCraft|Robotics:robot"));
        } else if (mapping.name.equals("BuildCraft|Silicon:redstone_board")) {
          mapping.remap((Item) Item.itemRegistry.getObject("BuildCraft|Robotics:redstone_board"));
        } else if (mapping.name.equals("BuildCraft|Silicon:requester")) {
          mapping.remap((Item) Item.itemRegistry.getObject("BuildCraft|Robotics:requester"));
        } else if (mapping.name.equals("BuildCraft|Silicon:zonePlan")) {
          mapping.remap((Item) Item.itemRegistry.getObject("BuildCraft|Robotics:zonePlan"));
        }
      } else if (mapping.type == GameRegistry.Type.BLOCK) {
        if (mapping.name.equals("BuildCraft|Silicon:requester")) {
          mapping.remap(Block.getBlockFromName("BuildCraft|Robotics:requester"));
        } else if (mapping.name.equals("BuildCraft|Silicon:zonePlan")) {
          mapping.remap(Block.getBlockFromName("BuildCraft|Robotics:zonePlan"));
        }
      }
    }
  }
 public Item getItemDropped(int i, Random rand, int il) {
   if (func_149887_c(i)) {
     return null;
   } else {
     int k = func_149890_d(i);
     return k != 3 && k != 2 ? Item.getItemFromBlock(this) : null;
   }
 }
  private boolean canPlace(ItemStack itemstack) {

    if (itemstack.getItem() == Item.getItemFromBlock(DCsIronChain.ironChain)) {
      return true;
    } else {
      return false;
    }
  }
 private boolean allowProgress(ItemStack input, ItemStack output) {
   if (input.getItem() == Items.coffeeBean && input.getItemDamage() == 3) {
     return output.getItem() == Items.coffeePowder;
   } else if (input.getItem() == Item.getItemFromBlock(net.minecraft.init.Blocks.wool)
       && input.getItemDamage() == 0) {
     return output.getItem() == net.minecraft.init.Items.string;
   } else if (input.getItem() == Item.getItemFromBlock(net.minecraft.init.Blocks.wool)
       && input.getItemDamage() == 3) {
     return output.getItem() == Items.cocoaPowder;
   } else if (input.getItem() == Item.getItemFromBlock(net.minecraft.init.Blocks.wool)
       && input.getItemDamage() != 15) {
     return output.getItem() == net.minecraft.init.Items.dye
         && input.getItemDamage() + output.getItemDamage() == 15;
   } else {
     return false;
   }
 }
Example #27
0
  public static ItemStack createStackedBlock(Block block, int bMeta) {

    Item item = Item.getItemFromBlock(block);
    if (item.getHasSubtypes()) {
      return new ItemStack(item, 1, bMeta);
    }
    return new ItemStack(item, 1, 0);
  }
 /** returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) */
 @SideOnly(Side.CLIENT)
 public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) {
   if (p_149666_1_ != Item.getItemFromBlock(Blocks.double_wooden_slab)) {
     for (int i = 0; i < field_150005_b.length; ++i) {
       p_149666_3_.add(new ItemStack(p_149666_1_, 1, i));
     }
   }
 }
  @Override
  public Item getItemDropped(IBlockState state, Random rand, int fortune) {
    if (droppedItem == null) {
      return Item.getItemFromBlock(this);
    }

    return droppedItem;
  }
Example #30
0
  private static void registerBlockItemModel(Block block, String resourceName) {
    if (Settings.disabledItemsBlocks.contains(resourceName)) return;

    ModelLoader.setCustomModelResourceLocation(
        Item.getItemFromBlock(block),
        0,
        new ModelResourceLocation(Reference.DOMAIN + resourceName, "inventory"));
  }