diff --git a/archaic/src/main/java/resonantinduction/archaic/Archaic.java b/archaic/src/main/java/resonantinduction/archaic/Archaic.java index 1f90c6301..c4f97a20a 100644 --- a/archaic/src/main/java/resonantinduction/archaic/Archaic.java +++ b/archaic/src/main/java/resonantinduction/archaic/Archaic.java @@ -147,7 +147,7 @@ public class Archaic GameRegistry.addRecipe(new ShapedOreRecipe(blockTurntable, "SSS", "PGP", "WWW", 'S', Block.stone, 'G', UniversalRecipe.MOTOR.get(), 'P', Block.pistonBase, 'W', "logWood")); GameRegistry.addRecipe(new ShapedOreRecipe(blockCast, "I I", "IBI", "III", 'S', Item.ingotIron, 'B', Block.fenceIron)); - GameRegistry.addRecipe(new ShapedOreRecipe(blockGutter, "S S", "I I", "III", 'S', Item.stick, 'I', "plankWood")); + GameRegistry.addRecipe(new ShapedOreRecipe(blockGutter, "S S", "I I", "III", 'S', Item.stick, 'I', Block.cobblestone)); GameRegistry.addRecipe(new ShapedOreRecipe(blockGrate, "WBW", "B B", "WBW", 'B', Block.fenceIron, 'W', "plankWood")); GameRegistry.addRecipe(new ShapedOreRecipe(blockHotPlate, "SSS", "III", 'I', Item.ingotIron, 'S', Block.stone)); GameRegistry.addRecipe(new ShapedOreRecipe(blockMillstone, "SPS", "SAS", "SSS", 'P', Block.pistonBase, 'A', Item.pickaxeStone, 'S', Block.stone)); diff --git a/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/RenderGutter.java b/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/RenderGutter.java deleted file mode 100644 index aaa03e866..000000000 --- a/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/RenderGutter.java +++ /dev/null @@ -1,115 +0,0 @@ -package resonantinduction.archaic.fluid.gutter; - -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.AdvancedModelLoader; -import net.minecraftforge.client.model.IModelCustom; -import net.minecraftforge.common.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTank; - -import org.lwjgl.opengl.GL11; - -import resonantinduction.archaic.fluid.tank.TileTank; -import resonantinduction.core.Reference; -import universalelectricity.api.vector.Vector3; -import calclavia.lib.render.FluidRenderUtility; -import calclavia.lib.render.RenderUtility; -import calclavia.lib.render.item.ISimpleItemRenderer; -import calclavia.lib.utility.FluidUtility; -import calclavia.lib.utility.WorldUtility; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class RenderGutter extends TileEntitySpecialRenderer implements ISimpleItemRenderer -{ - public static final RenderGutter INSTANCE = new RenderGutter(); - - public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "gutter.tcn"); - public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "gutter.png"); - - public static void render(int meta, byte sides) - { - RenderUtility.bind(TEXTURE); - - for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) - { - if (dir != ForgeDirection.UP && dir != ForgeDirection.DOWN) - { - if (!WorldUtility.isEnabledSide(sides, dir)) - { - GL11.glPushMatrix(); - RenderUtility.rotateBlockBasedOnDirection(dir); - MODEL.renderOnly("left", "backCornerL", "frontCornerL"); - GL11.glPopMatrix(); - } - } - } - - if (!WorldUtility.isEnabledSide(sides, ForgeDirection.DOWN)) - { - MODEL.renderOnly("base"); - } - else - { - GL11.glPushMatrix(); - GL11.glRotatef(-90, 0, 0, 1); - MODEL.renderOnly("backCornerL", "frontCornerL"); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glRotatef(90, 0, 1, 0); - GL11.glRotatef(-90, 0, 0, 1); - MODEL.renderOnly("backCornerL", "frontCornerL"); - GL11.glPopMatrix(); - } - } - - @Override - public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) - { - TileGutter tile = ((TileGutter) tileEntity); - - GL11.glPushMatrix(); - GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); - - FluidStack liquid = tile.getInternalTank().getFluid(); - int capacity = tile.getInternalTank().getCapacity(); - byte renderSides = (tile instanceof TileGutter ? tile.renderSides : (byte) 0); - - render(0, renderSides); - - if (tileEntity.worldObj != null) - { - FluidTank tank = ((TileGutter) tileEntity).getInternalTank(); - double percentageFilled = (double) tank.getFluidAmount() / (double) tank.getCapacity(); - - if (percentageFilled > 0.1) - { - GL11.glPushMatrix(); - GL11.glScaled(0.95, 0.95, 0.95); - - double ySouthEast = FluidUtility.getAveragePercentageFilledForSides(TileGutter.class, percentageFilled, tileEntity.worldObj, new Vector3(tileEntity), ForgeDirection.SOUTH, ForgeDirection.EAST); - double yNorthEast = FluidUtility.getAveragePercentageFilledForSides(TileGutter.class, percentageFilled, tileEntity.worldObj, new Vector3(tileEntity), ForgeDirection.NORTH, ForgeDirection.EAST); - double ySouthWest = FluidUtility.getAveragePercentageFilledForSides(TileGutter.class, percentageFilled, tileEntity.worldObj, new Vector3(tileEntity), ForgeDirection.SOUTH, ForgeDirection.WEST); - double yNorthWest = FluidUtility.getAveragePercentageFilledForSides(TileGutter.class, percentageFilled, tileEntity.worldObj, new Vector3(tileEntity), ForgeDirection.NORTH, ForgeDirection.WEST); - - FluidRenderUtility.renderFluidTesselation(tank, ySouthEast, yNorthEast, ySouthWest, yNorthWest); - GL11.glPopMatrix(); - } - } - - GL11.glPopMatrix(); - } - - @Override - public void renderInventoryItem(ItemStack itemStack) - { - GL11.glPushMatrix(); - GL11.glTranslated(0.5, 0.5, 0.5); - render(itemStack.getItemDamage(), Byte.parseByte("001100", 2)); - GL11.glPopMatrix(); - } -} \ No newline at end of file diff --git a/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/TileGutter.java b/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/TileGutter.java index 0f43efbb3..4069610bb 100644 --- a/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/TileGutter.java +++ b/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/TileGutter.java @@ -3,23 +3,36 @@ package resonantinduction.archaic.fluid.gutter; import java.util.ArrayList; import java.util.List; +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.AdvancedModelLoader; +import net.minecraftforge.client.model.IModelCustom; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.IFluidHandler; import resonantinduction.archaic.fluid.grate.TileGrate; +import resonantinduction.core.Reference; import resonantinduction.core.ResonantInduction; import resonantinduction.core.fluid.TilePressureNode; import resonantinduction.core.grid.fluid.IPressureNodeProvider; import resonantinduction.core.grid.fluid.PressureNode; import universalelectricity.api.vector.Vector3; +import calclavia.lib.content.module.TileRender; import calclavia.lib.prefab.vector.Cuboid; +import calclavia.lib.render.FluidRenderUtility; +import calclavia.lib.render.RenderUtility; import calclavia.lib.utility.FluidUtility; import calclavia.lib.utility.WorldUtility; @@ -240,4 +253,100 @@ public class TileGutter extends TilePressureNode return from != ForgeDirection.UP && !fluid.isGaseous(); } + @SideOnly(Side.CLIENT) + @Override + protected TileRender newRenderer() + { + return new TileRender() + { + public final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "gutter.tcn"); + public final ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "gutter.png"); + + @Override + public boolean renderStatic(Vector3 position) + { + return true; + } + + @Override + public boolean renderDynamic(Vector3 position, boolean isItem, float frame) + { + GL11.glPushMatrix(); + GL11.glTranslated(position.x + 0.5, position.y + 0.5, position.z + 0.5); + + FluidStack liquid = getInternalTank().getFluid(); + int capacity = getInternalTank().getCapacity(); + + render(0, renderSides); + + if (world() != null) + { + FluidTank tank = getInternalTank(); + double percentageFilled = (double) tank.getFluidAmount() / (double) tank.getCapacity(); + + if (percentageFilled > 0.1) + { + GL11.glPushMatrix(); + GL11.glScaled(0.990, 0.99, 0.990); + + double ySouthEast = FluidUtility.getAveragePercentageFilledForSides(TileGutter.class, percentageFilled, world(), position(), ForgeDirection.SOUTH, ForgeDirection.EAST); + double yNorthEast = FluidUtility.getAveragePercentageFilledForSides(TileGutter.class, percentageFilled, world(), position(), ForgeDirection.NORTH, ForgeDirection.EAST); + double ySouthWest = FluidUtility.getAveragePercentageFilledForSides(TileGutter.class, percentageFilled, world(), position(), ForgeDirection.SOUTH, ForgeDirection.WEST); + double yNorthWest = FluidUtility.getAveragePercentageFilledForSides(TileGutter.class, percentageFilled, world(), position(), ForgeDirection.NORTH, ForgeDirection.WEST); + + FluidRenderUtility.renderFluidTesselation(tank, ySouthEast, yNorthEast, ySouthWest, yNorthWest); + GL11.glPopMatrix(); + } + } + + GL11.glPopMatrix(); + return true; + } + + @Override + public boolean renderItem(ItemStack itemStack) + { + GL11.glTranslated(0.5, 0.5, 0.5); + render(itemStack.getItemDamage(), Byte.parseByte("001100", 2)); + return true; + } + + public void render(int meta, byte sides) + { + RenderUtility.bind(TEXTURE); + + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) + { + if (dir != ForgeDirection.UP && dir != ForgeDirection.DOWN) + { + if (!WorldUtility.isEnabledSide(sides, dir)) + { + GL11.glPushMatrix(); + RenderUtility.rotateBlockBasedOnDirection(dir); + MODEL.renderOnly("left", "backCornerL", "frontCornerL"); + GL11.glPopMatrix(); + } + } + } + + if (!WorldUtility.isEnabledSide(sides, ForgeDirection.DOWN)) + { + MODEL.renderOnly("base"); + } + else + { + GL11.glPushMatrix(); + GL11.glRotatef(-90, 0, 0, 1); + MODEL.renderOnly("backCornerL", "frontCornerL"); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glRotatef(90, 0, 1, 0); + GL11.glRotatef(-90, 0, 0, 1); + MODEL.renderOnly("backCornerL", "frontCornerL"); + GL11.glPopMatrix(); + } + } + }; + } + } diff --git a/src/main/resources/assets/resonantinduction/models/gutter.png b/src/main/resources/assets/resonantinduction/models/gutter.png index d70ec44ff..cd74e3abf 100644 Binary files a/src/main/resources/assets/resonantinduction/models/gutter.png and b/src/main/resources/assets/resonantinduction/models/gutter.png differ