Finished liquid tank render and most code
Still have bugs to work out like liquid trading and glass face not rendering on the model; However, the render looks nice and the corner look better than the old ones.
This commit is contained in:
parent
7734f98cc1
commit
8de1486509
10 changed files with 326 additions and 9 deletions
|
@ -7,6 +7,8 @@ import net.minecraft.src.ItemStack;
|
|||
import net.minecraftforge.common.Configuration;
|
||||
import universalelectricity.BasicComponents;
|
||||
import universalelectricity.network.PacketManager;
|
||||
import basicpipes.LTanks.ItemTank;
|
||||
import basicpipes.LTanks.TileEntityLTank;
|
||||
import basicpipes.conductors.BlockPipe;
|
||||
import basicpipes.conductors.BlockRod;
|
||||
import basicpipes.conductors.ItemGuage;
|
||||
|
@ -44,6 +46,7 @@ public class BasicPipesMain{
|
|||
private static int ppipeID;
|
||||
public static int machineID;
|
||||
private static int toolID;
|
||||
private static int tankID;
|
||||
public static int valveID;
|
||||
public static int rodID;
|
||||
public static Block pipe = new BlockPipe(pipeID).setBlockName("pipe");
|
||||
|
@ -52,6 +55,7 @@ public class BasicPipesMain{
|
|||
public static Block rod = new BlockRod(rodID);
|
||||
public static Item parts = new ItemParts(partID);
|
||||
public static Item itemPipes = new ItemPipe(ppipeID);
|
||||
public static Item itemTank = new ItemTank(tankID);
|
||||
public static Item gauge = new ItemGuage(toolID);
|
||||
|
||||
public static String channel = "Pipes";
|
||||
|
@ -69,6 +73,7 @@ public class BasicPipesMain{
|
|||
partID = Integer.parseInt(config.getOrCreateIntProperty("parts", Configuration.CATEGORY_ITEM, 23022).value);
|
||||
ppipeID = Integer.parseInt(config.getOrCreateIntProperty("pipes", Configuration.CATEGORY_ITEM, 23023).value);
|
||||
toolID = Integer.parseInt(config.getOrCreateIntProperty("ToolID", Configuration.CATEGORY_ITEM, 23024).value);
|
||||
tankID = Integer.parseInt(config.getOrCreateIntProperty("tankID", Configuration.CATEGORY_ITEM, 23025).value);
|
||||
config.save();
|
||||
return pipeID;
|
||||
}
|
||||
|
@ -88,14 +93,20 @@ public class BasicPipesMain{
|
|||
GameRegistry.registerTileEntity(TileEntityPipe.class, "pipe");
|
||||
GameRegistry.registerTileEntity(TileEntityPump.class, "pump");
|
||||
GameRegistry.registerTileEntity(TileEntityRod.class, "rod");
|
||||
GameRegistry.registerTileEntity(TileEntityLTank.class, "ltank");
|
||||
//Names and lang stuff
|
||||
//Pipe Names
|
||||
for(int i =0; i < Liquid.values().length;i++)
|
||||
{
|
||||
LanguageRegistry.addName((new ItemStack(itemPipes, 1, i)), Liquid.getLiquid(i).lName+" Pipe");
|
||||
}
|
||||
for(int i =0; i < Liquid.values().length;i++)
|
||||
{
|
||||
LanguageRegistry.addName((new ItemStack(itemTank, 1, i)), Liquid.getLiquid(i).lName+" Tank");
|
||||
}
|
||||
//Pump
|
||||
LanguageRegistry.addName((new ItemStack(machine, 1, 0)), "WaterPump");
|
||||
LanguageRegistry.addName((new ItemStack(machine, 1, 4)), "WaterCondensor");
|
||||
LanguageRegistry.addName((new ItemStack(rod, 1)), "MechRod");
|
||||
//Tools
|
||||
LanguageRegistry.addName((new ItemStack(gauge, 1, 0)), "PipeGuage");
|
||||
|
|
130
src/common/basicpipes/LTanks/ItemTank.java
Normal file
130
src/common/basicpipes/LTanks/ItemTank.java
Normal file
|
@ -0,0 +1,130 @@
|
|||
package basicpipes.LTanks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import basicpipes.BasicPipesMain;
|
||||
import basicpipes.pipes.api.Liquid;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.CreativeTabs;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemBlock;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
|
||||
public class ItemTank extends Item
|
||||
{
|
||||
int index = 64;//64 + 2 rows alloted to pipes
|
||||
private int spawnID;
|
||||
|
||||
public ItemTank(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
this.setIconIndex(10);
|
||||
this.setItemName("tank");
|
||||
this.setCreativeTab(CreativeTabs.tabRedstone);
|
||||
}
|
||||
@Override
|
||||
public int getIconFromDamage(int par1)
|
||||
{
|
||||
|
||||
return par1+index;
|
||||
}
|
||||
@Override
|
||||
public String getItemNameIS(ItemStack itemstack)
|
||||
{
|
||||
return itemstack.getItemDamage() < Liquid.values().length ? Liquid.getLiquid(itemstack.getItemDamage()).lName+" Tank" : "unknown";
|
||||
}
|
||||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for(int i = 0; i < Liquid.values().length; i++)
|
||||
{
|
||||
par3List.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
public String getTextureFile() {
|
||||
return BasicPipesMain.textureFile+"/Items.png";
|
||||
}
|
||||
@Override
|
||||
public String getItemName()
|
||||
{
|
||||
return "Pipes";
|
||||
}
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
int blockID = par3World.getBlockId(par4, par5, par6);
|
||||
spawnID = BasicPipesMain.machineID;
|
||||
if (blockID == Block.snow.blockID)
|
||||
{
|
||||
par7 = 1;
|
||||
}
|
||||
else if (blockID != Block.vine.blockID && blockID != Block.tallGrass.blockID && blockID != Block.deadBush.blockID)
|
||||
{
|
||||
if (par7 == 0)
|
||||
{
|
||||
--par5;
|
||||
}
|
||||
|
||||
if (par7 == 1)
|
||||
{
|
||||
++par5;
|
||||
}
|
||||
|
||||
if (par7 == 2)
|
||||
{
|
||||
--par6;
|
||||
}
|
||||
|
||||
if (par7 == 3)
|
||||
{
|
||||
++par6;
|
||||
}
|
||||
|
||||
if (par7 == 4)
|
||||
{
|
||||
--par4;
|
||||
}
|
||||
|
||||
if (par7 == 5)
|
||||
{
|
||||
++par4;
|
||||
}
|
||||
}
|
||||
|
||||
if (BasicPipesMain.pipe.canPlaceBlockAt(par3World,par4,par5,par6))
|
||||
{
|
||||
Block var9 = Block.blocksList[this.spawnID];
|
||||
par3World.editingBlocks = true;
|
||||
if (par3World.setBlockAndMetadataWithNotify(par4, par5, par6, var9.blockID,5))
|
||||
{
|
||||
if (par3World.getBlockId(par4, par5, par6) == var9.blockID)
|
||||
{
|
||||
|
||||
Block.blocksList[this.spawnID].onBlockAdded(par3World, par4, par5, par6);
|
||||
Block.blocksList[this.spawnID].onBlockPlacedBy(par3World, par4, par5, par6, par2EntityPlayer);
|
||||
TileEntity blockEntity = par3World.getBlockTileEntity(par4, par5, par6);
|
||||
if(blockEntity instanceof TileEntityLTank)
|
||||
{
|
||||
TileEntityLTank pipeEntity = (TileEntityLTank) blockEntity;
|
||||
Liquid dm = Liquid.getLiquid(par1ItemStack.getItemDamage());
|
||||
pipeEntity.setType(dm);
|
||||
}
|
||||
}
|
||||
|
||||
--par1ItemStack.stackSize;
|
||||
par3World.editingBlocks = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
par3World.editingBlocks = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -193,5 +193,9 @@ public void handlePacketData(NetworkManager network,
|
|||
System.out.print("Fail reading data for Storage tank \n");
|
||||
}
|
||||
|
||||
}
|
||||
public void setType(Liquid dm) {
|
||||
this.type = dm;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
import steampower.turbine.TileEntitySteamPiston;
|
||||
|
||||
import basicpipes.BasicPipesMain;
|
||||
import basicpipes.LTanks.TileEntityLTank;
|
||||
import basicpipes.pipes.api.IMechanical;
|
||||
import basicpipes.pipes.api.Liquid;
|
||||
|
||||
|
@ -69,6 +70,19 @@ public class ItemGuage extends Item
|
|||
player.sendChatToPlayer(print);
|
||||
return true;
|
||||
}
|
||||
if(blockEntity instanceof TileEntityLTank)
|
||||
{
|
||||
TileEntityLTank pipeEntity = (TileEntityLTank) blockEntity;
|
||||
Liquid type = pipeEntity.getType();
|
||||
int steam = pipeEntity.getStoredLiquid(type);
|
||||
String typeName = type.lName;
|
||||
String print = "Error";
|
||||
|
||||
print = typeName +" " + steam;
|
||||
|
||||
player.sendChatToPlayer(print);
|
||||
return true;
|
||||
}
|
||||
if(blockEntity instanceof IMechanical)
|
||||
{
|
||||
IMechanical rod = (IMechanical) blockEntity;
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.src.TileEntity;
|
|||
import net.minecraft.src.World;
|
||||
import basicpipes.BasicPipesMain;
|
||||
import basicpipes.ItemRenderHelper;
|
||||
import basicpipes.LTanks.TileEntityLTank;
|
||||
|
||||
public class BlockMachine extends BlockContainer
|
||||
{
|
||||
|
@ -46,11 +47,7 @@ public class BlockMachine extends BlockContainer
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
if(meta > 3 && meta < 8)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
return 0;
|
||||
return meta;
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1,int meta) {
|
||||
|
@ -59,13 +56,13 @@ public class BlockMachine extends BlockContainer
|
|||
{
|
||||
return new TileEntityPump();
|
||||
}
|
||||
if(meta > 3 && meta < 8)
|
||||
if(meta == 4)
|
||||
{
|
||||
return new TileEntityCondenser();
|
||||
}
|
||||
if(meta > 7 && meta < 12)
|
||||
if(meta == 5)
|
||||
{
|
||||
return new TileEntityValve();
|
||||
return new TileEntityLTank();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -2,9 +2,11 @@ package basicpipes;
|
|||
|
||||
import steampower.SteamPowerMain;
|
||||
import basicpipes.PipeProxy;
|
||||
import basicpipes.LTanks.TileEntityLTank;
|
||||
import basicpipes.conductors.TileEntityPipe;
|
||||
import basicpipes.conductors.TileEntityRod;
|
||||
import basicpipes.machines.TileEntityPump;
|
||||
import basicpipes.renderTank.RenderLTank;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
@ -27,5 +29,6 @@ public class PipeClientProxy extends PipeProxy
|
|||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPipe.class, new RenderPipe());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPump.class, new RenderPump());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRod.class, new RenderGearRod());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLTank.class, new RenderLTank());
|
||||
}
|
||||
}
|
||||
|
|
138
src/minecraft/basicpipes/renderTank/ModelLiquidTankCorner.java
Normal file
138
src/minecraft/basicpipes/renderTank/ModelLiquidTankCorner.java
Normal file
|
@ -0,0 +1,138 @@
|
|||
package basicpipes.renderTank;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.ModelBase;
|
||||
import net.minecraft.src.ModelRenderer;
|
||||
|
||||
public class ModelLiquidTankCorner extends ModelBase
|
||||
{
|
||||
//fields
|
||||
ModelRenderer sOne;
|
||||
ModelRenderer sTwo;
|
||||
ModelRenderer d7;
|
||||
ModelRenderer d5;
|
||||
ModelRenderer d3;
|
||||
ModelRenderer d4;
|
||||
ModelRenderer d1;
|
||||
ModelRenderer d6;
|
||||
ModelRenderer d2;
|
||||
ModelRenderer d8;
|
||||
ModelRenderer d9;
|
||||
ModelRenderer d10;
|
||||
ModelRenderer face;
|
||||
|
||||
public ModelLiquidTankCorner()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 128;
|
||||
|
||||
sOne = new ModelRenderer(this, 0, 30);
|
||||
sOne.addBox(-1F, 0F, -1F, 2, 16, 2);
|
||||
sOne.setRotationPoint(-7F, 8F, 7F);
|
||||
sOne.setTextureSize(128, 128);
|
||||
sOne.mirror = true;
|
||||
setRotation(sOne, 0F, 0F, 0F);
|
||||
sTwo = new ModelRenderer(this, 0, 30);
|
||||
sTwo.addBox(-1F, 0F, -1F, 2, 16, 2);
|
||||
sTwo.setRotationPoint(-7F, 8F, -7F);
|
||||
sTwo.setTextureSize(128, 128);
|
||||
sTwo.mirror = true;
|
||||
setRotation(sTwo, 0F, 0F, 0F);
|
||||
d7 = new ModelRenderer(this, 43, 2);
|
||||
d7.addBox(-1F, 0F, -1F, 2, 16, 12);
|
||||
d7.setRotationPoint(-7F, 8F, -5F);
|
||||
d7.setTextureSize(128, 128);
|
||||
d7.mirror = true;
|
||||
setRotation(d7, 0F, 0F, 0F);
|
||||
d5 = new ModelRenderer(this, 9, 12);
|
||||
d5.addBox(-1F, 0F, -1F, 14, 16, 2);
|
||||
d5.setRotationPoint(-5F, 8F, 7F);
|
||||
d5.setTextureSize(128, 128);
|
||||
d5.mirror = true;
|
||||
setRotation(d5, 0F, 0F, 0F);
|
||||
d3 = new ModelRenderer(this, 9, 67);
|
||||
d3.addBox(-1.5F, 0F, -1.3F, 20, 2, 2);
|
||||
d3.setRotationPoint(-6F, 22F, -6F);
|
||||
d3.setTextureSize(128, 128);
|
||||
d3.mirror = true;
|
||||
setRotation(d3, 0F, -0.7853982F, 0F);
|
||||
d4 = new ModelRenderer(this, 9, 88);
|
||||
d4.addBox(0F, 0F, -9F, 5, 2, 4);
|
||||
d4.setRotationPoint(-6F, 22F, 6F);
|
||||
d4.setTextureSize(128, 128);
|
||||
d4.mirror = true;
|
||||
setRotation(d4, 0F, 0F, 0F);
|
||||
d1 = new ModelRenderer(this, 9, 67);
|
||||
d1.addBox(-1.5F, 0F, -1.3F, 20, 2, 2);
|
||||
d1.setRotationPoint(-6F, 8F, -6F);
|
||||
d1.setTextureSize(128, 128);
|
||||
d1.mirror = true;
|
||||
setRotation(d1, 0F, -0.7853982F, 0F);
|
||||
d6 = new ModelRenderer(this, 9, 75);
|
||||
d6.addBox(-1.5F, 0F, -1.3F, 17, 2, 2);
|
||||
d6.setRotationPoint(-6F, 22F, -4F);
|
||||
d6.setTextureSize(128, 128);
|
||||
d6.mirror = true;
|
||||
setRotation(d6, 0F, -0.7853982F, 0F);
|
||||
d2 = new ModelRenderer(this, 9, 80);
|
||||
d2.addBox(0F, 0F, -5F, 9, 2, 5);
|
||||
d2.setRotationPoint(-6F, 22F, 6F);
|
||||
d2.setTextureSize(128, 128);
|
||||
d2.mirror = true;
|
||||
setRotation(d2, 0F, 0F, 0F);
|
||||
d8 = new ModelRenderer(this, 9, 75);
|
||||
d8.addBox(-1.5F, 0F, -1.3F, 17, 2, 2);
|
||||
d8.setRotationPoint(-6F, 8F, -4F);
|
||||
d8.setTextureSize(128, 128);
|
||||
d8.mirror = true;
|
||||
setRotation(d8, 0F, -0.7853982F, 0F);
|
||||
d9 = new ModelRenderer(this, 9, 88);
|
||||
d9.addBox(0F, 0F, -9F, 5, 2, 4);
|
||||
d9.setRotationPoint(-6F, 8F, 6F);
|
||||
d9.setTextureSize(128, 128);
|
||||
d9.mirror = true;
|
||||
setRotation(d9, 0F, 0F, 0F);
|
||||
d10 = new ModelRenderer(this, 9, 80);
|
||||
d10.addBox(0F, 0F, -5F, 9, 2, 5);
|
||||
d10.setRotationPoint(-6F, 8F, 6F);
|
||||
d10.setTextureSize(128, 128);
|
||||
d10.mirror = true;
|
||||
setRotation(d10, 0F, 0F, 0F);
|
||||
face = new ModelRenderer(this, 0, 50);
|
||||
face.addBox(-8.5F, 0F, 0F, 17, 14, 2);
|
||||
face.setRotationPoint(0F, 9F, 0F);
|
||||
face.setTextureSize(128, 128);
|
||||
face.mirror = true;
|
||||
setRotation(face, 0F, -0.7853982F, 0F);
|
||||
}
|
||||
|
||||
public void render(float f5)
|
||||
{
|
||||
sOne.render(f5);
|
||||
sTwo.render(f5);
|
||||
d7.render(f5);
|
||||
d5.render(f5);
|
||||
d3.render(f5);
|
||||
d4.render(f5);
|
||||
d1.render(f5);
|
||||
d6.render(f5);
|
||||
d2.render(f5);
|
||||
d8.render(f5);
|
||||
d9.render(f5);
|
||||
d10.render(f5);
|
||||
face.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5);
|
||||
}
|
||||
|
||||
}
|
|
@ -6,23 +6,28 @@ import net.minecraft.src.TileEntitySpecialRenderer;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import steampower.SteamPowerMain;
|
||||
|
||||
import basicpipes.BasicPipesMain;
|
||||
import basicpipes.ModelLargePipe;
|
||||
import basicpipes.ModelPipe;
|
||||
import basicpipes.LTanks.TileEntityLTank;
|
||||
import basicpipes.conductors.TileEntityPipe;
|
||||
import basicpipes.pipes.api.Liquid;
|
||||
import basicpipes.pipes.api.MHelper;
|
||||
|
||||
|
||||
public class RenderLTank extends TileEntitySpecialRenderer
|
||||
{
|
||||
private Liquid type = Liquid.DEFUALT;
|
||||
private ModelLiquidTank model;
|
||||
private ModelLiquidTankCorner modelC;
|
||||
private int pos = 0;
|
||||
|
||||
public RenderLTank()
|
||||
{
|
||||
model = new ModelLiquidTank();
|
||||
modelC = new ModelLiquidTankCorner();
|
||||
}
|
||||
|
||||
public void renderAModelAt(TileEntityLTank te, double d, double d1, double d2, float f)
|
||||
|
@ -32,13 +37,28 @@ public class RenderLTank extends TileEntitySpecialRenderer
|
|||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
|
||||
if(MHelper.corner(te) > 0)
|
||||
{
|
||||
bindTextureByName(BasicPipesMain.textureFile+"/tanks/LiquidTankCorner.png");
|
||||
int corner = MHelper.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
|
||||
{
|
||||
switch(type.ordinal())
|
||||
{
|
||||
//case 0: bindTextureByName(BasicPipesMain.textureFile+"/pipes/SixSteamPipe.png");break;
|
||||
default:bindTextureByName(BasicPipesMain.textureFile+"/tanks/LiquidTank"+pos+".png"); break;
|
||||
}
|
||||
model.renderMain(te, 0.0625F);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 28 KiB |
BIN
src/minecraft/textures/tanks/LiquidTankCorner.png
Normal file
BIN
src/minecraft/textures/tanks/LiquidTankCorner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 446 B |
Loading…
Reference in a new issue