diff options
| author | Jordan Byrne <draknyte1@hotmail.com> | 2017-12-29 05:34:55 +1000 |
|---|---|---|
| committer | Jordan Byrne <draknyte1@hotmail.com> | 2017-12-29 05:34:55 +1000 |
| commit | d9bb6aa63908828d5844c29c1b76956ea2079cf2 (patch) | |
| tree | 9896aad8062d05d9f7a6342871c0cd5f39100224 /src/Java/gtPlusPlus | |
| parent | 2625df7eb11b16c3aa55ff1099e821cb79d55a8b (diff) | |
| download | GT5-Unofficial-d9bb6aa63908828d5844c29c1b76956ea2079cf2.tar.gz GT5-Unofficial-d9bb6aa63908828d5844c29c1b76956ea2079cf2.tar.bz2 GT5-Unofficial-d9bb6aa63908828d5844c29c1b76956ea2079cf2.zip | |
+ Added several new ore materials.
$ Fixed bug where ores generated fluids.
$ Fixed issue where old Fluorite ores still exist.
$ Fixed issue where ore processing recipes were generated incorrectly.
$ Partially implemented smooth lighting on GT++ Ores.
Diffstat (limited to 'src/Java/gtPlusPlus')
14 files changed, 2248 insertions, 116 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index f72d51205a..099c89c47e 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -30,6 +30,7 @@ import gtPlusPlus.core.handler.events.BlockEventHandler; import gtPlusPlus.core.handler.events.LoginEventHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.geo.GeoUtils; import gtPlusPlus.core.util.item.ItemUtils; @@ -120,7 +121,7 @@ public class GTplusplus implements ActionListener { Logger.INFO("Setting some Variables for the block break event handler."); BlockEventHandler.oreLimestone = OreDictionary.getOres("oreLimestone"); BlockEventHandler.blockLimestone = OreDictionary.getOres("limestone"); - BlockEventHandler.fluoriteOre = ItemUtils.getSimpleStack(Item.getItemFromBlock(ModBlocks.blockOreFluorite)); + BlockEventHandler.fluoriteOre = FLUORIDES.FLUORITE.getOre(1); } diff --git a/src/Java/gtPlusPlus/GTplusplus_Secondary.java b/src/Java/gtPlusPlus/GTplusplus_Secondary.java index 0c83df1b5c..6b91729938 100644 --- a/src/Java/gtPlusPlus/GTplusplus_Secondary.java +++ b/src/Java/gtPlusPlus/GTplusplus_Secondary.java @@ -73,12 +73,25 @@ public class GTplusplus_Secondary { } public static void GenerateOreMaterials() { + //Lot 1 MaterialGenerator.generateOreMaterial(ORES.CROCROITE); MaterialGenerator.generateOreMaterial(ORES.GEIKIELITE); MaterialGenerator.generateOreMaterial(ORES.NICHROMITE); MaterialGenerator.generateOreMaterial(ORES.TITANITE); MaterialGenerator.generateOreMaterial(ORES.ZIMBABWEITE); - MaterialGenerator.generateOreMaterial(ORES.ZIRCONILITE); + MaterialGenerator.generateOreMaterial(ORES.ZIRCONILITE); + + //Lot 2 + MaterialGenerator.generateOreMaterial(ORES.GADOLINITE_CE); + MaterialGenerator.generateOreMaterial(ORES.GADOLINITE_Y); + MaterialGenerator.generateOreMaterial(ORES.LEPERSONNITE); + MaterialGenerator.generateOreMaterial(ORES.SAMARSKITE_Y); + MaterialGenerator.generateOreMaterial(ORES.SAMARSKITE_YB); + MaterialGenerator.generateOreMaterial(ORES.XENOTIME); + MaterialGenerator.generateOreMaterial(ORES.YTTRIAITE); + MaterialGenerator.generateOreMaterial(ORES.YTTRIALITE); + MaterialGenerator.generateOreMaterial(ORES.YTTROCERITE); + MaterialGenerator.generateOreMaterial(ORES.ZIRCON); } void setVars(){ diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index cbd21a8888..24e589ad97 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -88,7 +88,7 @@ public final class ModBlocks { blockFirePit = new FirePit(); blockFishTrap = new FishTrap(); blockInfiniteFLuidTank = new FluidTankInfinite(); - blockOreFluorite = new BlockBaseOre("oreFluorite", "Fluorite", Material.rock, BlockTypes.ORE, Utils.rgbtoHexValue(120, 120, 30), 3); + blockOreFluorite = new BlockBaseOre.oldOreBlock("oreFluorite", "Fluorite", Material.rock, BlockTypes.ORE, Utils.rgbtoHexValue(120, 120, 30), 3); blockMiningExplosive = new MiningExplosives(); blockHellfire = new HellFire(); blockProjectTable = new Machine_ProjectTable(); diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java index 9c58e1a930..c2b77ebdae 100644 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java @@ -60,14 +60,6 @@ public class BlockBaseModular extends BasicBlock{ LanguageRegistry.addName(this, blockMaterial+ " Frame Box"); //Utils.LOG_INFO("Registered Block in Language Registry as: "+blockMaterial+ " Frame Box"); } - else if (this.thisBlockType.equals(BlockTypes.ORE.name().toUpperCase())){ - LanguageRegistry.addName(this, blockMaterial+ " Ore"); - //Utils.LOG_INFO("Registered Block in Language Registry as: "+blockMaterial+ " Frame Box"); - } - else { - LanguageRegistry.addName(this, blockMaterial); - //Utils.LOG_INFO("Registered Block in Language Registry as: "+blockMaterial); - } //setOreDict(unlocalizedName, blockType); if (this.thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())){ @@ -80,16 +72,6 @@ public class BlockBaseModular extends BasicBlock{ GT_OreDictUnificator.registerOre("frameGt"+getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), ItemUtils.getSimpleStack(this)); //Utils.LOG_INFO("Registered Block in Block Registry as: "+blockMaterial+" Frame Box"); } - else if (this.thisBlockType.equals(BlockTypes.ORE.name().toUpperCase())){ - GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName)); - GT_OreDictUnificator.registerOre("block"+getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "").replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""), ItemUtils.getSimpleStack(this)); - //Utils.LOG_INFO("Registered Block in Block Registry as: "+blockMaterial+" Frame Box"); - } - else { - GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName)); - GT_OreDictUnificator.registerOre("block"+getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "").replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""), ItemUtils.getSimpleStack(this)); - //Utils.LOG_INFO("Registered Block in Block Registry as: "+blockMaterial); - } } diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java index cb0961eb66..c0847c798d 100644 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java @@ -1,5 +1,9 @@ package gtPlusPlus.core.block.base; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.Textures; @@ -7,10 +11,17 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ITexturedTileEntity; import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.client.renderer.CustomOreBlockRenderer; +import gtPlusPlus.core.item.base.itemblock.ItemBlockGtBlock; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.IIcon; @@ -23,79 +34,54 @@ public class BlockBaseOre extends BlockBaseModular implements ITexturedTileEntit @SuppressWarnings("unused") private IIcon overlay; - /*@Override - public boolean renderAsNormalBlock() { - return true; - }*/ - protected Material blockMaterial; protected int blockColour; protected BlockTypes thisBlock; - protected String thisBlockMaterial; - protected final String thisBlockType; public BlockBaseOre(final Material material, final BlockTypes blockType, final int colour) { this(material.getUnlocalizedName(), material.getLocalizedName(), net.minecraft.block.material.Material.iron, blockType, colour, 3); blockMaterial = material; } - public BlockBaseOre(final String unlocalizedName, final String blockMaterial, final BlockTypes blockType, final int colour) { this(unlocalizedName, blockMaterial, net.minecraft.block.material.Material.iron, blockType, colour, 2); } public BlockBaseOre(final String unlocalizedName, final String blockMaterial, final net.minecraft.block.material.Material vanillaMaterial, final BlockTypes blockType, final int colour, final int miningLevel) { super(unlocalizedName, blockMaterial, vanillaMaterial, blockType, colour, miningLevel); + try { + if (blockMaterial == null){ + Logger.DEBUG_MATERIALS("Failed to generate "+unlocalizedName+" due to invalid material variable."); + } + this.blockColour = colour; this.thisBlock = blockType; - this.thisBlockMaterial = blockMaterial; - this.thisBlockType = blockType.name().toUpperCase(); + + if (this == null || this.blockMaterial == null){ + Logger.DEBUG_MATERIALS("Issue during Ore construction, Material or Block is null."); + } + + GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString("ore"+Utils.sanitizeString(this.blockMaterial.getLocalizedName()))); + GT_OreDictUnificator.registerOre("ore"+Utils.sanitizeString(this.blockMaterial.getLocalizedName()), ItemUtils.getSimpleStack(this)); + LanguageRegistry.addName(this, blockMaterial+ " Ore"); + } + catch (Throwable t){ + t.printStackTrace(); + } } /** * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha */ - /*@Override + @Override @SideOnly(Side.CLIENT) - public int getRenderBlockPass() - { + public int getRenderBlockPass(){ return 0; - } */ - - /*@Override - public boolean isOpaqueCube() - { - return true; - }*/ - - /*@Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister iIcon) - { - this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + this.thisBlock.getTexture()); - //this.base = iIcon.registerIcon(CORE.MODID + ":" + "blockStone"); - //this.overlay = iIcon.registerIcon(CORE.MODID + ":" + "blockOre_Overlay"); - }*/ - - /*@Override - public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4){ - if (this.blockColour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return this.blockColour; } @Override - public int getRenderColor(final int aMeta) { - if (this.blockColour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return this.blockColour; - }*/ - - @Override public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { return false; } @@ -131,6 +117,90 @@ public class BlockBaseOre extends BlockBaseModular implements ITexturedTileEntit return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.STONES[0], new short[]{240, 240, 240, 0})}; } + public static class oldOreBlock extends BlockBaseModular{ + @SuppressWarnings("unused") + private IIcon base; + @SuppressWarnings("unused") + private IIcon overlay; + + protected Material blockMaterial; + + protected int blockColour; + protected BlockTypes thisBlock; + protected String thisBlockMaterial; + protected final String thisBlockType; + + public oldOreBlock(final Material material, final BlockTypes blockType, final int colour) { + this(material.getUnlocalizedName(), material.getLocalizedName(), net.minecraft.block.material.Material.iron, blockType, colour, 3); + blockMaterial = material; + } + + public oldOreBlock(final String unlocalizedName, final String blockMaterial, final BlockTypes blockType, final int colour) { + this(unlocalizedName, blockMaterial, net.minecraft.block.material.Material.iron, blockType, colour, 2); + } + + public oldOreBlock(final String unlocalizedName, final String blockMaterial, final net.minecraft.block.material.Material vanillaMaterial, final BlockTypes blockType, final int colour, final int miningLevel) { + super(unlocalizedName, blockMaterial, vanillaMaterial, blockType, colour, miningLevel); + this.blockColour = colour; + this.thisBlock = blockType; + this.thisBlockMaterial = blockMaterial; + this.thisBlockType = blockType.name().toUpperCase(); + this.setBlockTextureName(CORE.MODID+":"+blockType.getTexture()); + } + /** + * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha + */ + + @Override + @SideOnly(Side.CLIENT) + public int getRenderBlockPass(){ + return 0; + } + + @Override + public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { + return false; + } + + @Override + public int getRenderType() { + return 0; + } + + @Override + public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) { + return Blocks.stone.getIcon(0, 0); + } + + @Override + public IIcon getIcon(int aSide, int aMeta) { + return Blocks.stone.getIcon(0, 0); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(final IIconRegister iIcon) + { + this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + this.thisBlock.getTexture()); + } + + @Override + public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4){ + if (this.blockColour == 0){ + return MathUtils.generateSingularRandomHexValue(); + } + return this.blockColour; + } + + @Override + public int getRenderColor(final int aMeta) { + if (this.blockColour == 0){ + return MathUtils.generateSingularRandomHexValue(); + } + return this.blockColour; + } + + } } diff --git a/src/Java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java b/src/Java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java index 0c94cfe993..d517bdfae3 100644 --- a/src/Java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java +++ b/src/Java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java @@ -8,12 +8,14 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ITexturedTileEntity; import gtPlusPlus.api.objects.Logger; import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.tileentity.TileEntity; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -public class CustomOreBlockRenderer implements ISimpleBlockRenderingHandler{ +public class CustomOreBlockRenderer implements ISimpleBlockRenderingHandler { public static CustomOreBlockRenderer INSTANCE; public final int mRenderID; @@ -25,7 +27,7 @@ public class CustomOreBlockRenderer implements ISimpleBlockRenderingHandler{ Logger.INFO("Registered Custom Ore Block Renderer."); } - public static boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer) { + public boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer) { Block tTileEntity = aBlock; if ((tTileEntity instanceof ITexturedTileEntity)) { return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer, new ITexture[][]{((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 0), ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 1), ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 2), ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 3), ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 4), ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 5)}); @@ -33,19 +35,52 @@ public class CustomOreBlockRenderer implements ISimpleBlockRenderingHandler{ return false; } - public static boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer, ITexture[][] aTextures) { + public boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer, ITexture[][] aTextures) { aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); aRenderer.setRenderBoundsFromBlock(aBlock); - - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[0], true); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[1], true); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[2], true); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[3], true); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[4], true); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[5], true); + int l = aBlock.colorMultiplier(aWorld, aX, aY, aZ); + float RED = (float)(l >> 16 & 255) / 255.0F; + float GREEN = (float)(l >> 8 & 255) / 255.0F; + float BLUE = (float)(l & 255) / 255.0F; + + if (Minecraft.isAmbientOcclusionEnabled() && aBlock.getLightValue() == 0){ + if (RenderBlocks.getInstance().partialRenderBounds){ + return INSTANCE.renderStandardBlockWithAmbientOcclusionPartial(aWorld, aRenderer, aTextures, aBlock, aX, aY, aZ, RED, GREEN, BLUE); + } + else { + return INSTANCE.renderStandardBlockWithAmbientOcclusion(aWorld, aRenderer, aTextures, aBlock, aX, aY, aZ, RED, GREEN, BLUE); + } + } + else { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[0], true); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[1], true); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[2], true); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[3], true); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[4], true); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[5], true); + } return true; } + public static void renderFaceYNeg(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[][] aIcon) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[0], true); + } + public static void renderFaceYPos(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[][] aIcon) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[1], true); + } + public static void renderFaceZNeg(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[][] aIcon) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[2], true); + } + public static void renderFaceZPos(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[][] aIcon) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[3], true); + } + public static void renderFaceXNeg(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[][] aIcon) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[4], true); + } + public static void renderFaceXPos(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[][] aIcon) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[5], true); + } + public static void renderNegativeYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) { if (aWorld != null) { if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY - 1, aZ, 0))) { @@ -185,6 +220,7 @@ public class CustomOreBlockRenderer implements ISimpleBlockRenderingHandler{ } public boolean renderWorldBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, int aModelID, RenderBlocks aRenderer) { + blockAccess = aWorld; return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer); } @@ -195,5 +231,1853 @@ public class CustomOreBlockRenderer implements ISimpleBlockRenderingHandler{ public int getRenderId() { return this.mRenderID; } + + public void setRenderBounds(double p_147782_1_, double p_147782_3_, double p_147782_5_, double p_147782_7_, double p_147782_9_, double p_147782_11_) + { + if (!this.lockBlockBounds) + { + this.renderMinX = p_147782_1_; + this.renderMaxX = p_147782_7_; + this.renderMinY = p_147782_3_; + this.renderMaxY = p_147782_9_; + this.renderMinZ = p_147782_5_; + this.renderMaxZ = p_147782_11_; + this.partialRenderBounds = this.minecraftRB.gameSettings.ambientOcclusion >= 2 && (this.renderMinX > 0.0D || this.renderMaxX < 1.0D || this.renderMinY > 0.0D || this.renderMaxY < 1.0D || this.renderMinZ > 0.0D || this.renderMaxZ < 1.0D); + } + } + + /** + * Like setRenderBounds, but automatically pulling the bounds from the given Block. + */ + public void setRenderBoundsFromBlock(Block block) + { + if (!this.lockBlockBounds) + { + this.renderMinX = block.getBlockBoundsMinX(); + this.renderMaxX = block.getBlockBoundsMaxX(); + this.renderMinY = block.getBlockBoundsMinY(); + this.renderMaxY = block.getBlockBoundsMaxY(); + this.renderMinZ = block.getBlockBoundsMinZ(); + this.renderMaxZ = block.getBlockBoundsMaxZ(); + this.partialRenderBounds = this.minecraftRB.gameSettings.ambientOcclusion >= 2 && (this.renderMinX > 0.0D || this.renderMaxX < 1.0D || this.renderMinY > 0.0D || this.renderMaxY < 1.0D || this.renderMinZ > 0.0D || this.renderMaxZ < 1.0D); + } + } + + /** + * Vanilla Variables + */ + + /** The minimum X value for rendering (default 0.0). */ + public double renderMinX; + /** The maximum X value for rendering (default 1.0). */ + public double renderMaxX; + /** The minimum Y value for rendering (default 0.0). */ + public double renderMinY; + /** The maximum Y value for rendering (default 1.0). */ + public double renderMaxY; + /** The minimum Z value for rendering (default 0.0). */ + public double renderMinZ; + /** The maximum Z value for rendering (default 1.0). */ + public double renderMaxZ; + public boolean lockBlockBounds; + public boolean partialRenderBounds; + public final Minecraft minecraftRB = RenderBlocks.getInstance().minecraftRB; + public int uvRotateEast; + public int uvRotateWest; + public int uvRotateSouth; + public int uvRotateNorth; + public int uvRotateTop; + public int uvRotateBottom; + /** Whether ambient occlusion is enabled or not */ + public boolean enableAO; + /** Used as a scratch variable for ambient occlusion on the north/bottom/east corner. */ + public float aoLightValueScratchXYZNNN; + /** Used as a scratch variable for ambient occlusion between the bottom face and the north face. */ + public float aoLightValueScratchXYNN; + /** Used as a scratch variable for ambient occlusion on the north/bottom/west corner. */ + public float aoLightValueScratchXYZNNP; + /** Used as a scratch variable for ambient occlusion between the bottom face and the east face. */ + public float aoLightValueScratchYZNN; + /** Used as a scratch variable for ambient occlusion between the bottom face and the west face. */ + public float aoLightValueScratchYZNP; + /** Used as a scratch variable for ambient occlusion on the south/bottom/east corner. */ + public float aoLightValueScratchXYZPNN; + /** Used as a scratch variable for ambient occlusion between the bottom face and the south face. */ + public float aoLightValueScratchXYPN; + /** Used as a scratch variable for ambient occlusion on the south/bottom/west corner. */ + public float aoLightValueScratchXYZPNP; + /** Used as a scratch variable for ambient occlusion on the north/top/east corner. */ + public float aoLightValueScratchXYZNPN; + /** Used as a scratch variable for ambient occlusion between the top face and the north face. */ + public float aoLightValueScratchXYNP; + /** Used as a scratch variable for ambient occlusion on the north/top/west corner. */ + public float aoLightValueScratchXYZNPP; + /** Used as a scratch variable for ambient occlusion between the top face and the east face. */ + public float aoLightValueScratchYZPN; + /** Used as a scratch variable for ambient occlusion on the south/top/east corner. */ + public float aoLightValueScratchXYZPPN; + /** Used as a scratch variable for ambient occlusion between the top face and the south face. */ + public float aoLightValueScratchXYPP; + /** Used as a scratch variable for ambient occlusion between the top face and the west face. */ + public float aoLightValueScratchYZPP; + /** Used as a scratch variable for ambient occlusion on the south/top/west corner. */ + public float aoLightValueScratchXYZPPP; + /** Used as a scratch variable for ambient occlusion between the north face and the east face. */ + public float aoLightValueScratchXZNN; + /** Used as a scratch variable for ambient occlusion between the south face and the east face. */ + public float aoLightValueScratchXZPN; + /** Used as a scratch variable for ambient occlusion between the north face and the west face. */ + public float aoLightValueScratchXZNP; + /** Used as a scratch variable for ambient occlusion between the south face and the west face. */ + public float aoLightValueScratchXZPP; + /** Ambient occlusion brightness XYZNNN */ + public int aoBrightnessXYZNNN; + /** Ambient occlusion brightness XYNN */ + public int aoBrightnessXYNN; + /** Ambient occlusion brightness XYZNNP */ + public int aoBrightnessXYZNNP; + /** Ambient occlusion brightness YZNN */ + public int aoBrightnessYZNN; + /** Ambient occlusion brightness YZNP */ + public int aoBrightnessYZNP; + /** Ambient occlusion brightness XYZPNN */ + public int aoBrightnessXYZPNN; + /** Ambient occlusion brightness XYPN */ + public int aoBrightnessXYPN; + /** Ambient occlusion brightness XYZPNP */ + public int aoBrightnessXYZPNP; + /** Ambient occlusion brightness XYZNPN */ + public int aoBrightnessXYZNPN; + /** Ambient occlusion brightness XYNP */ + public int aoBrightnessXYNP; + /** Ambient occlusion brightness XYZNPP */ + public int aoBrightnessXYZNPP; + /** Ambient occlusion brightness YZPN */ + public int aoBrightnessYZPN; + /** Ambient occlusion brightness XYZPPN */ + public int aoBrightnessXYZPPN; + /** Ambient occlusion brightness XYPP */ + public int aoBrightnessXYPP; + /** Ambient occlusion brightness YZPP */ + public int aoBrightnessYZPP; + /** Ambient occlusion brightness XYZPPP */ + public int aoBrightnessXYZPPP; + /** Ambient occlusion brightness XZNN */ + public int aoBrightnessXZNN; + /** Ambient occlusion brightness XZPN */ + public int aoBrightnessXZPN; + /** Ambient occlusion brightness XZNP */ + public int aoBrightnessXZNP; + /** Ambient occlusion brightness XZPP */ + public int aoBrightnessXZPP; + /** Brightness top left */ + public int brightnessTopLeft; + /** Brightness bottom left */ + public int brightnessBottomLeft; + /** Brightness bottom right */ + public int brightnessBottomRight; + /** Brightness top right */ + public int brightnessTopRight; + /** Red color value for the top left corner */ + public float colorRedTopLeft; + /** Red color value for the bottom left corner */ + public float colorRedBottomLeft; + /** Red color value for the bottom right corner */ + public float colorRedBottomRight; + /** Red color value for the top right corner */ + public float colorRedTopRight; + /** Green color value for the top left corner */ + public float colorGreenTopLeft; + /** Green color value for the bottom left corner */ + public float colorGreenBottomLeft; + /** Green color value for the bottom right corner */ + public float colorGreenBottomRight; + /** Green color value for the top right corner */ + public float colorGreenTopRight; + /** Blue color value for the top left corner */ + public float colorBlueTopLeft; + /** Blue color value for the bottom left corner */ + public float colorBlueBottomLeft; + /** Blue color value for the bottom right corner */ + public float colorBlueBottomRight; + /** Blue color value for the top right corner */ + public float colorBlueTopRight; + /** If set to >=0, all block faces will be rendered using this texture index */ + public IIcon overrideBlockTexture; + /** + * Clear override block texture + */ + public void clearOverrideBlockTexture() + { + this.overrideBlockTexture = null; + } + + public boolean hasOverrideBlockTexture() + { + return this.overrideBlockTexture != null; + } + + public IIcon getBlockIcon(Block block, IBlockAccess access, int x, int y, int z, int side) + { + return this.getIconSafe(block.getIcon(access, x, y, z, side)); + } + + public IIcon getBlockIconFromSideAndMetadata(Block block, int side, int meta) + { + return this.getIconSafe(block.getIcon(side, meta)); + } + + public IIcon getBlockIconFromSide(Block block, int side) + { + return this.getIconSafe(block.getBlockTextureFromSide(side)); + } + + public IIcon getBlockIcon(Block block) + { + return this.getIconSafe(block.getBlockTextureFromSide(1)); + } + + public IIcon getIconSafe(IIcon iicon) + { + if (iicon == null) + { + iicon = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno"); + } + + return (IIcon)iicon; + } + + IBlockAccess blockAccess = RenderBlocks.getInstance().blockAccess; + + public boolean renderStandardBlockWithAmbientOcclusion(IBlockAccess aWorld, RenderBlocks aRenderer, ITexture[][] aTextures, Block block, int xPos, int yPos, int zPos, float R, float G, float B) + { + this.enableAO = true; + boolean flag = false; + float f3 = 0.0F; + float f4 = 0.0F; + float f5 = 0.0F; + float f6 = 0.0F; + boolean flag1 = true; + int l = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos); + Tessellator tessellator = Tessellator.instance; + tessellator.setBrightness(983055); + + if (this.getBlockIcon(block).getIconName().equals("grass_top")) + { + flag1 = false; + } + else if (this.hasOverrideBlockTexture()) + { + flag1 = false; + } + + boolean flag2; + boolean flag3; + boolean flag4; + boolean flag5; + int i1; + float f7; + + if (RenderBlocks.getInstance().renderAllFaces || block.shouldSideBeRendered(blockAccess, xPos, yPos - 1, zPos, 0)) + { + if (this.renderMinY <= 0.0D) + { + --yPos; + } + + this.aoBrightnessXYNN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos); + this.aoBrightnessYZNN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos - 1); + this.aoBrightnessYZNP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos + 1); + this.aoBrightnessXYPN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos); + this.aoLightValueScratchXYNN = blockAccess.getBlock(xPos - 1, yPos, zPos).getAmbientOcclusionLightValue(); + this.aoLightValueScratchYZNN = blockAccess.getBlock(xPos, yPos, zPos - 1).getAmbientOcclusionLightValue(); + this.aoLightValueScratchYZNP = blockAccess.getBlock(xPos, yPos, zPos + 1).getAmbientOcclusionLightValue(); + this.aoLightValueScratchXYPN = blockAccess.getBlock(xPos + 1, yPos, zPos).getAmbientOcclusionLightValue(); + flag2 = blockAccess.getBlock(xPos + 1, yPos - 1, zPos).getCanBlockGrass(); + flag3 = blockAccess.getBlock(xPos - 1, yPos - 1, zPos).getCanBlockGrass(); + flag4 = blockAccess.getBlock(xPos, yPos - 1, zPos + 1).getCanBlockGrass(); + flag5 = blockAccess.getBlock(xPos, yPos - 1, zPos - 1).getCanBlockGrass(); + + if (!flag5 && !flag3) + { + this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXYNN; + this.aoBrightnessXYZNNN = this.aoBrightnessXYNN; + } + else + { + this.aoLightValueScratchXYZNNN = blockAccess.getBlock(xPos - 1, yPos, zPos - 1).getAmbientOcclusionLightValue(); + this.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos - 1); + } + + if (!flag4 && !flag3) + { + this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXYNN; + this.aoBrightnessXYZNNP = this.aoBrightnessXYNN; + } + else + { + this.aoLightValueScratchXYZNNP = blockAccess.getBlock(xPos - 1, yPos, zPos + 1).getAmbientOcclusionLightValue(); + this.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos + 1); + } + + if (!flag5 && !flag2) + { + this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXYPN; + this.aoBrightnessXYZPNN = this.aoBrightnessXYPN; + } + else + { + this.aoLightValueScratchXYZPNN = blockAccess.getBlock(xPos + 1, yPos, zPos - 1).getAmbientOcclusionLightValue(); + this.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos - 1); + } + + if (!flag4 && !flag2) + { + this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXYPN; + this.aoBrightnessXYZPNP = this.aoBrightnessXYPN; + } + else + { + this.aoLightValueScratchXYZPNP = blockAccess.getBlock(xPos + 1, yPos, zPos + 1).getAmbientOcclusionLightValue(); + this.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos + 1); + } + + if (this.renderMinY <= 0.0D) + { + ++yPos; + } + + i1 = l; |
