@Override public AxisAlignedBB getSelectedBoundingBoxFromPool( World par1World, int par2, int par3, int par4) { int i = par1World.getBlockMetadata(par2, par3, par4); float f = 0.375F; setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F); if (i == 0) { setBlockBounds(0.0F, 1.0F - f, 0.0F, 1.0F, 1.0F, 1.0F); } if (i == 1) { setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F); } if (i == 2) { setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); } if (i == 3) { setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); } if (i == 4) { setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } if (i == 5) { setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); } AxisAlignedBB box = AxisAlignedBB.getAABBPool() .getAABB( par2 + this.minX, par3 + this.minY, par4 + this.minZ, par2 + this.maxX, par3 + this.maxY, par4 + this.maxZ); setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.375F); return box; }
@ForgeSubscribe public void DrawBlockHighlightEvent(DrawBlockHighlightEvent evt) { World world = evt.player.worldObj; double var8 = evt.player.lastTickPosX + (evt.player.posX - evt.player.lastTickPosX) * (double) evt.partialTicks; double var10 = evt.player.lastTickPosY + (evt.player.posY - evt.player.lastTickPosY) * (double) evt.partialTicks; double var12 = evt.player.lastTickPosZ + (evt.player.posZ - evt.player.lastTickPosZ) * (double) evt.partialTicks; boolean isMetalHoe = false; if (evt.currentItem != null && evt.currentItem.getItem().shiftedIndex != TFCItems.IgInHoe.shiftedIndex && evt.currentItem.getItem().shiftedIndex != TFCItems.IgExHoe.shiftedIndex && evt.currentItem.getItem().shiftedIndex != TFCItems.SedHoe.shiftedIndex && evt.currentItem.getItem().shiftedIndex != TFCItems.MMHoe.shiftedIndex) { isMetalHoe = true; } if (evt.currentItem != null && evt.currentItem.getItem() instanceof ItemCustomHoe && isMetalHoe && PlayerManagerTFC.getInstance().getClientPlayer().hoeMode == 1) { int id = world.getBlockId(evt.target.blockX, evt.target.blockY, evt.target.blockZ); int crop = 0; if (id == Block.crops.blockID && (world.getBlockId(evt.target.blockX, evt.target.blockY - 1, evt.target.blockZ) == TFCBlocks.tilledSoil.blockID || world.getBlockId(evt.target.blockX, evt.target.blockY - 1, evt.target.blockZ) == TFCBlocks.tilledSoil2.blockID)) { id = TFCBlocks.tilledSoil.blockID; crop = 1; } if (id == TFCBlocks.tilledSoil.blockID || id == TFCBlocks.tilledSoil2.blockID) { TileEntityFarmland te = (TileEntityFarmland) world.getBlockTileEntity( evt.target.blockX, evt.target.blockY - crop, evt.target.blockZ); te.requestNutrientData(); float timeMultiplier = (float) TFC_Time.daysInYear / 360f; int soilMax = (int) (25000 * timeMultiplier); // Setup GL for the depthbox GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4ub( TFC_Settings.cropNutrientAColor[0], TFC_Settings.cropNutrientAColor[1], TFC_Settings.cropNutrientAColor[2], TFC_Settings.cropNutrientAColor[3]); GL11.glDisable(GL11.GL_CULL_FACE); // GL11.glLineWidth(6.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); double offset = 0; double nutrient = 1.02 + ((double) te.nutrients[0] / (double) soilMax) * 0.5; drawBox( AxisAlignedBB.getAABBPool() .addOrModifyAABBInPool( evt.target.blockX + offset, evt.target.blockY + 1.01 - crop, evt.target.blockZ, evt.target.blockX + offset + 0.3333, evt.target.blockY + nutrient - crop, evt.target.blockZ + 1) .expand(0.002F, 0.002F, 0.002F) .getOffsetBoundingBox(-var8, -var10, -var12)); offset = 0.3333; nutrient = 1.02 + ((double) te.nutrients[1] / (double) soilMax) * 0.5; GL11.glColor4ub( TFC_Settings.cropNutrientBColor[0], TFC_Settings.cropNutrientBColor[1], TFC_Settings.cropNutrientBColor[2], TFC_Settings.cropNutrientBColor[3]); drawBox( AxisAlignedBB.getAABBPool() .addOrModifyAABBInPool( evt.target.blockX + offset, evt.target.blockY + 1.01 - crop, evt.target.blockZ, evt.target.blockX + offset + 0.3333, evt.target.blockY + nutrient - crop, evt.target.blockZ + 1) .expand(0.002F, 0.002F, 0.002F) .getOffsetBoundingBox(-var8, -var10, -var12)); offset = 0.6666; nutrient = 1.02 + ((double) te.nutrients[2] / (double) soilMax) * 0.5; GL11.glColor4ub( TFC_Settings.cropNutrientCColor[0], TFC_Settings.cropNutrientCColor[1], TFC_Settings.cropNutrientCColor[2], TFC_Settings.cropNutrientCColor[3]); drawBox( AxisAlignedBB.getAABBPool() .addOrModifyAABBInPool( evt.target.blockX + offset, evt.target.blockY + 1.01 - crop, evt.target.blockZ, evt.target.blockX + offset + 0.3333, evt.target.blockY + nutrient - crop, evt.target.blockZ + 1) .expand(0.002F, 0.002F, 0.002F) .getOffsetBoundingBox(-var8, -var10, -var12)); GL11.glEnable(GL11.GL_CULL_FACE); /** Draw the outliens around the boxes */ GL11.glColor4f(0.1F, 0.1F, 0.1F, 1.0F); GL11.glLineWidth(3.0F); GL11.glDepthMask(false); offset = 0; nutrient = 1.02 + ((double) te.nutrients[0] / (double) soilMax) * 0.5; drawOutlinedBoundingBox( AxisAlignedBB.getAABBPool() .addOrModifyAABBInPool( evt.target.blockX + offset, evt.target.blockY + 1.01 - crop, evt.target.blockZ, evt.target.blockX + offset + 0.3333, evt.target.blockY + nutrient - crop, evt.target.blockZ + 1) .expand(0.002F, 0.002F, 0.002F) .getOffsetBoundingBox(-var8, -var10, -var12)); offset = 0.3333; nutrient = 1.02 + ((double) te.nutrients[1] / (double) soilMax) * 0.5; drawOutlinedBoundingBox( AxisAlignedBB.getAABBPool() .addOrModifyAABBInPool( evt.target.blockX + offset, evt.target.blockY + 1.01 - crop, evt.target.blockZ, evt.target.blockX + offset + 0.3333, evt.target.blockY + nutrient - crop, evt.target.blockZ + 1) .expand(0.002F, 0.002F, 0.002F) .getOffsetBoundingBox(-var8, -var10, -var12)); offset = 0.6666; nutrient = 1.02 + ((double) te.nutrients[2] / (double) soilMax) * 0.5; drawOutlinedBoundingBox( AxisAlignedBB.getAABBPool() .addOrModifyAABBInPool( evt.target.blockX + offset, evt.target.blockY + 1.01 - crop, evt.target.blockZ, evt.target.blockX + offset + 0.3333, evt.target.blockY + nutrient - crop, evt.target.blockZ + 1) .expand(0.002F, 0.002F, 0.002F) .getOffsetBoundingBox(-var8, -var10, -var12)); } } else if (evt.currentItem != null && evt.currentItem.getItem() instanceof ItemCustomHoe && PlayerManagerTFC.getInstance().getClientPlayer().hoeMode == 2) { int id = world.getBlockId(evt.target.blockX, evt.target.blockY, evt.target.blockZ); int crop = 0; if (id == Block.crops.blockID && (world.getBlockId(evt.target.blockX, evt.target.blockY - 1, evt.target.blockZ) == TFCBlocks.tilledSoil.blockID || world.getBlockId(evt.target.blockX, evt.target.blockY - 1, evt.target.blockZ) == TFCBlocks.tilledSoil2.blockID)) { id = TFCBlocks.tilledSoil.blockID; crop = 1; } if (id == TFCBlocks.tilledSoil.blockID || id == TFCBlocks.tilledSoil2.blockID) { boolean water = TFC.Blocks.BlockFarmland.isWaterNearby( world, evt.target.blockX, evt.target.blockY - crop, evt.target.blockZ); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (water) GL11.glColor4ub((byte) 14, (byte) 23, (byte) 212, (byte) 200); else GL11.glColor4ub((byte) 0, (byte) 0, (byte) 0, (byte) 200); GL11.glDisable(GL11.GL_CULL_FACE); // GL11.glLineWidth(6.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); drawFace( AxisAlignedBB.getAABBPool() .addOrModifyAABBInPool( evt.target.blockX, evt.target.blockY + 1.01 - crop, evt.target.blockZ, evt.target.blockX + 1, evt.target.blockY + 1.02 - crop, evt.target.blockZ + 1) .expand(0.002F, 0.002F, 0.002F) .getOffsetBoundingBox(-var8, -var10, -var12)); GL11.glEnable(GL11.GL_CULL_FACE); } } else if (evt.currentItem != null && evt.currentItem.getItem() instanceof ItemCustomHoe && PlayerManagerTFC.getInstance().getClientPlayer().hoeMode == 3) { int id = world.getBlockId(evt.target.blockX, evt.target.blockY, evt.target.blockZ); if (id == Block.crops.blockID && (world.getBlockId(evt.target.blockX, evt.target.blockY - 1, evt.target.blockZ) == TFCBlocks.tilledSoil.blockID || world.getBlockId(evt.target.blockX, evt.target.blockY - 1, evt.target.blockZ) == TFCBlocks.tilledSoil2.blockID)) { TileEntityCrop te = (TileEntityCrop) world.getBlockTileEntity(evt.target.blockX, evt.target.blockY, evt.target.blockZ); CropIndex index = CropManager.getInstance().getCropFromId(te.cropId); boolean fullyGrown = te.growth >= index.numGrowthStages; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (fullyGrown) GL11.glColor4ub((byte) 64, (byte) 200, (byte) 37, (byte) 200); else GL11.glColor4ub((byte) 200, (byte) 37, (byte) 37, (byte) 200); GL11.glDisable(GL11.GL_CULL_FACE); // GL11.glLineWidth(6.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); drawFace( AxisAlignedBB.getAABBPool() .addOrModifyAABBInPool( evt.target.blockX, evt.target.blockY + 0.01, evt.target.blockZ, evt.target.blockX + 1, evt.target.blockY + 0.02, evt.target.blockZ + 1) .expand(0.002F, 0.002F, 0.002F) .getOffsetBoundingBox(-var8, -var10, -var12)); GL11.glEnable(GL11.GL_CULL_FACE); } } }