Package vazkii.botania.common.block.tile.mana

Examples of vazkii.botania.common.block.tile.mana.TileSpreader


  private static final ModelSpreader model = new ModelSpreader();

  @Override
  public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
    TileSpreader spreader = (TileSpreader) tileentity;
    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glTranslated(d0, d1, d2);

    GL11.glTranslatef(0.5F, 1.5F, 0.5F);
    GL11.glRotatef(spreader.rotationX + 90F, 0F, 1F, 0F);
    GL11.glTranslatef(0F, -1F, 0F);
    GL11.glRotatef(spreader.rotationY, 1F, 0F, 0F);
    GL11.glTranslatef(0F, 1F, 0F);

    Minecraft.getMinecraft().renderEngine.bindTexture(spreader.isRedstone() ? textureRs : spreader.isDreamwood() ? textureDw : texture);
    GL11.glScalef(1F, -1F, -1F);

    double time = ClientTickHandler.ticksInGame + f;

    if(spreader.isULTRA_SPREADER()) {
      Color color = Color.getHSBColor((float) ((time * 5 + new Random(spreader.xCoord ^ spreader.yCoord ^ spreader.zCoord).nextInt(10000)) % 360) / 360F, 0.4F, 0.9F);
      GL11.glColor3f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F);
    }
    model.render();
    GL11.glColor3f(1F, 1F, 1F);

    GL11.glPushMatrix();
    double worldTicks = tileentity.getWorldObj() == null ? 0 : time;
    GL11.glRotatef((float) worldTicks % 360, 0F, 1F, 0F);
    GL11.glTranslatef(0F, (float) Math.sin(worldTicks / 20.0) * 0.05F, 0F);
    model.renderCube();
    GL11.glPopMatrix();
    GL11.glScalef(1F, -1F, -1F);
    ItemStack stack = spreader.getStackInSlot(0);

    if(stack != null) {
      Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
      ILens lens = (ILens) stack.getItem();
      GL11.glPushMatrix();
View Full Code Here


    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    TileSpreader.staticRedstone = metadata == 1;
    TileSpreader.staticDreamwood = metadata == 2 || metadata == 3;
    TileSpreader.staticUltra = metadata == 3;

    TileSpreader spreader = new TileSpreader();
    spreader.rotationX = -180F;
    TileEntityRendererDispatcher.instance.renderTileEntityAt(spreader, 0.0D, 0.0D, 0.0D, 0.0F);
    GL11.glPopMatrix();
  }
View Full Code Here

  }

  @Override
  public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {
    int orientation = BlockPistonBase.determineOrientation(par1World, par2, par3, par4, par5EntityLivingBase);
    TileSpreader spreader = (TileSpreader) par1World.getTileEntity(par2, par3, par4);
    par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage(), 1 | 2);

    switch(orientation) {
    case 0:
      spreader.rotationY = -90F;
View Full Code Here

  public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
    TileEntity tile = par1World.getTileEntity(par2, par3, par4);
    if(!(tile instanceof TileSpreader))
      return false;

    TileSpreader spreader = (TileSpreader) tile;
    ItemStack lens = spreader.getStackInSlot(0);
    ItemStack heldItem = par5EntityPlayer.getCurrentEquippedItem();
    boolean isHeldItemLens = heldItem != null && heldItem.getItem() instanceof ILens;

    if(heldItem != null)
      if(heldItem.getItem() == ModItems.twigWand)
        return false;

    if(lens == null && isHeldItemLens) {
      par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, null);
      spreader.setInventorySlotContents(0, heldItem.copy());
      spreader.markDirty();
    } else if(lens != null) {
      ItemStack add = lens.copy();
      if(!par5EntityPlayer.inventory.addItemStackToInventory(add))
        par5EntityPlayer.dropPlayerItemWithRandomChoice(add, false);
      spreader.setInventorySlotContents(0, null);
      spreader.markDirty();
    }

    return true;
  }
View Full Code Here

    return true;
  }

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

  private void incrementFakeParticleTick() {
    ChunkCoordinates coords = getBurstSourceChunkCoordinates();
    TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ);
    if(tile != null && tile instanceof TileSpreader) {
      TileSpreader spreader = (TileSpreader) tile;
      spreader.burstParticleTick += 2;
      if(spreader.lastBurstDeathTick != -1 && spreader.burstParticleTick > spreader.lastBurstDeathTick)
        spreader.burstParticleTick = 0;
    }
  }
View Full Code Here

TOP

Related Classes of vazkii.botania.common.block.tile.mana.TileSpreader

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.