Just about done with rendering, next steps are final bug fixes and inventory management implementations

This commit is contained in:
Aidan C. Brady 2013-10-22 21:13:23 -04:00
parent 8cc6d3222a
commit 9fabab18a3
10 changed files with 179 additions and 81 deletions

View file

@ -113,8 +113,7 @@ public class ModelRendererSelectiveFace
GL11.glTranslatef(-rotationPointX * scaleFactor, -rotationPointY * scaleFactor, -rotationPointZ * scaleFactor);
}
}
else
{
else {
GL11.glPushMatrix();
GL11.glTranslatef(rotationPointX * scaleFactor, rotationPointY * scaleFactor, rotationPointZ * scaleFactor);

View file

@ -26,53 +26,103 @@ public class ModelTransmitter extends ModelBase
ModelRendererSelectiveFace Left;
ModelRendererSelectiveFace Right;
public ModelTransmitter()
public ModelTransmitter(Size size)
{
textureWidth = 64;
textureHeight = 64;
Center = new ModelRendererSelectiveFace(this, 0, 0);
Center.addBox(0F, 0F, 0F, 6, 6, 6);
Center.setRotationPoint(-3F, 13F, -3F);
Center.setTextureSize(64, 64);
Center.mirror = true;
setRotation(Center, 0F, 0F, 0F);
Up = new ModelRendererSelectiveFace(this, 0, 13);
Up.addBox(0F, 0F, 0F, 6, 5, 6);
Up.setRotationPoint(-3F, 8F, -3F);
Up.setTextureSize(64, 64);
Up.mirror = true;
setRotation(Up, 0F, 0F, 0F);
Down = new ModelRendererSelectiveFace(this, 26, 13);
Down.addBox(0F, 0F, 0F, 6, 5, 6);
Down.setRotationPoint(-3F, 19F, -3F);
Down.setTextureSize(64, 64);
Down.mirror = true;
setRotation(Down, 0F, 0F, 0F);
Front = new ModelRendererSelectiveFace(this, 0, 26);
Front.addBox(0F, 0F, 0F, 5, 6, 6);
Front.setRotationPoint(-3F, 13F, -3F);
Front.setTextureSize(64, 64);
Front.mirror = true;
setRotation(Front, 0F, 1.570796F, 0F);
Back = new ModelRendererSelectiveFace(this, 0, 41);
Back.addBox(0F, 0F, 0F, 5, 6, 6);
Back.setRotationPoint(-3F, 13F, 8F);
Back.setTextureSize(64, 64);
Back.mirror = true;
setRotation(Back, 0F, 1.570796F, 0F);
Left = new ModelRendererSelectiveFace(this, 26, 0);
Left.addBox(0F, 0F, 0F, 6, 5, 6);
Left.setRotationPoint(3F, 19F, 3F);
Left.setTextureSize(64, 64);
Left.mirror = true;
setRotation(Left, 1.570796F, 1.570796F, 0F);
Right = new ModelRendererSelectiveFace(this, 26, 26);
Right.addBox(0F, 0F, 0F, 6, 5, 6);
Right.setRotationPoint(-8F, 19F, 3F);
Right.setTextureSize(64, 64);
Right.mirror = true;
setRotation(Right, 1.570796F, 1.570796F, 0F);
if(size == Size.LARGE)
{
textureWidth = 128;
textureHeight = 128;
Center = new ModelRendererSelectiveFace(this, 0, 0);
Center.addBox(0F, 0F, 0F, 8, 8, 8);
Center.setRotationPoint(-4F, 12F, -4F);
Center.setTextureSize(64, 64);
Center.mirror = true;
setRotation(Center, 0F, 0F, 0F);
Up = new ModelRendererSelectiveFace(this, 0, 13);
Up.addBox(0F, 0F, 0F, 8, 4, 8);
Up.setRotationPoint(-4F, 8F, -4F);
Up.setTextureSize(64, 64);
Up.mirror = true;
setRotation(Up, 0F, 0F, 0F);
Down = new ModelRendererSelectiveFace(this, 34, 13);
Down.addBox(0F, 0F, 0F, 8, 4, 8);
Down.setRotationPoint(-4F, 20F, -4F);
Down.setTextureSize(64, 64);
Down.mirror = true;
setRotation(Down, 0F, 0F, 0F);
Front = new ModelRendererSelectiveFace(this, 0, 30);
Front.addBox(0F, 0F, 0F, 4, 8, 8);
Front.setRotationPoint(-4F, 12F, -4F);
Front.setTextureSize(64, 64);
Front.mirror = true;
setRotation(Front, 0F, 1.570796F, 0F);
Back = new ModelRendererSelectiveFace(this, 0, 49);
Back.addBox(0F, 0F, 0F, 4, 8, 8);
Back.setRotationPoint(-4F, 12F, 8F);//
Back.setTextureSize(64, 64);
Back.mirror = true;
setRotation(Back, 0F, 1.570796F, 0F);
Left = new ModelRendererSelectiveFace(this, 34, 0);
Left.addBox(0F, 0F, 0F, 8, 4, 8);
Left.setRotationPoint(4F, 20F, 4F);
Left.setTextureSize(64, 64);
Left.mirror = true;
setRotation(Left, 1.570796F, 1.570796F, 0F);
Right = new ModelRendererSelectiveFace(this, 34, 30);
Right.addBox(0F, 0F, 0F, 8, 4, 8);
Right.setRotationPoint(-8F, 20F, 4F);
Right.setTextureSize(64, 64);
Right.mirror = true;
setRotation(Right, 1.570796F, 1.570796F, 0F);
}
else {
textureWidth = 64;
textureHeight = 64;
Center = new ModelRendererSelectiveFace(this, 0, 0);
Center.addBox(0F, 0F, 0F, 6, 6, 6);
Center.setRotationPoint(-3F, 13F, -3F);
Center.setTextureSize(64, 64);
Center.mirror = true;
setRotation(Center, 0F, 0F, 0F);
Up = new ModelRendererSelectiveFace(this, 0, 13);
Up.addBox(0F, 0F, 0F, 6, 5, 6);
Up.setRotationPoint(-3F, 8F, -3F);
Up.setTextureSize(64, 64);
Up.mirror = true;
setRotation(Up, 0F, 0F, 0F);
Down = new ModelRendererSelectiveFace(this, 26, 13);
Down.addBox(0F, 0F, 0F, 6, 5, 6);
Down.setRotationPoint(-3F, 19F, -3F);
Down.setTextureSize(64, 64);
Down.mirror = true;
setRotation(Down, 0F, 0F, 0F);
Front = new ModelRendererSelectiveFace(this, 0, 26);
Front.addBox(0F, 0F, 0F, 5, 6, 6);
Front.setRotationPoint(-3F, 13F, -3F);
Front.setTextureSize(64, 64);
Front.mirror = true;
setRotation(Front, 0F, 1.570796F, 0F);
Back = new ModelRendererSelectiveFace(this, 0, 41);
Back.addBox(0F, 0F, 0F, 5, 6, 6);
Back.setRotationPoint(-3F, 13F, 8F);
Back.setTextureSize(64, 64);
Back.mirror = true;
setRotation(Back, 0F, 1.570796F, 0F);
Left = new ModelRendererSelectiveFace(this, 26, 0);
Left.addBox(0F, 0F, 0F, 6, 5, 6);
Left.setRotationPoint(3F, 19F, 3F);
Left.setTextureSize(64, 64);
Left.mirror = true;
setRotation(Left, 1.570796F, 1.570796F, 0F);
Right = new ModelRendererSelectiveFace(this, 26, 26);
Right.addBox(0F, 0F, 0F, 6, 5, 6);
Right.setRotationPoint(-8F, 19F, 3F);
Right.setTextureSize(64, 64);
Right.mirror = true;
setRotation(Right, 1.570796F, 1.570796F, 0F);
}
}
@Override
@ -128,4 +178,9 @@ public class ModelTransmitter extends ModelBase
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public static enum Size
{
SMALL, LARGE
}
}

View file

@ -2,6 +2,7 @@ package mekanism.client.render.block;
import mekanism.client.ClientProxy;
import mekanism.client.model.ModelTransmitter;
import mekanism.client.model.ModelTransmitter.Size;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.block.Block;
@ -19,7 +20,8 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class TransmitterRenderingHandler implements ISimpleBlockRenderingHandler
{
public ModelTransmitter transmitter = new ModelTransmitter();
public ModelTransmitter smallTransmitter = new ModelTransmitter(Size.SMALL);
public ModelTransmitter largeTransmitter = new ModelTransmitter(Size.LARGE);
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
@ -45,9 +47,17 @@ public class TransmitterRenderingHandler implements ISimpleBlockRenderingHandler
break;
}
transmitter.renderSide(ForgeDirection.UP, true);
transmitter.renderSide(ForgeDirection.DOWN, true);
transmitter.renderCenter(new boolean[]{true, true, false, false, false, false});
if(metadata != 3)
{
smallTransmitter.renderSide(ForgeDirection.UP, true);
smallTransmitter.renderSide(ForgeDirection.DOWN, true);
smallTransmitter.renderCenter(new boolean[]{true, true, false, false, false, false});
}
else {
largeTransmitter.renderSide(ForgeDirection.UP, true);
largeTransmitter.renderSide(ForgeDirection.DOWN, true);
largeTransmitter.renderCenter(new boolean[]{true, true, false, false, false, false});
}
GL11.glEnable(GL11.GL_CULL_FACE);
}

View file

@ -2,6 +2,7 @@ package mekanism.client.render.tileentity;
import mekanism.api.Object3D;
import mekanism.client.model.ModelTransmitter;
import mekanism.client.model.ModelTransmitter.Size;
import mekanism.common.TransporterStack;
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
import mekanism.common.util.MekanismUtils;
@ -22,7 +23,7 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderLogisticalTransporter extends TileEntitySpecialRenderer
{
private ModelTransmitter model = new ModelTransmitter();
private ModelTransmitter model = new ModelTransmitter(Size.LARGE);
private EntityItem entityItem = new EntityItem(null);
private RenderItem renderer = (RenderItem)RenderManager.instance.getEntityClassRenderObject(EntityItem.class);

View file

@ -3,13 +3,14 @@ package mekanism.client.render.tileentity;
import java.util.HashMap;
import mekanism.client.model.ModelTransmitter;
import mekanism.client.model.ModelTransmitter.Size;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.render.MekanismRenderer.DisplayInteger;
import mekanism.client.render.MekanismRenderer.Model3D;
import mekanism.common.PipeUtils;
import mekanism.common.tileentity.TileEntityMechanicalPipe;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import mekanism.common.PipeUtils;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@ -25,7 +26,7 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderMechanicalPipe extends TileEntitySpecialRenderer
{
private ModelTransmitter model = new ModelTransmitter();
private ModelTransmitter model = new ModelTransmitter(Size.SMALL);
private HashMap<ForgeDirection, HashMap<Fluid, DisplayInteger[]>> cachedLiquids = new HashMap<ForgeDirection, HashMap<Fluid, DisplayInteger[]>>();

View file

@ -8,6 +8,7 @@ import mekanism.api.gas.EnumGas;
import mekanism.api.gas.GasTransmission;
import mekanism.api.gas.ITubeConnection;
import mekanism.client.model.ModelTransmitter;
import mekanism.client.model.ModelTransmitter.Size;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.render.MekanismRenderer.BooleanArray;
import mekanism.client.render.MekanismRenderer.DisplayInteger;
@ -29,7 +30,7 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderPressurizedTube extends TileEntitySpecialRenderer
{
private ModelTransmitter model = new ModelTransmitter();
private ModelTransmitter model = new ModelTransmitter(Size.SMALL);
private boolean[] connectable;

View file

@ -5,6 +5,7 @@ import java.util.Map;
import mekanism.client.MekanismClient;
import mekanism.client.model.ModelTransmitter;
import mekanism.client.model.ModelTransmitter.Size;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.render.MekanismRenderer.BooleanArray;
import mekanism.client.render.MekanismRenderer.DisplayInteger;
@ -27,7 +28,7 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderUniversalCable extends TileEntitySpecialRenderer
{
private static ModelTransmitter model = new ModelTransmitter();
private static ModelTransmitter model = new ModelTransmitter(Size.SMALL);
private static Icon renderIcon = MekanismRenderer.getTextureMap(1).registerIcon("mekanism:LiquidEnergy");

View file

@ -49,18 +49,46 @@ import cpw.mods.fml.relauncher.SideOnly;
*/
public class BlockTransmitter extends Block
{
public static final float MIN_BOUND = 0.3125F;
public static final float MAX_BOUND = 0.6875F;
public static final float SMALL_MIN_BOUND = 0.3125F;
public static final float SMALL_MAX_BOUND = 0.6875F;
public static final float LARGE_MIN_BOUND = 0.25F;
public static final float LARGE_MAX_BOUND = 0.75F;
public BlockTransmitter(int id)
{
super(id, Material.wood);
setHardness(2.0F);
setResistance(5.0F);
setBlockBounds(MIN_BOUND, MIN_BOUND, MIN_BOUND, MAX_BOUND, MAX_BOUND, MAX_BOUND);
setCreativeTab(Mekanism.tabMekanism);
}
public float getMinBound(IBlockAccess world, int x, int y, int z)
{
int metadata = world.getBlockMetadata(x, y, z);
if(metadata < 3)
{
return SMALL_MIN_BOUND;
}
else {
return LARGE_MIN_BOUND;
}
}
public float getMaxBound(IBlockAccess world, int x, int y, int z)
{
int metadata = world.getBlockMetadata(x, y, z);
if(metadata < 3)
{
return SMALL_MAX_BOUND;
}
else {
return LARGE_MAX_BOUND;
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister register) {}
@ -86,42 +114,42 @@ public class BlockTransmitter extends Block
{
boolean[] connectable = getConnectable(world, x, y, z);
setBlockBounds(MIN_BOUND, MIN_BOUND, MIN_BOUND, MAX_BOUND, MAX_BOUND, MAX_BOUND);
setBlockBounds(getMinBound(world, x, y, z), getMinBound(world, x, y, z), getMinBound(world, x, y, z), getMaxBound(world, x, y, z), getMaxBound(world, x, y, z), getMaxBound(world, x, y, z));
super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, list, entity);
if(connectable[4])
{
setBlockBounds(0.0F, MIN_BOUND, MIN_BOUND, MAX_BOUND, MAX_BOUND, MAX_BOUND);
setBlockBounds(0.0F, getMinBound(world, x, y, z), getMinBound(world, x, y, z), getMaxBound(world, x, y, z), getMaxBound(world, x, y, z), getMaxBound(world, x, y, z));
super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, list, entity);
}
if(connectable[5])
{
setBlockBounds(MIN_BOUND, MIN_BOUND, MIN_BOUND, 1.0F, MAX_BOUND, MAX_BOUND);
setBlockBounds(getMinBound(world, x, y, z), getMinBound(world, x, y, z), getMinBound(world, x, y, z), 1.0F, getMaxBound(world, x, y, z), getMaxBound(world, x, y, z));
super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, list, entity);
}
if(connectable[0])
{
setBlockBounds(MIN_BOUND, 0.0F, MIN_BOUND, MAX_BOUND, MAX_BOUND, MAX_BOUND);
setBlockBounds(getMinBound(world, x, y, z), 0.0F, getMinBound(world, x, y, z), getMaxBound(world, x, y, z), getMaxBound(world, x, y, z), getMaxBound(world, x, y, z));
super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, list, entity);
}
if(connectable[1])
{
setBlockBounds(MIN_BOUND, MIN_BOUND, MIN_BOUND, MAX_BOUND, 1.0F, MAX_BOUND);
setBlockBounds(getMinBound(world, x, y, z), getMinBound(world, x, y, z), getMinBound(world, x, y, z), getMaxBound(world, x, y, z), 1.0F, getMaxBound(world, x, y, z));
super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, list, entity);
}
if(connectable[2])
{
setBlockBounds(MIN_BOUND, MIN_BOUND, 0.0F, MAX_BOUND, MAX_BOUND, MAX_BOUND);
setBlockBounds(getMinBound(world, x, y, z), getMinBound(world, x, y, z), 0.0F, getMaxBound(world, x, y, z), getMaxBound(world, x, y, z), getMaxBound(world, x, y, z));
super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, list, entity);
}
if(connectable[3])
{
setBlockBounds(MIN_BOUND, MIN_BOUND, MIN_BOUND, MAX_BOUND, MAX_BOUND, 1.0F);
setBlockBounds(getMinBound(world, x, y, z), getMinBound(world, x, y, z), getMinBound(world, x, y, z), getMaxBound(world, x, y, z), getMaxBound(world, x, y, z), 1.0F);
super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, list, entity);
}
@ -135,12 +163,12 @@ public class BlockTransmitter extends Block
if(connectable != null)
{
float minX = MIN_BOUND;
float minY = MIN_BOUND;
float minZ = MIN_BOUND;
float maxX = MAX_BOUND;
float maxY = MAX_BOUND;
float maxZ = MAX_BOUND;
float minX = getMinBound(world, x, y, z);
float minY = getMinBound(world, x, y, z);
float minZ = getMinBound(world, x, y, z);
float maxX = getMaxBound(world, x, y, z);
float maxY = getMaxBound(world, x, y, z);
float maxZ = getMaxBound(world, x, y, z);
if(connectable[0])
{
@ -227,12 +255,12 @@ public class BlockTransmitter extends Block
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
float minX = MIN_BOUND;
float minY = MIN_BOUND;
float minZ = MIN_BOUND;
float maxX = MAX_BOUND;
float maxY = MAX_BOUND;
float maxZ = MAX_BOUND;
float minX = getMinBound(world, x, y, z);
float minY = getMinBound(world, x, y, z);
float minZ = getMinBound(world, x, y, z);
float maxX = getMaxBound(world, x, y, z);
float maxY = getMaxBound(world, x, y, z);
float maxZ = getMaxBound(world, x, y, z);
boolean[] connectable = getConnectable(world, x, y, z);

View file

@ -30,6 +30,8 @@ import cpw.mods.fml.relauncher.SideOnly;
public class TileEntityLogisticalTransporter extends TileEntityTransmitter<InventoryNetwork> implements ITileNetwork
{
private static final int SPEED = 5;
public Set<TransporterStack> transit = new HashSet<TransporterStack>();
public boolean needsSync = false;
@ -46,7 +48,7 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
stack.clientFirstTick = false;
}
else {
stack.progress++;
stack.progress += SPEED;
}
}
}
@ -65,7 +67,7 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
}
}
stack.progress++;
stack.progress += SPEED;
if(stack.progress > 100)
{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 10 KiB