net.minecraft.world.ColorizerGrass Java Examples
The following examples show how to use
net.minecraft.world.ColorizerGrass.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MediumPotRenderer.java From GardenCollection with MIT License | 5 votes |
private boolean renderWorldBlockPass0 (IBlockAccess world, int x, int y, int z, BlockMediumPot block, int modelId, RenderBlocks renderer) { int metadata = world.getBlockMetadata(x, y, z); boxRenderer.setUnit(.0625); boxRenderer.setColor(ModularBoxRenderer.COLOR_WHITE); for (int i = 0; i < 6; i++) boxRenderer.setIcon(renderer.getBlockIconFromSideAndMetadata(block, i, metadata), i); boxRenderer.renderBox(world, block, x, y, z, .125, 0, .125, .875, .75, .875, 0, ModularBoxRenderer.CUT_YPOS); TileEntityMediumPot te = block.getTileEntity(world, x, y, z); if (te != null && te.getSubstrate() != null && te.getSubstrate().getItem() instanceof ItemBlock) { Block substrate = Block.getBlockFromItem(te.getSubstrate().getItem()); int substrateData = te.getSubstrate().getItemDamage(); if (substrate != Blocks.water) { IIcon substrateIcon = renderer.getBlockIconFromSideAndMetadata(substrate, 1, substrateData); int color = substrate.colorMultiplier(world, x, y, z); if (color == Blocks.grass.colorMultiplier(world, x, y, z)) color = ColorizerGrass.getGrassColor(te.getBiomeTemperature(), te.getBiomeHumidity()); RenderHelper.calculateBaseColor(colorScratch, color); RenderHelper.instance.setRenderBounds(.125, 0, .125, .875, .6875f, .875); RenderHelper.instance.renderFace(RenderHelper.YPOS, world, block, x, y, z, substrateIcon, colorScratch[0], colorScratch[1], colorScratch[2]); } } return true; }
Example #2
Source File: LargePotRenderer.java From GardenCollection with MIT License | 4 votes |
private boolean renderWorldBlockPass0 (IBlockAccess world, int x, int y, int z, BlockLargePot block, int modelId, RenderBlocks renderer) { int metadata = world.getBlockMetadata(x, y, z); boxRenderer.setUnit(.0625); boxRenderer.setColor(ModularBoxRenderer.COLOR_WHITE); for (int i = 0; i < 6; i++) boxRenderer.setIcon(renderer.getBlockIconFromSideAndMetadata(block, i, metadata), i); TileEntityLargePot te = block.getTileEntity(world, x, y, z); int connectFlags = 0; connectFlags |= te.isAttachedNeighbor(x - 1, y, z - 1) ? ModularBoxRenderer.CONNECT_ZNEG_XNEG : 0; connectFlags |= te.isAttachedNeighbor(x, y, z - 1) ? ModularBoxRenderer.CONNECT_ZNEG : 0; connectFlags |= te.isAttachedNeighbor(x + 1, y, z - 1) ? ModularBoxRenderer.CONNECT_ZNEG_XPOS : 0; connectFlags |= te.isAttachedNeighbor(x - 1, y, z) ? ModularBoxRenderer.CONNECT_XNEG : 0; connectFlags |= te.isAttachedNeighbor(x + 1, y, z) ? ModularBoxRenderer.CONNECT_XPOS : 0; connectFlags |= te.isAttachedNeighbor(x - 1, y, z + 1) ? ModularBoxRenderer.CONNECT_ZPOS_XNEG : 0; connectFlags |= te.isAttachedNeighbor(x, y, z + 1) ? ModularBoxRenderer.CONNECT_ZPOS : 0; connectFlags |= te.isAttachedNeighbor(x + 1, y, z + 1) ? ModularBoxRenderer.CONNECT_ZPOS_XPOS : 0; boxRenderer.renderBox(world, block, x, y, z, 0, 0, 0, 1, 1, 1, connectFlags, ModularBoxRenderer.CUT_YPOS); if (te != null && te.getSubstrate() != null && te.getSubstrate().getItem() instanceof ItemBlock) { Block substrate = Block.getBlockFromItem(te.getSubstrate().getItem()); int substrateData = te.getSubstrate().getItemDamage(); if (substrate != Blocks.water) { IIcon substrateIcon = renderer.getBlockIconFromSideAndMetadata(substrate, 1, substrateData); int color = substrate.colorMultiplier(world, x, y, z); if (color == Blocks.grass.colorMultiplier(world, x, y, z)) color = ColorizerGrass.getGrassColor(te.getBiomeTemperature(), te.getBiomeHumidity()); RenderHelper.calculateBaseColor(colorScratch, color); RenderHelper.instance.setRenderBounds(0, 0, 0, 1, 1 - .0625, 1); RenderHelper.instance.renderFace(RenderHelper.YPOS, world, block, x, y, z, substrateIcon, colorScratch[0], colorScratch[1], colorScratch[2]); } } return true; }
Example #3
Source File: DecorativePotRenderer.java From GardenCollection with MIT License | 4 votes |
private boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, BlockDecorativePot block, int modelId, RenderBlocks renderer) { int data = world.getBlockMetadata(x, y, z); Tessellator tessellator = Tessellator.instance; tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z)); RenderHelper.calculateBaseColor(baseColor, block.colorMultiplier(world, x, y, z)); float unit = .0625f; for (int i = 0; i < 6; i++) boxRenderer.setIcon(renderer.getBlockIconFromSideAndMetadata(block, i, data), i); boxRenderer.setColor(baseColor); boxRenderer.renderBox(world, block, x, y, z, 0, 14 * unit, 0, 1, 1, 1, 0, ModularBoxRenderer.CUT_YNEG | ModularBoxRenderer.CUT_YPOS); boxRenderer.setScaledColor(baseColor, .9375f); boxRenderer.renderBox(world, block, x, y, z, 1 * unit, 8 * unit, 1 * unit, 15 * unit, 16 * unit, 15 * unit, 0, ModularBoxRenderer.CUT_YPOS); boxRenderer.setScaledExteriorColor(baseColor, .875f); boxRenderer.renderSolidBox(world, block, x, y, z, 3 * unit, 6 * unit, 3 * unit, 13 * unit, 8 * unit, 13 * unit); boxRenderer.setScaledExteriorColor(baseColor, .8125f); boxRenderer.renderSolidBox(world, block, x, y, z, 5 * unit, 3 * unit, 5 * unit, 11 * unit, 6 * unit, 11 * unit); boxRenderer.setScaledExteriorColor(baseColor, .9375f); boxRenderer.setScaledExteriorColor(baseColor, .75f, 1); boxRenderer.renderSolidBox(world, block, x, y, z, 2 * unit, 0 * unit, 2 * unit, 14 * unit, 3 * unit, 14 * unit); TileEntityDecorativePot te = block.getTileEntity(world, x, y, z); ItemStack substrateItem = block.getGardenSubstrate(world, x, y, z, Slot2Profile.SLOT_CENTER); if (te != null && substrateItem != null && substrateItem.getItem() instanceof ItemBlock) { Block substrate = Block.getBlockFromItem(substrateItem.getItem()); IIcon substrateIcon = renderer.getBlockIconFromSideAndMetadata(substrate, 1, substrateItem.getItemDamage()); int color = substrate.colorMultiplier(world, x, y, z); if (color == Blocks.grass.colorMultiplier(world, x, y, z)) color = ColorizerGrass.getGrassColor(te.getBiomeTemperature(), te.getBiomeHumidity()); RenderHelper.calculateBaseColor(activeSubstrateColor, color); RenderHelper.scaleColor(activeSubstrateColor, activeSubstrateColor, .8f); RenderHelper.instance.setRenderBounds(.0625f, 0, .0625f, 1f - .0625f, 1f - .0625f, 1f - .0625f); RenderHelper.instance.renderFace(RenderHelper.YPOS, world, block, x, y, z, substrateIcon, activeSubstrateColor[0], activeSubstrateColor[1], activeSubstrateColor[2]); } return true; }
Example #4
Source File: ItemUsedSoilKit.java From GardenCollection with MIT License | 4 votes |
@SideOnly(Side.CLIENT) public int getColorFromDamage (int damage) { int temperature = damage & 127; int humidity = (damage >> 7) & 127; return ColorizerGrass.getGrassColor(temperature / 255f, humidity / 255f); }
Example #5
Source File: GardenProxyRenderer.java From GardenCollection with MIT License | 4 votes |
private boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, BlockGardenProxy block, int modelId, RenderBlocks renderer) { TileEntityGarden te = block.getGardenEntity(world, x, y, z); BlockGarden garden = block.getGardenBlock(world, x, y, z); if (te == null || garden == null) return true; int section = y - te.yCoord; Tessellator tessellator = Tessellator.instance; for (int slot : garden.getSlotProfile().getPlantSlots()) { Block subBlock = block.getPlantBlockRestricted(te, slot); int subBlockData = block.getPlantData(te, slot); if (subBlock == null) continue; block.bindSlot(te.getWorldObj(), x, y, z, te, slot); float offsetX = block.getPlantOffsetX(world, x, y, z, slot); float offsetY = block.getPlantOffsetY(world, x, y, z, slot); float offsetZ = block.getPlantOffsetZ(world, x, y, z, slot); AxisAlignedBB[] clippingBounds = garden.getSlotProfile().getClippingBounds(world, x, te.yCoord, z, slot); int color = subBlock.colorMultiplier(world, x, y, z); if (color == world.getBiomeGenForCoords(x, z).getBiomeGrassColor(x, y, z)) color = ColorizerGrass.getGrassColor(te.getBiomeTemperature(), te.getBiomeHumidity()); float r = (color >> 16 & 255) / 255f; float g = (color >> 8 & 255) / 255f; float b = (color & 255) / 255f; if (EntityRenderer.anaglyphEnable) { float gray = (r * 30.0F + g * 59.0F + b * 11.0F) / 100.0F; float ra = (r * 30.0F + g * 70.0F) / 100.0F; float ba = (r * 30.0F + b * 70.0F) / 100.0F; r = gray; g = ra; b = ba; } tessellator.setColorOpaque_F(r, g, b); tessellator.setBrightness(subBlock.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z)); tessellator.addTranslation(offsetX, offsetY, offsetZ); try { IPlantRenderer plantRenderer = PlantRegistry.instance().getPlantRenderer(subBlock, subBlockData); if (plantRenderer != null) { IPlantMetaResolver resolver = PlantRegistry.instance().getPlantMetaResolver(subBlock, subBlockData); boolean shouldRender = section == 1; if (resolver != null && section <= resolver.getPlantHeight(subBlock, subBlockData)) shouldRender = true; if (shouldRender) plantRenderer.render(world, x, y, z, renderer, subBlock, subBlockData, section, clippingBounds); } else renderer.renderBlockByRenderType(subBlock, x, y, z); } catch (Exception e) { continue; } finally { block.unbindSlot(te.getWorldObj(), x, y, z, te); tessellator.addTranslation(-offsetX, -offsetY, -offsetZ); } } return true; }