redid BC wire model and renderer
Honestly i have to say this was done poorly but then again i think this render is left over from when UE started. Also this will need to be redone some more later to prevent issues were the client sees a connection different then the server. A simple boolean array sent by packet should solve this issue later on.
This commit is contained in:
parent
842b0f69d5
commit
b0493ec3ac
2 changed files with 48 additions and 108 deletions
|
@ -2,7 +2,7 @@ package dark.client.models;
|
|||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -66,53 +66,37 @@ public class ModelCopperWire extends ModelBase
|
|||
setRotation(Bottom, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
public void renderSide(int i)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
this.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
this.renderMiddle();
|
||||
this.renderBottom();
|
||||
this.renderTop();
|
||||
this.renderLeft();
|
||||
this.renderRight();
|
||||
this.renderBack();
|
||||
this.renderFront();
|
||||
this.renderSide(ForgeDirection.getOrientation(i));
|
||||
}
|
||||
|
||||
public void renderMiddle()
|
||||
public void renderSide(ForgeDirection side)
|
||||
{
|
||||
Middle.render(0.0625F);
|
||||
}
|
||||
|
||||
public void renderBottom()
|
||||
{
|
||||
Bottom.render(0.0625F);
|
||||
}
|
||||
|
||||
public void renderTop()
|
||||
{
|
||||
Top.render(0.0625F);
|
||||
}
|
||||
|
||||
public void renderLeft()
|
||||
{
|
||||
Left.render(0.0625F);
|
||||
}
|
||||
|
||||
public void renderRight()
|
||||
{
|
||||
Right.render(0.0625F);
|
||||
}
|
||||
|
||||
public void renderBack()
|
||||
{
|
||||
Back.render(0.0625F);
|
||||
}
|
||||
|
||||
public void renderFront()
|
||||
{
|
||||
Front.render(0.0625F);
|
||||
switch (side)
|
||||
{
|
||||
case UP:
|
||||
Top.render(0.0625F);
|
||||
break;
|
||||
case DOWN:
|
||||
Bottom.render(0.0625F);
|
||||
break;
|
||||
case NORTH:
|
||||
Back.render(0.0625F);
|
||||
break;
|
||||
case SOUTH:
|
||||
Front.render(0.0625F);
|
||||
break;
|
||||
case WEST:
|
||||
Left.render(0.0625F);
|
||||
break;
|
||||
case EAST:
|
||||
Right.render(0.0625F);
|
||||
break;
|
||||
default:
|
||||
Middle.render(0.0625F);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
|
@ -121,10 +105,4 @@ public class ModelCopperWire extends ModelBase
|
|||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float x, float y, float z, float f3, float f4, float f5, Entity entity)
|
||||
{
|
||||
super.setRotationAngles(x, y, z, f3, f4, f5, entity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,6 @@ package dark.client.renders;
|
|||
|
||||
import ic2.api.energy.tile.IEnergyAcceptor;
|
||||
import ic2.api.energy.tile.IEnergyTile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -32,7 +28,7 @@ public class RenderCopperWire extends TileEntitySpecialRenderer
|
|||
|
||||
public static final ModelCopperWire model = new ModelCopperWire();
|
||||
|
||||
public void renderModelAt(TileEntityWire tileEntity, double d, double d1, double d2, float f)
|
||||
public void renderModelAt(TileEntityWire wire, double d, double d1, double d2, float f)
|
||||
{
|
||||
// Texture file
|
||||
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(copperWireTexture);
|
||||
|
@ -40,83 +36,49 @@ public class RenderCopperWire extends TileEntitySpecialRenderer
|
|||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
|
||||
List<TileEntity> adjecentConnections = new ArrayList<TileEntity>();
|
||||
Boolean[] renderSide = new Boolean[6];
|
||||
|
||||
for (byte i = 0; i < 6; i++)
|
||||
{
|
||||
ForgeDirection side = ForgeDirection.getOrientation(i);
|
||||
TileEntity adjacentTile = VectorHelper.getTileEntityFromSide(tileEntity.worldObj, new Vector3(tileEntity), side);
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
TileEntity ent = VectorHelper.getTileEntityFromSide(wire.worldObj, new Vector3(wire), dir);
|
||||
|
||||
if (adjacentTile instanceof IConnector)
|
||||
if (ent instanceof IConnector)
|
||||
{
|
||||
if (((IConnector) adjacentTile).canConnect(side.getOpposite()))
|
||||
if (((IConnector) ent).canConnect(dir.getOpposite()))
|
||||
{
|
||||
adjecentConnections.add(adjacentTile);
|
||||
}
|
||||
else
|
||||
{
|
||||
adjecentConnections.add(null);
|
||||
renderSide[i] = true;
|
||||
}
|
||||
}
|
||||
else if (Compatibility.isIndustrialCraft2Loaded() && adjacentTile instanceof IEnergyTile)
|
||||
else if (Compatibility.isIndustrialCraft2Loaded() && ent instanceof IEnergyTile)
|
||||
{
|
||||
if (adjacentTile instanceof IEnergyAcceptor)
|
||||
if (ent instanceof IEnergyAcceptor)
|
||||
{
|
||||
if (((IEnergyAcceptor) adjacentTile).acceptsEnergyFrom(tileEntity, side.getOpposite()))
|
||||
if (((IEnergyAcceptor) ent).acceptsEnergyFrom(wire, dir.getOpposite()))
|
||||
{
|
||||
adjecentConnections.add(adjacentTile);
|
||||
}
|
||||
else
|
||||
{
|
||||
adjecentConnections.add(null);
|
||||
renderSide[i] = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
adjecentConnections.add(adjacentTile);
|
||||
renderSide[i] = true;
|
||||
}
|
||||
}
|
||||
else if (Compatibility.isBuildcraftLoaded() && adjacentTile instanceof IPowerReceptor)
|
||||
else if (Compatibility.isBuildcraftLoaded() && ent instanceof IPowerReceptor)
|
||||
{
|
||||
adjecentConnections.add(adjacentTile);
|
||||
}
|
||||
else
|
||||
{
|
||||
adjecentConnections.add(null);
|
||||
renderSide[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (adjecentConnections.toArray()[0] != null)
|
||||
{
|
||||
model.renderBottom();
|
||||
}
|
||||
|
||||
if (adjecentConnections.toArray()[1] != null)
|
||||
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
model.renderTop();
|
||||
if(renderSide[side.ordinal()])
|
||||
{
|
||||
model.renderSide(side);
|
||||
}
|
||||
}
|
||||
|
||||
if (adjecentConnections.toArray()[2] != null)
|
||||
{
|
||||
model.renderBack();
|
||||
}
|
||||
|
||||
if (adjecentConnections.toArray()[3] != null)
|
||||
{
|
||||
model.renderFront();
|
||||
}
|
||||
|
||||
if (adjecentConnections.toArray()[4] != null)
|
||||
{
|
||||
model.renderLeft();
|
||||
}
|
||||
|
||||
if (adjecentConnections.toArray()[5] != null)
|
||||
{
|
||||
model.renderRight();
|
||||
}
|
||||
|
||||
model.renderMiddle();
|
||||
model.renderSide(ForgeDirection.UNKNOWN);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue