resonant-induction/minecraft/liquidmechanics/client/render/RenderTank.java

149 lines
4.1 KiB
Java
Raw Normal View History

package liquidmechanics.client.render;
import liquidmechanics.api.helpers.LiquidData;
import liquidmechanics.api.helpers.LiquidHandler;
import liquidmechanics.api.helpers.ColorCode;
import liquidmechanics.api.helpers.connectionHelper;
import liquidmechanics.client.model.ModelLiquidTank;
import liquidmechanics.client.model.ModelLiquidTankCorner;
import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.tileentity.TileEntityTank;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import org.lwjgl.opengl.GL11;
public class RenderTank extends TileEntitySpecialRenderer
{
private ModelLiquidTank model;
private ModelLiquidTankCorner modelC;
public RenderTank()
{
model = new ModelLiquidTank();
modelC = new ModelLiquidTankCorner();
}
public void renderAModelAt(TileEntityTank te, double d, double d1, double d2, float f)
{
int meta = te.getBlockMetadata();
getting Closer to being done I'm getting closer to making this mod more universal for all liquids. Right now after a bit of coding i can say i have: *Fixed Pipes *Fixed Tanks *Removed Mengenta as a color(no need for another simi red/pinkish color) *Create a IColor interface for future use with other color selective blocks *Created a object feed version of get for PipeColor so you can use numbers, Strings, or LiquidData to ID a color. Useful for setColor(Object obj) *Worked on some textures however i need to either make a better model for tanks or find a texture artist for help *Found the tank model files so they can be edited Issues still to be worked on *Lang file, still item names are not working *Release Valve *Pipe Changer tool, not sure if i should use a GUI with the tool or have 15 color brushs. The ladder seems wasteful *Block, and bucket for Waste Liquid *Textures need some help, especial Tanks so i can add the rest of the colored version to the creative menu *Crafting for all Pipes, Tanks, and items need redone or added for the new system *Pumps needs reworked to have a diffrent version for lava,water, and large area pumping. Small version for filling system, large for draining source pools for constuction. Lava pump will fall under large. Might add an oil pump, or create one for oil craft using the same design. *Tanks still need to be tested and fixed to create pressure for Pipes if side == down and liquid || side == up and gas *LiquidHandler needs worked on to pre catch and add liquids to the allowed List similar to how e methain, oil, fuel are register.
2013-01-07 04:24:28 +01:00
int guageMeta = meta;
LiquidStack stack = te.getStack();
int pos = 0;
if(stack != null)
getting Closer to being done I'm getting closer to making this mod more universal for all liquids. Right now after a bit of coding i can say i have: *Fixed Pipes *Fixed Tanks *Removed Mengenta as a color(no need for another simi red/pinkish color) *Create a IColor interface for future use with other color selective blocks *Created a object feed version of get for PipeColor so you can use numbers, Strings, or LiquidData to ID a color. Useful for setColor(Object obj) *Worked on some textures however i need to either make a better model for tanks or find a texture artist for help *Found the tank model files so they can be edited Issues still to be worked on *Lang file, still item names are not working *Release Valve *Pipe Changer tool, not sure if i should use a GUI with the tool or have 15 color brushs. The ladder seems wasteful *Block, and bucket for Waste Liquid *Textures need some help, especial Tanks so i can add the rest of the colored version to the creative menu *Crafting for all Pipes, Tanks, and items need redone or added for the new system *Pumps needs reworked to have a diffrent version for lava,water, and large area pumping. Small version for filling system, large for draining source pools for constuction. Lava pump will fall under large. Might add an oil pump, or create one for oil craft using the same design. *Tanks still need to be tested and fixed to create pressure for Pipes if side == down and liquid || side == up and gas *LiquidHandler needs worked on to pre catch and add liquids to the allowed List similar to how e methain, oil, fuel are register.
2013-01-07 04:24:28 +01:00
{
pos = Math.min((stack.amount / LiquidContainerRegistry.BUCKET_VOLUME), 4);
if(meta == ColorCode.NONE.ordinal())
getting Closer to being done I'm getting closer to making this mod more universal for all liquids. Right now after a bit of coding i can say i have: *Fixed Pipes *Fixed Tanks *Removed Mengenta as a color(no need for another simi red/pinkish color) *Create a IColor interface for future use with other color selective blocks *Created a object feed version of get for PipeColor so you can use numbers, Strings, or LiquidData to ID a color. Useful for setColor(Object obj) *Worked on some textures however i need to either make a better model for tanks or find a texture artist for help *Found the tank model files so they can be edited Issues still to be worked on *Lang file, still item names are not working *Release Valve *Pipe Changer tool, not sure if i should use a GUI with the tool or have 15 color brushs. The ladder seems wasteful *Block, and bucket for Waste Liquid *Textures need some help, especial Tanks so i can add the rest of the colored version to the creative menu *Crafting for all Pipes, Tanks, and items need redone or added for the new system *Pumps needs reworked to have a diffrent version for lava,water, and large area pumping. Small version for filling system, large for draining source pools for constuction. Lava pump will fall under large. Might add an oil pump, or create one for oil craft using the same design. *Tanks still need to be tested and fixed to create pressure for Pipes if side == down and liquid || side == up and gas *LiquidHandler needs worked on to pre catch and add liquids to the allowed List similar to how e methain, oil, fuel are register.
2013-01-07 04:24:28 +01:00
{
guageMeta = ColorCode.get(stack).ordinal();
getting Closer to being done I'm getting closer to making this mod more universal for all liquids. Right now after a bit of coding i can say i have: *Fixed Pipes *Fixed Tanks *Removed Mengenta as a color(no need for another simi red/pinkish color) *Create a IColor interface for future use with other color selective blocks *Created a object feed version of get for PipeColor so you can use numbers, Strings, or LiquidData to ID a color. Useful for setColor(Object obj) *Worked on some textures however i need to either make a better model for tanks or find a texture artist for help *Found the tank model files so they can be edited Issues still to be worked on *Lang file, still item names are not working *Release Valve *Pipe Changer tool, not sure if i should use a GUI with the tool or have 15 color brushs. The ladder seems wasteful *Block, and bucket for Waste Liquid *Textures need some help, especial Tanks so i can add the rest of the colored version to the creative menu *Crafting for all Pipes, Tanks, and items need redone or added for the new system *Pumps needs reworked to have a diffrent version for lava,water, and large area pumping. Small version for filling system, large for draining source pools for constuction. Lava pump will fall under large. Might add an oil pump, or create one for oil craft using the same design. *Tanks still need to be tested and fixed to create pressure for Pipes if side == down and liquid || side == up and gas *LiquidHandler needs worked on to pre catch and add liquids to the allowed List similar to how e methain, oil, fuel are register.
2013-01-07 04:24:28 +01:00
}
}
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
if (connectionHelper.corner(te) > 0)
{
bindTextureByName(this.getCornerTexture(meta));
int corner = connectionHelper.corner(te);
switch (corner)
{
case 2:
GL11.glRotatef(270f, 0f, 1f, 0f);
break;
case 3:
GL11.glRotatef(0f, 0f, 1f, 0f);
break;
case 4:
GL11.glRotatef(90f, 0f, 1f, 0f);
break;
case 1:
GL11.glRotatef(180f, 0f, 1f, 0f);
break;
}
modelC.render(0.0625F);
}
else
{
bindTextureByName(this.getTankTexture(meta));
model.renderMain(0.0625F);
getting Closer to being done I'm getting closer to making this mod more universal for all liquids. Right now after a bit of coding i can say i have: *Fixed Pipes *Fixed Tanks *Removed Mengenta as a color(no need for another simi red/pinkish color) *Create a IColor interface for future use with other color selective blocks *Created a object feed version of get for PipeColor so you can use numbers, Strings, or LiquidData to ID a color. Useful for setColor(Object obj) *Worked on some textures however i need to either make a better model for tanks or find a texture artist for help *Found the tank model files so they can be edited Issues still to be worked on *Lang file, still item names are not working *Release Valve *Pipe Changer tool, not sure if i should use a GUI with the tool or have 15 color brushs. The ladder seems wasteful *Block, and bucket for Waste Liquid *Textures need some help, especial Tanks so i can add the rest of the colored version to the creative menu *Crafting for all Pipes, Tanks, and items need redone or added for the new system *Pumps needs reworked to have a diffrent version for lava,water, and large area pumping. Small version for filling system, large for draining source pools for constuction. Lava pump will fall under large. Might add an oil pump, or create one for oil craft using the same design. *Tanks still need to be tested and fixed to create pressure for Pipes if side == down and liquid || side == up and gas *LiquidHandler needs worked on to pre catch and add liquids to the allowed List similar to how e methain, oil, fuel are register.
2013-01-07 04:24:28 +01:00
bindTextureByName(this.getGuageTexture(guageMeta, pos));
model.renderMeter(te, 0.0625F);
}
GL11.glPopMatrix();
}
public static String getTankTexture(int meta)
{
String type = "";
switch (meta)
getting Closer to being done I'm getting closer to making this mod more universal for all liquids. Right now after a bit of coding i can say i have: *Fixed Pipes *Fixed Tanks *Removed Mengenta as a color(no need for another simi red/pinkish color) *Create a IColor interface for future use with other color selective blocks *Created a object feed version of get for PipeColor so you can use numbers, Strings, or LiquidData to ID a color. Useful for setColor(Object obj) *Worked on some textures however i need to either make a better model for tanks or find a texture artist for help *Found the tank model files so they can be edited Issues still to be worked on *Lang file, still item names are not working *Release Valve *Pipe Changer tool, not sure if i should use a GUI with the tool or have 15 color brushs. The ladder seems wasteful *Block, and bucket for Waste Liquid *Textures need some help, especial Tanks so i can add the rest of the colored version to the creative menu *Crafting for all Pipes, Tanks, and items need redone or added for the new system *Pumps needs reworked to have a diffrent version for lava,water, and large area pumping. Small version for filling system, large for draining source pools for constuction. Lava pump will fall under large. Might add an oil pump, or create one for oil craft using the same design. *Tanks still need to be tested and fixed to create pressure for Pipes if side == down and liquid || side == up and gas *LiquidHandler needs worked on to pre catch and add liquids to the allowed List similar to how e methain, oil, fuel are register.
2013-01-07 04:24:28 +01:00
{
case 1:
type = "Lava";
break;
case 4:
type = "Water";
break;
case 14:
type = "Steam";
break;
default:
type = "";
break;
}
getting Closer to being done I'm getting closer to making this mod more universal for all liquids. Right now after a bit of coding i can say i have: *Fixed Pipes *Fixed Tanks *Removed Mengenta as a color(no need for another simi red/pinkish color) *Create a IColor interface for future use with other color selective blocks *Created a object feed version of get for PipeColor so you can use numbers, Strings, or LiquidData to ID a color. Useful for setColor(Object obj) *Worked on some textures however i need to either make a better model for tanks or find a texture artist for help *Found the tank model files so they can be edited Issues still to be worked on *Lang file, still item names are not working *Release Valve *Pipe Changer tool, not sure if i should use a GUI with the tool or have 15 color brushs. The ladder seems wasteful *Block, and bucket for Waste Liquid *Textures need some help, especial Tanks so i can add the rest of the colored version to the creative menu *Crafting for all Pipes, Tanks, and items need redone or added for the new system *Pumps needs reworked to have a diffrent version for lava,water, and large area pumping. Small version for filling system, large for draining source pools for constuction. Lava pump will fall under large. Might add an oil pump, or create one for oil craft using the same design. *Tanks still need to be tested and fixed to create pressure for Pipes if side == down and liquid || side == up and gas *LiquidHandler needs worked on to pre catch and add liquids to the allowed List similar to how e methain, oil, fuel are register.
2013-01-07 04:24:28 +01:00
return LiquidMechanics.RESOURCE_PATH + "tanks/" + type + "Tank.png";
}
public static String getGuageTexture(int meta, int pos)
{
String type = "";
switch (meta)
{
getting Closer to being done I'm getting closer to making this mod more universal for all liquids. Right now after a bit of coding i can say i have: *Fixed Pipes *Fixed Tanks *Removed Mengenta as a color(no need for another simi red/pinkish color) *Create a IColor interface for future use with other color selective blocks *Created a object feed version of get for PipeColor so you can use numbers, Strings, or LiquidData to ID a color. Useful for setColor(Object obj) *Worked on some textures however i need to either make a better model for tanks or find a texture artist for help *Found the tank model files so they can be edited Issues still to be worked on *Lang file, still item names are not working *Release Valve *Pipe Changer tool, not sure if i should use a GUI with the tool or have 15 color brushs. The ladder seems wasteful *Block, and bucket for Waste Liquid *Textures need some help, especial Tanks so i can add the rest of the colored version to the creative menu *Crafting for all Pipes, Tanks, and items need redone or added for the new system *Pumps needs reworked to have a diffrent version for lava,water, and large area pumping. Small version for filling system, large for draining source pools for constuction. Lava pump will fall under large. Might add an oil pump, or create one for oil craft using the same design. *Tanks still need to be tested and fixed to create pressure for Pipes if side == down and liquid || side == up and gas *LiquidHandler needs worked on to pre catch and add liquids to the allowed List similar to how e methain, oil, fuel are register.
2013-01-07 04:24:28 +01:00
case 1:
type = "Lava";
break;
case 12:
type = "Fuel";
break;
default:
type = "";
break;
}
return LiquidMechanics.RESOURCE_PATH + "tanks/guage/" + pos + type + ".png";
}
public static String getCornerTexture(int meta)
{
String type = "";
switch (meta)
{
case 1:
type = "Red";
break;
case 4:
type = "Water";
break;
default:
type = "";
break;
}
return LiquidMechanics.RESOURCE_PATH + "tanks/Corner" + type + "png";
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
{
this.renderAModelAt((TileEntityTank) tileEntity, var2, var4, var6, var8);
}
}