added model for construction pump

This commit is contained in:
Rseifert 2013-04-15 07:30:59 -04:00
parent 69a33f940f
commit ae9a6227f7
7 changed files with 193 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -5,6 +5,7 @@ import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import fluidmech.client.render.BlockRenderHelper;
import fluidmech.client.render.ItemRenderHelper;
import fluidmech.client.render.RenderConstructionPump;
import fluidmech.client.render.RenderGearRod;
import fluidmech.client.render.RenderGenerator;
import fluidmech.client.render.RenderPump;
@ -17,6 +18,7 @@ import fluidmech.common.FluidMech;
import fluidmech.common.machines.mech.TileEntityGenerator;
import fluidmech.common.machines.mech.TileEntityRod;
import fluidmech.common.machines.pipes.TileEntityPipe;
import fluidmech.common.pump.TileEntityConstructionPump;
import fluidmech.common.pump.TileEntityStarterPump;
import fluidmech.common.tiles.TileEntityReleaseValve;
import fluidmech.common.tiles.TileEntitySink;
@ -41,6 +43,7 @@ public class ClientProxy extends CommonProxy
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTank.class, new RenderTank());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityReleaseValve.class, new RenderReleaseValve());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySink.class, new RenderSink());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityConstructionPump.class, new RenderConstructionPump());
MinecraftForgeClient.registerItemRenderer(FluidMech.blockPipe.blockID, new ItemRenderHelper());
MinecraftForgeClient.registerItemRenderer(FluidMech.blockReleaseValve.blockID, new ItemRenderHelper());

View file

@ -0,0 +1,94 @@
// Date: 4/15/2013 6:17:44 AM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package fluidmech.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
public class ModelConstructionPump extends ModelBase
{
// fields
ModelRenderer Side3;
ModelRenderer Motor2;
ModelRenderer Motor;
ModelRenderer side;
ModelRenderer base;
ModelRenderer side2;
ModelRenderer side4;
public ModelConstructionPump()
{
textureWidth = 128;
textureHeight = 128;
Side3 = new ModelRenderer(this, 46, 37);
Side3.addBox(-5F, 0F, -3F, 10, 11, 5);
Side3.setRotationPoint(0F, 10F, -4F);
Side3.setTextureSize(64, 32);
Side3.mirror = true;
setRotation(Side3, 0F, 0F, 0F);
Motor2 = new ModelRenderer(this, 10, 23);
Motor2.addBox(-4F, -4F, 0F, 8, 8, 4);
Motor2.setRotationPoint(0F, 15F, -2F);
Motor2.setTextureSize(64, 32);
Motor2.mirror = true;
setRotation(Motor2, 0F, 0F, 0F);
Motor = new ModelRenderer(this, 10, 23);
Motor.addBox(-4F, -4F, 0F, 8, 8, 4);
Motor.setRotationPoint(0F, 15F, -2F);
Motor.setTextureSize(64, 32);
Motor.mirror = true;
setRotation(Motor, 0F, 0F, 0.7853982F);
side = new ModelRenderer(this, 15, 37);
side.addBox(-5F, 0F, -3F, 10, 11, 5);
side.setRotationPoint(0F, 10F, 5F);
side.setTextureSize(64, 32);
side.mirror = true;
setRotation(side, 0F, 0F, 0F);
base = new ModelRenderer(this, 16, 54);
base.addBox(-7F, 0F, -8F, 14, 3, 16);
base.setRotationPoint(0F, 21F, 0F);
base.setTextureSize(64, 32);
base.mirror = true;
setRotation(base, 0F, 0F, 0F);
side2 = new ModelRenderer(this, 0, 37);
side2.addBox(-3F, 0F, 2F, 6, 10, 1);
side2.setRotationPoint(0F, 11F, 5F);
side2.setTextureSize(64, 32);
side2.mirror = true;
setRotation(side2, 0F, 0F, 0F);
side4 = new ModelRenderer(this, 77, 37);
side4.addBox(-3F, 0F, -3F, 6, 10, 1);
side4.setRotationPoint(0F, 11F, -5F);
side4.setTextureSize(64, 32);
side4.mirror = true;
setRotation(side4, 0F, 0F, 0F);
}
public void render(float f5)
{
Side3.render(f5);
side.render(f5);
base.render(f5);
side2.render(f5);
side4.render(f5);
}
public void renderMotor(float f5)
{
Motor2.render(f5);
Motor.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -9,6 +9,7 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import fluidmech.client.model.ModelConstructionPump;
import fluidmech.client.model.ModelGearRod;
import fluidmech.client.model.ModelGenerator;
import fluidmech.client.model.ModelLargePipe;
@ -29,6 +30,7 @@ public class BlockRenderHelper implements ISimpleBlockRenderingHandler
private ModelLiquidTank tank = new ModelLiquidTank();
private ModelReleaseValve valve = new ModelReleaseValve();
private ModelSink sink = new ModelSink();
private ModelConstructionPump conPump = new ModelConstructionPump();
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
@ -81,6 +83,16 @@ public class BlockRenderHelper implements ISimpleBlockRenderingHandler
modelGen.render(null);
GL11.glPopMatrix();
}
if (block.blockID == FluidMech.blockConPump.blockID && metadata < 4)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) 0.0F, (float) 1.1F, (float) 0.0F);
GL11.glRotatef(180f, 0f, 0f, 1f);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(FluidMech.MODEL_TEXTURE_DIRECTORY + "ConstructionPump.png"));
conPump.render(0.0725F);
conPump.renderMotor(0.0725F);
GL11.glPopMatrix();
}
}
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{

View file

@ -0,0 +1,56 @@
package fluidmech.client.render;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import fluidmech.client.model.ModelConstructionPump;
import fluidmech.client.model.ModelGenerator;
import fluidmech.common.FluidMech;
import fluidmech.common.pump.TileEntityConstructionPump;
public class RenderConstructionPump extends TileEntitySpecialRenderer
{
int type = 0;
private ModelConstructionPump model;
public RenderConstructionPump()
{
model = new ModelConstructionPump();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float d3)
{
bindTextureByName(FluidMech.MODEL_TEXTURE_DIRECTORY + "ConstructionPump.png");
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.45F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
int meta = tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
switch (meta)
{
case 0:
GL11.glRotatef(0f, 0f, 1f, 0f);
break;
case 1:
GL11.glRotatef(90f, 0f, 1f, 0f);
break;
case 2:
GL11.glRotatef(180f, 0f, 1f, 0f);
break;
case 3:
GL11.glRotatef(270f, 0f, 1f, 0f);
break;
}
model.render(0.0625F);
if(tileEntity instanceof TileEntityConstructionPump)
{
}
model.renderMotor(0.0625F);
GL11.glPopMatrix();
}
}

View file

@ -12,11 +12,13 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.prefab.block.BlockAdvanced;
import fluidmech.client.render.BlockRenderHelper;
import fluidmech.common.FluidMech;
import fluidmech.common.TabFluidMech;
@ -78,7 +80,7 @@ public class BlockConstructionPump extends BlockAdvanced
@Override
public boolean renderAsNormalBlock()
{
return true;
return false;
}
@Override
@ -86,6 +88,11 @@ public class BlockConstructionPump extends BlockAdvanced
{
return 0;
}
@Override
public int getRenderType()
{
return BlockRenderHelper.instance.renderID;
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
@ -114,7 +121,18 @@ public class BlockConstructionPump extends BlockAdvanced
{
if (!world.isRemote)
{
world.setBlockMetadataWithNotify(x, y, z, side, 3);
int meta = world.getBlockMetadata(x, y, z);
int angle = MathHelper.floor_double((entityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (meta == 3)
{
world.setBlockMetadataWithNotify(x, y, z, 0, 3);
}
else
{
world.setBlockMetadataWithNotify(x, y, z, meta + 1, 3);
}
TileEntity entity = world.getBlockTileEntity(x, y, z);
if(entity instanceof TileEntityConstructionPump)
{

View file

@ -23,6 +23,7 @@ public class TileEntityConstructionPump extends TileEntityElectricityRunnable im
/* Fake Internal Tank */
private LiquidTank fakeTank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME);
private int liquidRequest = 5;
public int rotation = 0;
@Override
public void initiate()
@ -52,11 +53,16 @@ public class TileEntityConstructionPump extends TileEntityElectricityRunnable im
@Override
public void updateEntity()
{
// this.wattsReceived >= this.WATTS_PER_TICK
if (!worldObj.isRemote)
{
if (this.ticks % 10 == 0) // TODO add electric Drain
if (this.ticks % 10 == 0 && this.wattsReceived >= this.WATTS_PER_TICK) // TODO add electric Drain
{
this.wattsReceived -= this.WATTS_PER_TICK;
this.rotation += 1;
if(rotation >= 7)
{
rotation = 0;
}
boolean called = false;
TileEntity inputTile = VectorHelper.getTileEntityFromSide(worldObj, new Vector3(this), getFacing(true));