Package thaumic.tinkerer.common.block.tile

Examples of thaumic.tinkerer.common.block.tile.TileRepairer


  @Override
  public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    GL11.glPushMatrix();
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileRepairer(), 0.0D, 0.0D, 0.0D, 0.0F);
    GL11.glPopMatrix();
  }
View Full Code Here


    random = new Random();
  }

  @Override
  public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
    TileRepairer repairer = (TileRepairer) par1World.getTileEntity(par2, par3, par4);
    ItemStack stack = repairer.getStackInSlot(0);

    if (stack == null) {
      ItemStack playerStack = par5EntityPlayer.getCurrentEquippedItem();
      if (repairer.canInsertItem(0, playerStack, 1)) {
        repairer.setInventorySlotContents(0, playerStack.splitStack(1));

        if (playerStack.stackSize <= 0)
          par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, null);

        repairer.markDirty();
        return true;
      }
    } else {
      if (!par5EntityPlayer.inventory.addItemStackToInventory(stack))
        par5EntityPlayer.dropPlayerItemWithRandomChoice(stack, false);

      repairer.setInventorySlotContents(0, null);
      repairer.markDirty();
      return true;
    }

    return false;
  }
View Full Code Here

    par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 2);
  }

  @Override
  public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
    TileRepairer repairer = (TileRepairer) par1World.getTileEntity(par2, par3, par4);

    if (repairer != null) {
      for (int j1 = 0; j1 < repairer.getSizeInventory(); ++j1) {
        ItemStack itemstack = repairer.getStackInSlot(j1);

        if (itemstack != null) {
          float f = random.nextFloat() * 0.8F + 0.1F;
          float f1 = random.nextFloat() * 0.8F + 0.1F;
          EntityItem entityitem;
View Full Code Here

    return false;
  }

  @Override
  public TileEntity createNewTileEntity(World world, int meta) {
    return new TileRepairer();
  }
View Full Code Here

        return true;
    }

    @Override
    public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int meta) {
        TileRepairer tile = ((TileRepairer) world.getTileEntity(x, y, z));
        if (tile.getStackInSlot(0) != null && tile.getStackInSlot(0).getItemDamage() != 0) {
            return 15;
        }
        return 0;
    }
View Full Code Here

  @Override
  public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float t) {
    int meta = tileentity.getWorldObj() == null ? 3 : tileentity.getBlockMetadata();
    int rotation = meta == 2 ? 0 : meta == 3 ? 180 : meta == 4 ? 270 : 90;

    TileRepairer repairer = (TileRepairer) tileentity;

    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glTranslatef((float) x, (float) y, (float) z);
View Full Code Here

      currenttip.add(StatCollector.translateToLocalFormatted("ttwaila.connected", currentBlock));
      if (tile != null)
        currenttip.add(String.format("x: %d y: %d z: %d", tile.xCoord, tile.yCoord, tile.zCoord));
    }
    if (accessor.getBlock() == ThaumicTinkerer.registry.getFirstBlockFromClass(BlockRepairer.class)) {
      TileRepairer tileRepair = (TileRepairer) accessor.getTileEntity();
      ItemStack item = tileRepair.getStackInSlot(0);
      if (item != null) {
        if (item.getItemDamage() > 0)
          currenttip.add(StatCollector.translateToLocalFormatted("ttwaila.repairing", item.getDisplayName()));
        else
          currenttip.add(StatCollector.translateToLocalFormatted("ttwaila.finishedRepairing", item.getDisplayName()));
View Full Code Here

TOP

Related Classes of thaumic.tinkerer.common.block.tile.TileRepairer

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.