From d94f16ea0745e2e347199c6a8800368af3efc047 Mon Sep 17 00:00:00 2001 From: Dragon2488 Date: Sun, 18 Sep 2016 00:02:46 +0700 Subject: [PATCH] Pipes and cables rendering --- src/main/java/gregtech/api/enums/Dyes.java | 6 +- .../metatileentity/IMetaTileEntity.java | 22 --- .../gregtech/api/items/GT_Generic_Block.java | 11 ++ .../gregtech/api/items/GT_Generic_Item.java | 5 + .../api/items/GT_MetaGenerated_Item.java | 8 +- .../metatileentity/BaseMetaPipeEntity.java | 10 +- .../api/metatileentity/MetaPipeEntity.java | 19 +-- .../api/metatileentity/MetaTileEntity.java | 17 -- .../GT_MetaPipeEntity_Cable.java | 52 ++++-- .../GT_MetaPipeEntity_Fluid.java | 41 +++-- .../GT_MetaPipeEntity_Item.java | 54 +++--- .../api/objects/GT_PipeRenderedTexture.java | 157 ++++++++++++++++++ .../api/objects/GT_RenderedTexture.java | 2 +- .../gregtech/api/util/GT_LanguageManager.java | 2 +- .../common/blocks/GT_Block_Machines.java | 7 +- .../common/blocks/GT_TileEntity_Ores.java | 10 +- .../common/render/newblocks/RenderUtil.java | 53 +++++- 17 files changed, 337 insertions(+), 139 deletions(-) create mode 100644 src/main/java/gregtech/api/objects/GT_PipeRenderedTexture.java diff --git a/src/main/java/gregtech/api/enums/Dyes.java b/src/main/java/gregtech/api/enums/Dyes.java index 41f1da9e..24bb0508 100644 --- a/src/main/java/gregtech/api/enums/Dyes.java +++ b/src/main/java/gregtech/api/enums/Dyes.java @@ -35,7 +35,7 @@ public enum Dyes implements IColorModulationContainer { /** * Additional Colors only used for direct Color referencing */ - CABLE_INSULATION(-1, 64, 64, 64, "Cable Insulation"), + INSULATION(-1, 64, 64, 64, "Cable Insulation"), CONSTRUCTION_FOAM(-1, 64, 64, 64, "Construction Foam"), MACHINE_METAL(-1, 230, 230, 255, "Machine Metal"); @@ -67,6 +67,10 @@ public enum Dyes implements IColorModulationContainer { return aDefaultModulation; } + public static short[] getOrDef(int get, Dyes def) { + return getModulation(get, def); + } + public static Dyes get(String aColor) { Object tObject = GT_Utility.getFieldContent(Dyes.class, aColor, false, false); if (tObject != null && tObject instanceof Dyes) return (Dyes) tObject; diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java index 9b5dce2a..72a10281 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java @@ -318,11 +318,6 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand */ public String[] getDescription(); - /** - * In case the Output Voltage varies. - */ - public String getSpecialVoltageToolTip(); - /** * Icon of the Texture. If this returns null then it falls back to getTextureIndex. * @@ -334,11 +329,6 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand */ public ITexture[] getTexture(@Nullable IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone); - /** - * The Textures used for the Item rendering. Return null if you want the regular 3D Block Rendering. - */ - //public ITexture[] getItemTexture(ItemStack aStack); - /** * Register Icons here. This gets called when the Icons get initialized by the Base Block * Best is you put your Icons in a static Array for quick and easy access without relying on the MetaTileList. @@ -348,18 +338,6 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand @SideOnly(Side.CLIENT) public void registerIcons(TextureMap aBlockIconRegister); - /** - * @return true if you override the Rendering. - */ - @SideOnly(Side.CLIENT) - public boolean renderInInventory(Block aBlock, int aMeta); - - /** - * @return true if you override the Rendering. - */ - @SideOnly(Side.CLIENT) - public boolean renderInWorld(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock); - /** * Gets the Output for the comparator on the given Side */ diff --git a/src/main/java/gregtech/api/items/GT_Generic_Block.java b/src/main/java/gregtech/api/items/GT_Generic_Block.java index 9fcdef96..434a819f 100644 --- a/src/main/java/gregtech/api/items/GT_Generic_Block.java +++ b/src/main/java/gregtech/api/items/GT_Generic_Block.java @@ -1,6 +1,7 @@ package gregtech.api.items; import gregtech.api.util.GT_LanguageManager; +import gregtech.common.blocks.GT_Block_Machines; import gregtech.common.blocks.UnlistedBlockPosProperty; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -13,6 +14,7 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; @@ -81,4 +83,13 @@ public abstract class GT_Generic_Block extends Block { return BlockRenderLayer.CUTOUT; } + @Override + public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { + if(this instanceof GT_Block_Machines) { + return true; //Machines and wires should always render all sides; + } + //for anything else fallback to default implementation; + return super.shouldSideBeRendered(blockState, blockAccess, pos, side); + } + } \ No newline at end of file diff --git a/src/main/java/gregtech/api/items/GT_Generic_Item.java b/src/main/java/gregtech/api/items/GT_Generic_Item.java index f210f8b4..39a08467 100644 --- a/src/main/java/gregtech/api/items/GT_Generic_Item.java +++ b/src/main/java/gregtech/api/items/GT_Generic_Item.java @@ -87,6 +87,11 @@ public class GT_Generic_Item extends Item implements IProjectileItem, IIconRegis return getHasSubtypes() ? mName + "." + getDamage(aStack) : mName; } + @Override + public String getUnlocalizedNameInefficiently(ItemStack stack) { + return getUnlocalizedName(stack); + } + @Override @SideOnly(Side.CLIENT) public void registerIcons(TextureMap aIconRegister) { diff --git a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java index b2ed2545..c28c86cf 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java @@ -91,7 +91,7 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements mItemAmount = (short) Math.min(aItemAmount, 32766 - mOffset); sInstances.put(getUnlocalizedName(), this); - invokeOnClient(this::initClient); + invokeOnClient(() -> initClient()); } @@ -107,7 +107,6 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements * @param aID The Id of the assigned Item [0 - mItemAmount] (The MetaData gets auto-shifted by +mOffset) * @param aEnglish The Default Localized Name of the created Item * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no ToolTip - * @param aFoodBehavior The Food Value of this Item. Can be null aswell. Just a convenience thing. * @param aRandomData The OreDict Names you want to give the Item. Also used for TC Aspects and some other things. * @return An ItemStack containing the newly created Item. */ @@ -117,7 +116,6 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements ItemStack rStack = new ItemStack(this, 1, mOffset + aID); mEnabledItems.set(aID); mVisibleItems.set(aID); - GT_LanguageManager.addStringLocalization(getUnlocalizedName(rStack), aEnglish); GT_LanguageManager.addStringLocalization(getUnlocalizedName(rStack) + ".name", aEnglish); GT_LanguageManager.addStringLocalization(getUnlocalizedName(rStack) + ".tooltip", aToolTip); List tAspects = new ArrayList(); @@ -234,10 +232,6 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements /** * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] - * @param aMaxCharge Maximum Charge. (if this is == 0 it will remove the Electric Behavior) - * @param aTransferLimit Transfer Limit. - * @param aTier The electric Tier. - * @param aSpecialData If this Item has a Fixed Charge, like a SingleUse Battery (if > 0). * Use -1 if you want to make this Battery chargeable (the use and canUse Functions will still discharge if you just use this) * Use -2 if you want to make this Battery dischargeable. * Use -3 if you want to make this Battery charge/discharge-able. diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 04b0815b..47f0d5a1 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -725,9 +725,15 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE @Override public ITexture[] getTexture(Block aBlock, byte aSide) { + ITexture[] uncovered = getTextureUncovered(aSide); ITexture rIcon = getCoverTexture(aSide); - if (rIcon != null) return new ITexture[]{rIcon}; - return getTextureUncovered(aSide); + if (rIcon != null) { + ITexture[] res = new ITexture[uncovered.length + 1]; + System.arraycopy(uncovered, 0, res, 0, uncovered.length); + res[uncovered.length] = rIcon; + return res; + } + return uncovered; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index b242e427..84df9b63 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -95,7 +95,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity { if (GT.isClientSide()) { ItemStack tStack = new ItemStack(GregTech_API.sBlockMachines, 1, aID); - tStack.getItem().addInformation(tStack, null, new ArrayList(), true); + tStack.getItem().addInformation(tStack, null, new ArrayList<>(), true); } } @@ -402,11 +402,6 @@ public abstract class MetaPipeEntity implements IMetaTileEntity { return false; } - @Override - public String getSpecialVoltageToolTip() { - return null; - } - @Override public boolean isGivingInformation() { return false; @@ -606,18 +601,6 @@ public abstract class MetaPipeEntity implements IMetaTileEntity { return 0; } - @Override - @SideOnly(Side.CLIENT) - public boolean renderInInventory(Block aBlock, int aMeta) { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean renderInWorld(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock) { - return false; - } - @Override public void doExplosion(long aExplosionPower) { float tStrength = aExplosionPower < V[0] ? 1.0F : aExplosionPower < V[1] ? 2.0F : aExplosionPower < V[2] ? 3.0F : aExplosionPower < V[3] ? 4.0F : aExplosionPower < V[4] ? 5.0F : aExplosionPower < V[4] * 2 ? 6.0F : aExplosionPower < V[5] ? 7.0F : aExplosionPower < V[6] ? 8.0F : aExplosionPower < V[7] ? 9.0F : 10.0F; diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 50cf6929..a6c5c8a8 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -587,11 +587,6 @@ public abstract class MetaTileEntity implements IMetaTileEntity { return false; } - @Override - public String getSpecialVoltageToolTip() { - return null; - } - @Override public boolean isGivingInformation() { return false; @@ -794,18 +789,6 @@ public abstract class MetaTileEntity implements IMetaTileEntity { // } - @Override - @SideOnly(Side.CLIENT) - public boolean renderInInventory(Block aBlock, int aMeta) { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean renderInWorld(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock) { - return false; - } - @Override public void doExplosion(long aExplosionPower) { float tStrength = aExplosionPower < V[0] ? 1.0F : aExplosionPower < V[1] ? 2.0F : aExplosionPower < V[2] ? 3.0F : aExplosionPower < V[3] ? 4.0F : aExplosionPower < V[4] ? 5.0F : aExplosionPower < V[4] * 2 ? 6.0F : aExplosionPower < V[5] ? 7.0F : aExplosionPower < V[6] ? 8.0F : aExplosionPower < V[7] ? 9.0F : 10.0F; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java index f3541b97..0dd62894 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java @@ -2,10 +2,8 @@ package gregtech.api.metatileentity.implementations; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.enums.Dyes; -import gregtech.api.enums.Materials; -import gregtech.api.enums.TextureSet; -import gregtech.api.enums.Textures; +import gregtech.api.enums.*; +import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.metatileentity.IMetaTileEntityCable; @@ -14,6 +12,7 @@ import gregtech.api.interfaces.tileentity.IEnergyConnected; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.MetaPipeEntity; +import gregtech.api.objects.GT_PipeRenderedTexture; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; import ic2.api.energy.tile.IEnergySink; @@ -75,21 +74,38 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { - if (!mInsulated) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa)}; - if (aConnected) { - float tThickNess = getThickNess(); - if (tThickNess < 0.37F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_TINY, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.49F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_SMALL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.74F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.99F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_LARGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_HUGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + if (aBaseMetaTileEntity == null) { + //itemblock + switch (aSide) { + case 2: + case 3: + aConnected = true; + } + } else if (aConnections == 0) { + aConnected = false; } - return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + + if (!mInsulated) { + return new ITexture[]{new GT_PipeRenderedTexture(mThickNess, aConnected, mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa)}; + } + + float tThickNess = getThickNess(); + short[] rgba = Dyes.getOrDef(aColorIndex, Dyes.INSULATION); + IIconContainer[] textures = mMaterial.mIconSet.mTextures; + + if (tThickNess < 0.37F) + return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[TextureSet.INDEX_wire], mMaterial.mRGBa, Textures.BlockIcons.INSULATION_FULL, rgba)}; + + if (tThickNess < 0.49F) + return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[TextureSet.INDEX_wire], mMaterial.mRGBa, Textures.BlockIcons.INSULATION_FULL, rgba)}; + + if (tThickNess < 0.74F) + return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[TextureSet.INDEX_wire], mMaterial.mRGBa, Textures.BlockIcons.INSULATION_FULL, rgba)}; + + if (tThickNess < 0.99F) + return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[TextureSet.INDEX_wire], mMaterial.mRGBa, Textures.BlockIcons.INSULATION_FULL, rgba)}; + + return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[TextureSet.INDEX_wire], mMaterial.mRGBa, Textures.BlockIcons.INSULATION_FULL, rgba)}; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java index f74603dd..c094fa95 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java @@ -5,12 +5,14 @@ import gregtech.api.enums.Dyes; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.SubTag; +import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.MetaPipeEntity; +import gregtech.api.objects.GT_PipeRenderedTexture; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; @@ -74,19 +76,34 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { - if (aConnected) { - float tThickNess = getThickNess(); - if (tThickNess < 0.37F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - if (tThickNess < 0.49F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - if (tThickNess < 0.74F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - if (tThickNess < 0.99F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + if (aBaseMetaTileEntity == null) { + //itemblock + switch (aSide) { + case 2: + case 3: + aConnected = true; + } + } else if (aConnections == 0) { + aConnected = false; } - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + + float tThickNess = getThickNess(); + short[] rgba = Dyes.getModulation(aColorIndex, mMaterial.mRGBa); + IIconContainer[] textures = mMaterial.mIconSet.mTextures; + + if (tThickNess < 0.37F) + return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[OrePrefixes.pipeTiny.mTextureIndex], rgba, textures[OrePrefixes.pipe.mTextureIndex], rgba)}; + + if (tThickNess < 0.49F) + return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[OrePrefixes.pipeSmall.mTextureIndex], rgba, textures[OrePrefixes.pipe.mTextureIndex], rgba)}; + + if (tThickNess < 0.74F) + return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[OrePrefixes.pipeMedium.mTextureIndex], rgba, textures[OrePrefixes.pipe.mTextureIndex], rgba)}; + + if (tThickNess < 0.99F) + return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[OrePrefixes.pipeLarge.mTextureIndex], rgba, textures[OrePrefixes.pipe.mTextureIndex], rgba)}; + + return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[OrePrefixes.pipeHuge.mTextureIndex], rgba, textures[OrePrefixes.pipe.mTextureIndex], rgba)}; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java index 2bc4176c..a35f6af6 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java @@ -1,6 +1,7 @@ package gregtech.api.metatileentity.implementations; import gregtech.api.enums.*; +import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.metatileentity.IMetaTileEntityItemPipe; @@ -8,6 +9,7 @@ import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.MetaPipeEntity; +import gregtech.api.objects.GT_PipeRenderedTexture; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; import net.minecraft.inventory.IInventory; @@ -70,34 +72,34 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { - if (mIsRestrictive) { - if (aConnected) { - float tThickNess = getThickNess(); - if (tThickNess < 0.37F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)}; - if (tThickNess < 0.49F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)}; - if (tThickNess < 0.74F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)}; - if (tThickNess < 0.99F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)}; - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)}; + if (aBaseMetaTileEntity == null) { + //itemblock + switch (aSide) { + case 2: + case 3: + aConnected = true; } - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)}; + } else if (aConnections == 0) { + aConnected = false; } - if (aConnected) { - float tThickNess = getThickNess(); - if (tThickNess < 0.37F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - if (tThickNess < 0.49F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - if (tThickNess < 0.74F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - if (tThickNess < 0.99F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - } - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + + float tThickNess = getThickNess(); + short[] rgba = Dyes.getModulation(aColorIndex, mMaterial.mRGBa); + IIconContainer[] textures = mMaterial.mIconSet.mTextures; + + if (tThickNess < 0.37F) + return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[OrePrefixes.pipeTiny.mTextureIndex], rgba, textures[OrePrefixes.pipe.mTextureIndex], rgba)}; + + if (tThickNess < 0.49F) + return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[OrePrefixes.pipeSmall.mTextureIndex], rgba, textures[OrePrefixes.pipe.mTextureIndex], rgba)}; + + if (tThickNess < 0.74F) + return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[OrePrefixes.pipeMedium.mTextureIndex], rgba, textures[OrePrefixes.pipe.mTextureIndex], rgba)}; + + if (tThickNess < 0.99F) + return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[OrePrefixes.pipeLarge.mTextureIndex], rgba, textures[OrePrefixes.pipe.mTextureIndex], rgba)}; + + return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[OrePrefixes.pipeHuge.mTextureIndex], rgba, textures[OrePrefixes.pipe.mTextureIndex], rgba)}; } @Override diff --git a/src/main/java/gregtech/api/objects/GT_PipeRenderedTexture.java b/src/main/java/gregtech/api/objects/GT_PipeRenderedTexture.java new file mode 100644 index 00000000..8d7c38fa --- /dev/null +++ b/src/main/java/gregtech/api/objects/GT_PipeRenderedTexture.java @@ -0,0 +1,157 @@ +package gregtech.api.objects; + +import com.google.common.collect.Lists; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; +import gregtech.common.render.newblocks.RenderUtil; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class GT_PipeRenderedTexture implements ITexture { + + private float thickness; + private boolean connected; + private TextureAtlasSprite connectedSprite; + private TextureAtlasSprite insulationSprite; + private int rgbaConnection = -1; + private int rgbaInsulation = -1; + + public GT_PipeRenderedTexture(float thickness, boolean connected, TextureAtlasSprite spriteConnected, TextureAtlasSprite spriteInsulation, short[] rgbaConnected, short[] rgbaInsulation) { + this.thickness = thickness; + this.connected = connected; + this.connectedSprite = spriteConnected; + this.insulationSprite = spriteInsulation; + if(rgbaConnected != null) { + this.rgbaConnection = GT_RenderedTexture.makeColor(rgbaConnected); + } + if(rgbaInsulation != null) { + this.rgbaInsulation = GT_RenderedTexture.makeColor(rgbaInsulation); + } + } + + public GT_PipeRenderedTexture(float thickness, boolean connected, IIconContainer sprite, short[] rgba) { + this(thickness, connected, sprite, rgba, sprite, rgba); + } + + public GT_PipeRenderedTexture(float thickness, boolean connected, IIconContainer connection, short[] rgbaCon, IIconContainer insulation, short[] rgbaInsul) { + this(thickness, connected, connection.getIcon(), insulation.getIcon(), rgbaCon, rgbaInsul); + } + + @Override + public List getQuads(Block aBlock, BlockPos blockPos, EnumFacing side, float offset) { + float wireOffset = (1.0F - thickness) / 2f; + + switch (side) { + case UP: + if(!connected) { + BakedQuad quad = makeQuad(insulationSprite, wireOffset, wireOffset + thickness, wireOffset, thickness, thickness, EnumFacing.UP, rgbaInsulation); + return Lists.newArrayList(quad); + } else { + BakedQuad north = makeQuad(insulationSprite, wireOffset, wireOffset + thickness, wireOffset, thickness, wireOffset, EnumFacing.NORTH, rgbaInsulation); + BakedQuad south = makeQuad(insulationSprite, wireOffset, wireOffset + thickness, wireOffset + thickness, thickness, wireOffset, EnumFacing.SOUTH, rgbaInsulation); + + BakedQuad west = makeQuad(insulationSprite, wireOffset, wireOffset + thickness, wireOffset, wireOffset, thickness, EnumFacing.WEST, rgbaInsulation); + BakedQuad east = makeQuad(insulationSprite, wireOffset + thickness, wireOffset + thickness, wireOffset, wireOffset, thickness, EnumFacing.EAST, rgbaInsulation); + + BakedQuad up = makeQuad(connectedSprite, wireOffset, 1f, wireOffset, thickness, thickness, EnumFacing.UP, rgbaConnection); + + return Lists.newArrayList(north, south, west, east, up); + } + case DOWN: + if(!connected) { + BakedQuad quad = makeQuad(insulationSprite, wireOffset, wireOffset, wireOffset, thickness, thickness, EnumFacing.DOWN, rgbaInsulation); + return Lists.newArrayList(quad); + } else { + BakedQuad north = makeQuad(insulationSprite, wireOffset, 0f, wireOffset, thickness, wireOffset, EnumFacing.NORTH, rgbaInsulation); + BakedQuad south = makeQuad(insulationSprite, wireOffset, 0f, wireOffset + thickness, thickness, wireOffset, EnumFacing.SOUTH, rgbaInsulation); + + BakedQuad west = makeQuad(insulationSprite, wireOffset, 0f, wireOffset, wireOffset, thickness, EnumFacing.WEST, rgbaInsulation); + BakedQuad east = makeQuad(insulationSprite, wireOffset + thickness, 0f, wireOffset, wireOffset, thickness, EnumFacing.EAST, rgbaInsulation); + + BakedQuad down = makeQuad(connectedSprite, wireOffset, 0f, wireOffset, thickness, thickness, EnumFacing.DOWN, rgbaConnection); + + return Lists.newArrayList(north, south, west, east, down); + } + case EAST: + if(!connected) { + BakedQuad quad = makeQuad(insulationSprite, wireOffset, wireOffset, wireOffset, thickness, thickness, EnumFacing.WEST, rgbaInsulation); + return Lists.newArrayList(quad); + } else { + BakedQuad down = makeQuad(insulationSprite, wireOffset + thickness, wireOffset, wireOffset, wireOffset, thickness, EnumFacing.DOWN, rgbaInsulation); + BakedQuad up = makeQuad(insulationSprite, wireOffset + thickness, wireOffset + thickness, wireOffset, wireOffset, thickness, EnumFacing.UP, rgbaInsulation); + + BakedQuad north = makeQuad(insulationSprite, wireOffset + thickness, wireOffset, wireOffset, wireOffset, thickness, EnumFacing.NORTH, rgbaInsulation); + BakedQuad south = makeQuad(insulationSprite, wireOffset + thickness, wireOffset, wireOffset + thickness, wireOffset, thickness, EnumFacing.SOUTH, rgbaInsulation); + + BakedQuad end = makeQuad(connectedSprite, 1f, wireOffset, wireOffset, thickness, thickness, EnumFacing.EAST, rgbaConnection); + + return Lists.newArrayList(down, up, north, south, end); + } + case WEST: + if(!connected) { + BakedQuad quad = makeQuad(insulationSprite, wireOffset + thickness, wireOffset, wireOffset, thickness, thickness, EnumFacing.EAST, rgbaInsulation); + return Lists.newArrayList(quad); + } else { + BakedQuad down = makeQuad(insulationSprite, 0f, wireOffset, wireOffset, wireOffset, thickness, EnumFacing.DOWN, rgbaInsulation); + BakedQuad up = makeQuad(insulationSprite, 0f, wireOffset + thickness, wireOffset, wireOffset, thickness, EnumFacing.UP, rgbaInsulation); + + BakedQuad north = makeQuad(insulationSprite, 0f, wireOffset, wireOffset, wireOffset, thickness, EnumFacing.NORTH, rgbaInsulation); + BakedQuad south = makeQuad(insulationSprite, 0f, wireOffset, wireOffset + thickness, wireOffset, thickness, EnumFacing.SOUTH, rgbaInsulation); + + BakedQuad end = makeQuad(connectedSprite, 0f, wireOffset, wireOffset, thickness, thickness, EnumFacing.WEST, rgbaConnection); + + return Lists.newArrayList(down, up, north, south, end); + } + case NORTH: + if(!connected) { + BakedQuad quad = makeQuad(insulationSprite, wireOffset, wireOffset, wireOffset, thickness, thickness, EnumFacing.NORTH, rgbaInsulation); + return Lists.newArrayList(quad); + } else { + BakedQuad down = makeQuad(insulationSprite, wireOffset, wireOffset, 0f, thickness, wireOffset, EnumFacing.DOWN, rgbaInsulation); + BakedQuad up = makeQuad(insulationSprite, wireOffset, wireOffset + thickness, 0f, thickness, wireOffset, EnumFacing.UP, rgbaInsulation); + + BakedQuad east = makeQuad(insulationSprite, wireOffset + thickness, wireOffset, 0f, thickness, wireOffset, EnumFacing.EAST, rgbaInsulation); + BakedQuad west = makeQuad(insulationSprite, wireOffset, wireOffset, 0f, thickness, wireOffset, EnumFacing.WEST, rgbaInsulation); + + BakedQuad end = makeQuad(connectedSprite, wireOffset, wireOffset, 0f, thickness, thickness, EnumFacing.NORTH, rgbaConnection); + + return Lists.newArrayList(down, up, end, east, west); + } + case SOUTH: + if(!connected) { + BakedQuad quad = makeQuad(insulationSprite, wireOffset, wireOffset, wireOffset + thickness, thickness, thickness, EnumFacing.SOUTH, rgbaInsulation); + return Lists.newArrayList(quad); + } else { + BakedQuad down = makeQuad(insulationSprite, wireOffset, wireOffset, wireOffset + thickness, thickness, wireOffset, EnumFacing.DOWN, rgbaInsulation); + BakedQuad up = makeQuad(insulationSprite, wireOffset, wireOffset + thickness, wireOffset + thickness, thickness, wireOffset, EnumFacing.UP, rgbaInsulation); + + BakedQuad east = makeQuad(insulationSprite, wireOffset + thickness, wireOffset, wireOffset + thickness, thickness, wireOffset, EnumFacing.EAST, rgbaInsulation); + BakedQuad west = makeQuad(insulationSprite, wireOffset, wireOffset, wireOffset + thickness, thickness, wireOffset, EnumFacing.WEST, rgbaInsulation); + + BakedQuad end = makeQuad(connectedSprite, wireOffset, wireOffset, 1f, thickness, thickness, EnumFacing.SOUTH, rgbaConnection); + + return Lists.newArrayList(down, up, end, east, west); + } + } + return Collections.emptyList(); + } + + public BakedQuad makeQuad(TextureAtlasSprite sprite, float x, float y, float z, float width, float height, EnumFacing side, int rgba) { + return RenderUtil.renderQuadCustom(x, y, z, width, height, DefaultVertexFormats.BLOCK, sprite, side, -1, rgba, true); + } + + @Override + public boolean isValidTexture() { + return thickness > 0.0F; + } + +} diff --git a/src/main/java/gregtech/api/objects/GT_RenderedTexture.java b/src/main/java/gregtech/api/objects/GT_RenderedTexture.java index 3636a86e..f6288295 100644 --- a/src/main/java/gregtech/api/objects/GT_RenderedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_RenderedTexture.java @@ -38,7 +38,7 @@ public class GT_RenderedTexture implements ITexture { } } - private int makeColor(short[] rgba) { + public static int makeColor(short[] rgba) { try { for(int i = 0; i < 4; i++) rgba[i] = (short) Math.max(0, rgba[i]); diff --git a/src/main/java/gregtech/api/util/GT_LanguageManager.java b/src/main/java/gregtech/api/util/GT_LanguageManager.java index ab5b3c41..46180977 100644 --- a/src/main/java/gregtech/api/util/GT_LanguageManager.java +++ b/src/main/java/gregtech/api/util/GT_LanguageManager.java @@ -32,7 +32,7 @@ public class GT_LanguageManager { public static Configuration sEnglishFile; public static String addStringLocalization(String aKey, String aEnglish) { - return addStringLocalization(aKey, aEnglish, true); + return addStringLocalization(aKey, aEnglish, false); } public static String addStringLocalization(String aKey, String aEnglish, boolean aWriteIntoLangFile) { diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java index 0cfb6898..4f1b0360 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java @@ -196,7 +196,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo int tDamage = itemStack.getItemDamage(); if(GregTech_API.METATILEENTITIES.length > tDamage) { if (GregTech_API.METATILEENTITIES[tDamage] != null) { - return GregTech_API.METATILEENTITIES[tDamage].getTexture(null, (byte) side.getIndex(), (byte) 0, (byte) 0, false, false); + return GregTech_API.METATILEENTITIES[tDamage].getTexture(null, (byte) side.getIndex(), (byte) 2, (byte) -1, false, false); } else { System.out.println("METATILEENTITY WAS NULL FOR MACHINE " + tDamage); } @@ -298,10 +298,9 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo return false; } if(!worldIn.isRemote && gregTechTileEntity.isUseableByPlayer(playerIn)) { - gregTechTileEntity.onRightclick(playerIn, (byte) side.getIndex(), hitX, hitY, hitZ, hand); - return true; + return gregTechTileEntity.onRightclick(playerIn, (byte) side.getIndex(), hitX, hitY, hitZ, hand); } - return true; + return false; } @Override diff --git a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java index f143a2b2..1ba1bbca 100644 --- a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java +++ b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java @@ -142,7 +142,7 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit } else { this.mMetaData = ((short) (this.mMetaData + 3000)); } - } else if (aOverridingStoneBlock.isReplaceableOreGen(worldObj.getBlockState(getPos()), this.worldObj, getPos(), state -> state.getBlock() == GregTech_API.sBlockStones)) { + } else if (aOverridingStoneBlock.isReplaceableOreGen(worldObj.getBlockState(getPos()), this.worldObj, getPos(), GT_Worldgen_Ore_Normal.ANY)) { if (aOverridingStoneBlock == GregTech_API.sBlockStones) { if (aOverridingStoneMeta < 8) { this.mMetaData = ((short) (this.mMetaData + 5000)); @@ -168,14 +168,6 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit GT_TickHandler_Ores.loadChunkOre(this); } - public boolean isBlocked() { - for(EnumFacing offset : EnumFacing.VALUES) { - if(!GT_Utility.isOpaqueBlock(worldObj, pos.offset(offset))) - return false; - } - return true; - } - public void convertOreBlock(World aWorld, int aX, int aY, int aZ) { short aMeta = ((short) (int) (this.mMetaData % 1000 + (this.mMetaData / 16000 * 16000))); aWorld.setBlockState(new BlockPos(aX, aY, aZ), GregTech_API.sBlockOres1.getStateFromMeta(getHarvestData(aMeta))); diff --git a/src/main/java/gregtech/common/render/newblocks/RenderUtil.java b/src/main/java/gregtech/common/render/newblocks/RenderUtil.java index fe8c6ada..1ecda4d2 100644 --- a/src/main/java/gregtech/common/render/newblocks/RenderUtil.java +++ b/src/main/java/gregtech/common/render/newblocks/RenderUtil.java @@ -12,7 +12,6 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class RenderUtil { public static BakedQuad renderSide(VertexFormat vertexFormat, TextureAtlasSprite sprite, EnumFacing side, int tint, float offset, int color, boolean hideSiding) { - switch (side) { case NORTH: return buildQuad(vertexFormat, hideSiding ? null : EnumFacing.NORTH, sprite, tint, @@ -63,6 +62,58 @@ public class RenderUtil { } } + public static BakedQuad renderQuadCustom(float x, float y, float z, float width, float height, VertexFormat vertexFormat, TextureAtlasSprite sprite, EnumFacing side, int tint, int color, boolean hide) { + //float spriteCut = Math.min((width + height) / 2.0F, 1.0F); TODO + switch (side) { + case NORTH: + return buildQuad(vertexFormat, EnumFacing.NORTH, sprite, tint, + x, y, z, sprite.getMaxU(), sprite.getMaxV(), + x, y + height, z, sprite.getMaxU(), sprite.getMinV(), + x + width, y + height, z, sprite.getMinU(), sprite.getMinV(), + x + width, y, z, sprite.getMinU(), sprite.getMaxV(), + color); + case SOUTH: + return buildQuad(vertexFormat, EnumFacing.SOUTH, sprite, tint, + x + width, y, z, sprite.getMinU(), sprite.getMaxV(), + x + width, y + height, z, sprite.getMinU(), sprite.getMinV(), + x, y + height, z, sprite.getMaxU(), sprite.getMinV(), + x, y, z, sprite.getMaxU(), sprite.getMaxV(), + color); + case WEST: + return buildQuad(vertexFormat, EnumFacing.WEST, sprite, tint, + x, y, z + height, sprite.getMaxU(), sprite.getMaxV(), + x, y + width, z + height, sprite.getMaxU(), sprite.getMinV(), + x, y + width, z, sprite.getMinU(), sprite.getMinV(), + x, y, z, sprite.getMinU(), sprite.getMaxV(), + color); + case EAST: + return buildQuad(vertexFormat, EnumFacing.EAST, sprite, tint, + x, y, z, sprite.getMaxU(), sprite.getMaxV(), + x, y + width, z, sprite.getMaxU(), sprite.getMinV(), + x, y + width, z + height, sprite.getMinU(), sprite.getMinV(), + x, y, z + height, sprite.getMinU(), sprite.getMaxV(), + color); + case DOWN: + return buildQuad(vertexFormat, EnumFacing.DOWN, sprite, tint, + x, y, z, sprite.getMinU(), sprite.getMinV(), + x + width, y, z, sprite.getMaxU(), sprite.getMinV(), + x + width, y, z + height, sprite.getMaxU(), sprite.getMaxV(), + x, y, z + height, sprite.getMinU(), sprite.getMaxV(), + color); + case UP: + return buildQuad(vertexFormat, hide ? null : EnumFacing.UP, sprite, tint, + x, y, z + height, sprite.getMinU(), sprite.getMaxV(), + x + width, y, z + height, sprite.getMaxU(), sprite.getMaxV(), + x + width, y, z, sprite.getMaxU(), sprite.getMinV(), + x, y, z, sprite.getMinU(), sprite.getMinV(), + color); + + default: + System.out.println("Can't render side " + side); + return null; + } + } + private static BakedQuad buildQuad( VertexFormat format, EnumFacing side, TextureAtlasSprite sprite, int tint, float x0, float y0, float z0, float u0, float v0,