From f9b69809936411e6cead81029896ecbd729cbd1a Mon Sep 17 00:00:00 2001 From: Flow86 Date: Thu, 28 Mar 2013 09:56:12 +0100 Subject: [PATCH 1/2] fix commit by TarzanBuzzyMan --- common/buildcraft/energy/BlockOilStill.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/common/buildcraft/energy/BlockOilStill.java b/common/buildcraft/energy/BlockOilStill.java index 02ddc9c0..64361d3f 100644 --- a/common/buildcraft/energy/BlockOilStill.java +++ b/common/buildcraft/energy/BlockOilStill.java @@ -11,15 +11,19 @@ package buildcraft.energy; import net.minecraft.block.BlockStationary; import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraftforge.liquids.ILiquid; import buildcraft.BuildCraftCore; import buildcraft.BuildCraftEnergy; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class BlockOilStill extends BlockStationary implements ILiquid { @SideOnly(Side.CLIENT) - private Icon[] field_94425_a; + private Icon[] theIcon; public BlockOilStill(int i, Material material) { super(i, material); @@ -52,17 +56,17 @@ public class BlockOilStill extends BlockStationary implements ILiquid { public boolean isBlockReplaceable(World world, int i, int j, int k) { return true; } - + @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IconRegister iconRegister){ - this.field_94425_a = new Icon[] {iconRegister.registerIcon("buildcraft:oil"), iconRegister.registerIcon("buildcraft:oil_flow")}; + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister iconRegister) { + this.theIcon = new Icon[] { iconRegister.registerIcon("buildcraft:oil"), iconRegister.registerIcon("buildcraft:oil_flow") }; } @Override @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { - return par1 != 0 && par1 != 1 ? this.field_94425_a[1] : this.field_94425_a[0]; + return par1 != 0 && par1 != 1 ? this.theIcon[1] : this.theIcon[0]; } } From 4d92a9b918d825309a286096a31c07b6badc1c21 Mon Sep 17 00:00:00 2001 From: Flow86 Date: Thu, 28 Mar 2013 10:00:05 +0100 Subject: [PATCH 2/2] fix RenderTank --- common/buildcraft/BuildCraftEnergy.java | 17 +++++++++++++++++ .../buildcraft/factory/render/RenderTank.java | 18 ++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/common/buildcraft/BuildCraftEnergy.java b/common/buildcraft/BuildCraftEnergy.java index c178fb0c..b84b5318 100644 --- a/common/buildcraft/BuildCraftEnergy.java +++ b/common/buildcraft/BuildCraftEnergy.java @@ -12,11 +12,14 @@ import java.util.TreeMap; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.Configuration; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.Property; +import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.liquids.LiquidContainerData; import net.minecraftforge.liquids.LiquidContainerRegistry; import net.minecraftforge.liquids.LiquidDictionary; @@ -53,6 +56,8 @@ import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.network.NetworkRegistry; 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; @Mod(name = "BuildCraft Energy", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Energy", dependencies = DefaultProps.DEPENDENCY_CORE) @NetworkMod(channels = { DefaultProps.NET_CHANNEL_NAME }, packetHandler = PacketHandler.class, clientSideRequired = true, serverSideRequired = true) @@ -160,6 +165,18 @@ public class BuildCraftEnergy { bucketOil), new ItemStack(Item.bucketEmpty))); LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getLiquid("Fuel", LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketFuel), new ItemStack(Item.bucketEmpty))); + + MinecraftForge.EVENT_BUS.register(this); + } + + @ForgeSubscribe + @SideOnly(Side.CLIENT) + public void textureHook(TextureStitchEvent.Post event) { + if (event.map == Minecraft.getMinecraft().renderEngine.textureMapItems) { + LiquidDictionary.getCanonicalLiquid("Fuel").setRenderingIcon(fuel.getIconFromDamage(0)); + } else { + LiquidDictionary.getCanonicalLiquid("Oil").setRenderingIcon(oilStill.getBlockTextureFromSide(1)); + } } public static void loadRecipes() { diff --git a/common/buildcraft/factory/render/RenderTank.java b/common/buildcraft/factory/render/RenderTank.java index 9d137daf..35e448fc 100644 --- a/common/buildcraft/factory/render/RenderTank.java +++ b/common/buildcraft/factory/render/RenderTank.java @@ -11,6 +11,7 @@ package buildcraft.factory.render; import java.util.HashMap; +import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; @@ -29,25 +30,34 @@ public class RenderTank extends TileEntitySpecialRenderer { final static private int displayStages = 100; - private HashMap stage = new HashMap(); + private final HashMap stage = new HashMap(); private int[] getDisplayLists(LiquidStack liquid, World world) { if (stage.containsKey(liquid)) { - return stage.get(liquid); + return stage.get(liquid); } int[] d = new int[displayStages]; stage.put(liquid, d); BlockInterface block = new BlockInterface(); + block.baseBlock = Block.waterStill; block.texture = liquid.getRenderingIcon(); - Minecraft.getMinecraft().renderEngine.bindTexture("/terrain.png"); + + String spriteSet = "/gui/items.png"; + + if (liquid.itemID < Block.blocksList.length) { + spriteSet = "/terrain.png"; + block.baseBlock = Block.blocksList[liquid.itemID]; + } for (int s = 0; s < displayStages; ++s) { d[s] = GLAllocation.generateDisplayLists(1); GL11.glNewList(d[s], 4864 /* GL_COMPILE */); + Minecraft.getMinecraft().renderEngine.bindTexture(spriteSet); + block.minX = 0.125 + 0.01; block.minY = 0; block.minZ = 0.125 + 0.01; @@ -71,7 +81,7 @@ public class RenderTank extends TileEntitySpecialRenderer { String liquidName = tank.tank.getLiquidName(); LiquidStack liquid = tank.tank.getLiquid(); - LiquidStack refLiquid = LiquidDictionary.getCanonicalLiquid(liquidName); + LiquidStack refLiquid = LiquidDictionary.getCanonicalLiquid(liquidName); if (refLiquid == null || liquid.amount <= 0) return;