Rendering enhancements! Mechanical Pipes now function better and use the large Transmitter model.
This commit is contained in:
parent
59b945a33f
commit
afae26f9b8
14 changed files with 319 additions and 87 deletions
|
@ -109,7 +109,7 @@ public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
|
|||
{
|
||||
TileEntity nodeTile = node.getTileEntity(((TileEntity)transmitter).worldObj);
|
||||
|
||||
if(TransmissionType.checkTransmissionType(nodeTile, getTransmissionType(), (TileEntity) transmitter))
|
||||
if(TransmissionType.checkTransmissionType(nodeTile, getTransmissionType(), (TileEntity)transmitter))
|
||||
{
|
||||
((ITransmitter<N>)nodeTile).removeFromTransmitterNetwork();
|
||||
newTransporters.add((ITransmitter<N>)nodeTile);
|
||||
|
|
|
@ -187,11 +187,15 @@ public class MekanismRenderer
|
|||
}
|
||||
|
||||
public static void glowOn()
|
||||
{
|
||||
glowOn(15);
|
||||
}
|
||||
|
||||
public static void glowOn(int glow)
|
||||
{
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
lightmapLastX = OpenGlHelper.lastBrightnessX;
|
||||
lightmapLastY = OpenGlHelper.lastBrightnessY;
|
||||
} catch(NoSuchFieldError e) {
|
||||
|
@ -200,11 +204,13 @@ public class MekanismRenderer
|
|||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
float glowRatioX = Math.min(((float)glow/15F)*240F + lightmapLastX, 240);
|
||||
float glowRatioY = Math.min(((float)glow/15F)*240F + lightmapLastY, 240);
|
||||
|
||||
if(!optifineBreak)
|
||||
{
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, glowRatioX, glowRatioY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void glowOff()
|
||||
|
@ -343,7 +349,7 @@ public class MekanismRenderer
|
|||
float cG = (color >> 8 & 0xFF) / 255.0F;
|
||||
float cB = (color & 0xFF) / 255.0F;
|
||||
|
||||
GL11.glColor4f(cR, cG, cB, 1.0F);
|
||||
GL11.glColor3f(cR, cG, cB);
|
||||
}
|
||||
|
||||
public static class DisplayInteger
|
||||
|
|
|
@ -53,7 +53,7 @@ public class TransmitterRenderingHandler implements ISimpleBlockRenderingHandler
|
|||
break;
|
||||
}
|
||||
|
||||
if(metadata != 3 && metadata != 4 && metadata != 5)
|
||||
if(metadata != 2 && metadata != 3 && metadata != 4 && metadata != 5)
|
||||
{
|
||||
smallTransmitter.renderSide(ForgeDirection.UP, true);
|
||||
smallTransmitter.renderSide(ForgeDirection.DOWN, true);
|
||||
|
|
|
@ -80,6 +80,8 @@ public class RenderConfigurableMachine extends TileEntitySpecialRenderer
|
|||
private void pop()
|
||||
{
|
||||
GL11.glPopAttrib();
|
||||
MekanismRenderer.glowOff();
|
||||
MekanismRenderer.blendOff();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
@ -88,9 +90,9 @@ public class RenderConfigurableMachine extends TileEntitySpecialRenderer
|
|||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
MekanismRenderer.glowOn();
|
||||
MekanismRenderer.blendOn();
|
||||
}
|
||||
|
||||
private DisplayInteger getOverlayDisplay(World world, ForgeDirection side, EnumColor color)
|
||||
|
|
|
@ -55,27 +55,20 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
|
|||
|
||||
GL11.glTranslated(getX(data.location.xCoord), getY(data.location.yCoord), getZ(data.location.zCoord));
|
||||
|
||||
if(tileEntity.structure.fluidStored.getFluid() == FluidRegistry.LAVA)
|
||||
{
|
||||
MekanismRenderer.glowOn();
|
||||
}
|
||||
|
||||
boolean gas = tileEntity.structure.fluidStored.getFluid().isGaseous();
|
||||
MekanismRenderer.glowOn(tileEntity.structure.fluidStored.getFluid().getLuminosity());
|
||||
|
||||
int[] displayList = getListAndRender(data, tileEntity.structure.fluidStored.getFluid(), tileEntity.worldObj);
|
||||
if(gas)
|
||||
|
||||
if(tileEntity.structure.fluidStored.getFluid().isGaseous())
|
||||
{
|
||||
GL11.glColor4f(1.F, 1.F, 1.F, (float)tileEntity.structure.fluidStored.amount / (float)tileEntity.clientCapacity);
|
||||
GL11.glColor4f(1F, 1F, 1F, (float)tileEntity.structure.fluidStored.amount / (float)tileEntity.clientCapacity);
|
||||
GL11.glCallList(displayList[getStages(data.height)-1]);
|
||||
}
|
||||
else {
|
||||
GL11.glCallList(displayList[(int)(((float)tileEntity.structure.fluidStored.amount/(float)tileEntity.clientCapacity)*((float)getStages(data.height)-1))]);
|
||||
}
|
||||
|
||||
if(tileEntity.structure.fluidStored.getFluid() == FluidRegistry.LAVA)
|
||||
{
|
||||
MekanismRenderer.glowOff();
|
||||
}
|
||||
MekanismRenderer.glowOff();
|
||||
|
||||
pop();
|
||||
|
||||
|
@ -87,18 +80,12 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
|
|||
|
||||
GL11.glTranslated(getX(valveData.location.xCoord), getY(valveData.location.yCoord), getZ(valveData.location.zCoord));
|
||||
|
||||
if(tileEntity.structure.fluidStored.getFluid() == FluidRegistry.LAVA)
|
||||
{
|
||||
MekanismRenderer.glowOn();
|
||||
}
|
||||
MekanismRenderer.glowOn(tileEntity.structure.fluidStored.getFluid().getLuminosity());
|
||||
|
||||
int display = getValveDisplay(ValveRenderData.get(data, valveData), tileEntity.structure.fluidStored.getFluid(), tileEntity.worldObj).display;
|
||||
GL11.glCallList(display);
|
||||
|
||||
if(tileEntity.structure.fluidStored.getFluid() == FluidRegistry.LAVA)
|
||||
{
|
||||
MekanismRenderer.glowOff();
|
||||
}
|
||||
MekanismRenderer.glowOff();
|
||||
|
||||
pop();
|
||||
}
|
||||
|
|
|
@ -1,20 +1,36 @@
|
|||
package mekanism.client.render.tileentity;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.client.model.ModelTransmitter;
|
||||
import mekanism.client.model.ModelTransmitter.Size;
|
||||
import mekanism.client.model.ModelTransporterBox;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.render.MekanismRenderer.DisplayInteger;
|
||||
import mekanism.client.render.MekanismRenderer.Model3D;
|
||||
import mekanism.common.item.ItemConfigurator;
|
||||
import mekanism.common.tileentity.TileEntityDiversionTransporter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import mekanism.common.transporter.TransporterStack;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mekanism.common.util.TransporterUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
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.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -28,6 +44,10 @@ public class RenderLogisticalTransporter extends TileEntitySpecialRenderer
|
|||
private ModelTransmitter model = new ModelTransmitter(Size.LARGE);
|
||||
private ModelTransporterBox modelBox = new ModelTransporterBox();
|
||||
|
||||
private HashMap<ForgeDirection, HashMap<Integer, DisplayInteger>> cachedOverlays = new HashMap<ForgeDirection, HashMap<Integer, DisplayInteger>>();
|
||||
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private EntityItem entityItem = new EntityItem(null);
|
||||
private RenderItem renderer = (RenderItem)RenderManager.instance.getEntityClassRenderObject(EntityItem.class);
|
||||
|
||||
|
@ -111,5 +131,182 @@ public class RenderLogisticalTransporter extends TileEntitySpecialRenderer
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(meta == 5)
|
||||
{
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
World world = mc.thePlayer.worldObj;
|
||||
ItemStack itemStack = player.getCurrentEquippedItem();
|
||||
MovingObjectPosition pos = player.rayTrace(8.0D, 1.0F);
|
||||
|
||||
if(pos != null && itemStack != null && itemStack.getItem() instanceof ItemConfigurator)
|
||||
{
|
||||
int xPos = MathHelper.floor_double(pos.blockX);
|
||||
int yPos = MathHelper.floor_double(pos.blockY);
|
||||
int zPos = MathHelper.floor_double(pos.blockZ);
|
||||
|
||||
Object3D obj = new Object3D(xPos, yPos, zPos);
|
||||
|
||||
if(obj.equals(Object3D.get(tileEntity)))
|
||||
{
|
||||
int mode = ((TileEntityDiversionTransporter)tileEntity).modes[pos.sideHit];
|
||||
ForgeDirection side = ForgeDirection.getOrientation(pos.sideHit);
|
||||
int offset = MekanismUtils.getSideOffset(side);
|
||||
|
||||
push();
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.8F);
|
||||
|
||||
bindTexture(mode == 0 ? MekanismRenderer.getItemsTexture() : MekanismRenderer.getBlocksTexture());
|
||||
GL11.glTranslatef((float)x, (float)y, (float)z);
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
GL11.glTranslatef(0.5F*Math.abs(offset), 0.5F*Math.abs(offset), 0.5F*Math.abs(offset));
|
||||
|
||||
int display = getOverlayDisplay(world, side, mode).display;
|
||||
GL11.glCallList(display);
|
||||
|
||||
pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void pop()
|
||||
{
|
||||
GL11.glPopAttrib();
|
||||
MekanismRenderer.glowOff();
|
||||
MekanismRenderer.blendOff();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void push()
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
MekanismRenderer.glowOn();
|
||||
MekanismRenderer.blendOn();
|
||||
}
|
||||
|
||||
private DisplayInteger getOverlayDisplay(World world, ForgeDirection side, int mode)
|
||||
{
|
||||
if(cachedOverlays.containsKey(side) && cachedOverlays.get(side).containsKey(mode))
|
||||
{
|
||||
return cachedOverlays.get(side).get(mode);
|
||||
}
|
||||
|
||||
Icon icon = null;
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case 0:
|
||||
icon = Item.gunpowder.getIcon(new ItemStack(Item.gunpowder), 0);
|
||||
break;
|
||||
case 1:
|
||||
icon = Block.torchRedstoneActive.getIcon(0, 0);
|
||||
break;
|
||||
case 2:
|
||||
icon = Block.torchRedstoneIdle.getIcon(0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
Model3D toReturn = new Model3D();
|
||||
toReturn.baseBlock = Block.stone;
|
||||
toReturn.setTexture(icon);
|
||||
|
||||
DisplayInteger display = new DisplayInteger();
|
||||
|
||||
if(cachedOverlays.containsKey(side))
|
||||
{
|
||||
cachedOverlays.get(side).put(mode, display);
|
||||
}
|
||||
else {
|
||||
HashMap<Integer, DisplayInteger> map = new HashMap<Integer, DisplayInteger>();
|
||||
map.put(mode, display);
|
||||
cachedOverlays.put(side, map);
|
||||
}
|
||||
|
||||
display.display = GLAllocation.generateDisplayLists(1);
|
||||
GL11.glNewList(display.display, 4864);
|
||||
|
||||
switch(side)
|
||||
{
|
||||
case DOWN:
|
||||
{
|
||||
toReturn.minY = -0.01;
|
||||
toReturn.maxY = 0;
|
||||
|
||||
toReturn.minX = 0;
|
||||
toReturn.minZ = 0;
|
||||
toReturn.maxX = 1;
|
||||
toReturn.maxZ = 1;
|
||||
break;
|
||||
}
|
||||
case UP:
|
||||
{
|
||||
toReturn.minY = 1;
|
||||
toReturn.maxY = 1.01;
|
||||
|
||||
toReturn.minX = 0;
|
||||
toReturn.minZ = 0;
|
||||
toReturn.maxX = 1;
|
||||
toReturn.maxZ = 1;
|
||||
break;
|
||||
}
|
||||
case NORTH:
|
||||
{
|
||||
toReturn.minZ = -0.01;
|
||||
toReturn.maxZ = 0;
|
||||
|
||||
toReturn.minX = 0;
|
||||
toReturn.minY = 0;
|
||||
toReturn.maxX = 1;
|
||||
toReturn.maxY = 1;
|
||||
break;
|
||||
}
|
||||
case SOUTH:
|
||||
{
|
||||
toReturn.minZ = 1;
|
||||
toReturn.maxZ = 1.01;
|
||||
|
||||
toReturn.minX = 0;
|
||||
toReturn.minY = 0;
|
||||
toReturn.maxX = 1;
|
||||
toReturn.maxY = 1;
|
||||
break;
|
||||
}
|
||||
case WEST:
|
||||
{
|
||||
toReturn.minX = -0.01;
|
||||
toReturn.maxX = 0;
|
||||
|
||||
toReturn.minY = 0;
|
||||
toReturn.minZ = 0;
|
||||
toReturn.maxY = 1;
|
||||
toReturn.maxZ = 1;
|
||||
break;
|
||||
}
|
||||
case EAST:
|
||||
{
|
||||
toReturn.minX = 1;
|
||||
toReturn.maxX = 1.01;
|
||||
|
||||
toReturn.minY = 0;
|
||||
toReturn.minZ = 0;
|
||||
toReturn.maxY = 1;
|
||||
toReturn.maxZ = 1;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MekanismRenderer.renderObject(toReturn);
|
||||
GL11.glEndList();
|
||||
|
||||
return display;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,12 +26,12 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class RenderMechanicalPipe extends TileEntitySpecialRenderer
|
||||
{
|
||||
private ModelTransmitter model = new ModelTransmitter(Size.SMALL);
|
||||
private ModelTransmitter model = new ModelTransmitter(Size.LARGE);
|
||||
|
||||
private HashMap<ForgeDirection, HashMap<Fluid, DisplayInteger[]>> cachedLiquids = new HashMap<ForgeDirection, HashMap<Fluid, DisplayInteger[]>>();
|
||||
|
||||
private static final int stages = 40;
|
||||
|
||||
private static final int stages = 100;
|
||||
private static final double height = 0.45;
|
||||
private static final double offset = 0.015;
|
||||
|
||||
@Override
|
||||
|
@ -64,14 +64,13 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
|
|||
{
|
||||
push();
|
||||
|
||||
if(tileEntity.refFluid.getFluid() == FluidRegistry.LAVA)
|
||||
{
|
||||
MekanismRenderer.glowOn();
|
||||
}
|
||||
MekanismRenderer.glowOn(tileEntity.refFluid.getFluid().getLuminosity());
|
||||
|
||||
bindTexture(MekanismRenderer.getBlocksTexture());
|
||||
GL11.glTranslatef((float)x, (float)y, (float)z);
|
||||
|
||||
boolean gas = tileEntity.refFluid.getFluid().isGaseous();
|
||||
|
||||
for(int i = 0; i < 6; i++)
|
||||
{
|
||||
if(connectable[i])
|
||||
|
@ -80,7 +79,14 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
|
|||
|
||||
if(displayLists != null)
|
||||
{
|
||||
displayLists[Math.max(3, (int)((float)tileEntity.fluidScale*(stages-1)))].render();
|
||||
if(!gas)
|
||||
{
|
||||
displayLists[Math.max(0, (int)((float)tileEntity.fluidScale*(stages-1)))].render();
|
||||
}
|
||||
else {
|
||||
GL11.glColor4f(1F, 1F, 1F, tileEntity.fluidScale);
|
||||
displayLists[stages-1].render();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,13 +95,17 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
|
|||
|
||||
if(displayLists != null)
|
||||
{
|
||||
displayLists[Math.max(3, (int)((float)tileEntity.fluidScale*(stages-1)))].render();
|
||||
if(!gas)
|
||||
{
|
||||
displayLists[Math.max(3, (int)((float)tileEntity.fluidScale*(stages-1)))].render();
|
||||
}
|
||||
else {
|
||||
GL11.glColor4f(1F, 1F, 1F, tileEntity.fluidScale);
|
||||
displayLists[stages-1].render();
|
||||
}
|
||||
}
|
||||
|
||||
if(tileEntity.refFluid.getFluid() == FluidRegistry.LAVA)
|
||||
{
|
||||
MekanismRenderer.glowOff();
|
||||
}
|
||||
MekanismRenderer.glowOff();
|
||||
|
||||
pop();
|
||||
}
|
||||
|
@ -158,79 +168,79 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
|
|||
{
|
||||
case UNKNOWN:
|
||||
{
|
||||
toReturn.minX = 0.3 + offset;
|
||||
toReturn.minY = 0.3 + offset;
|
||||
toReturn.minZ = 0.3 + offset;
|
||||
toReturn.minX = 0.25 + offset;
|
||||
toReturn.minY = 0.25 + offset;
|
||||
toReturn.minZ = 0.25 + offset;
|
||||
|
||||
toReturn.maxX = 0.7 - offset;
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 0.7 - offset;
|
||||
toReturn.maxX = 0.75 - offset;
|
||||
toReturn.maxY = 0.25 + offset + ((float)i / (float)stages)*height;
|
||||
toReturn.maxZ = 0.75 - offset;
|
||||
break;
|
||||
}
|
||||
case DOWN:
|
||||
{
|
||||
toReturn.minX = 0.5 + offset - ((float)i / (float)100)/2;
|
||||
toReturn.minX = 0.5 - (((float)i / (float)stages)*height)/2;
|
||||
toReturn.minY = 0.0;
|
||||
toReturn.minZ = 0.5 + offset - ((float)i / (float)100)/2;
|
||||
toReturn.minZ = 0.5 - (((float)i / (float)stages)*height)/2;
|
||||
|
||||
toReturn.maxX = 0.5 - offset + ((float)i / (float)100)/2;
|
||||
toReturn.maxY = 0.3 + offset;
|
||||
toReturn.maxZ = 0.5 - offset + ((float)i / (float)100)/2;
|
||||
toReturn.maxX = 0.5 + (((float)i / (float)stages)*height)/2;
|
||||
toReturn.maxY = 0.25 + offset;
|
||||
toReturn.maxZ = 0.5 + (((float)i / (float)stages)*height)/2;
|
||||
break;
|
||||
}
|
||||
case UP:
|
||||
{
|
||||
toReturn.minX = 0.5 + offset - ((float)i / (float)100)/2;
|
||||
toReturn.minY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.minZ = 0.5 + offset - ((float)i / (float)100)/2;
|
||||
toReturn.minX = 0.5 - (((float)i / (float)stages)*height)/2;
|
||||
toReturn.minY = 0.25 - offset + ((float)i / (float)stages)*height;
|
||||
toReturn.minZ = 0.5 - (((float)i / (float)stages)*height)/2;
|
||||
|
||||
toReturn.maxX = 0.5 - offset + ((float)i / (float)100)/2;
|
||||
toReturn.maxX = 0.5 + (((float)i / (float)stages)*height)/2;
|
||||
toReturn.maxY = 1.0;
|
||||
toReturn.maxZ = 0.5 - offset + ((float)i / (float)100)/2;
|
||||
toReturn.maxZ = 0.5 + (((float)i / (float)stages)*height)/2;
|
||||
break;
|
||||
}
|
||||
case NORTH:
|
||||
{
|
||||
toReturn.minX = 0.3 + offset;
|
||||
toReturn.minY = 0.3 + offset;
|
||||
toReturn.minX = 0.25 + offset;
|
||||
toReturn.minY = 0.25 + offset;
|
||||
toReturn.minZ = 0.0;
|
||||
|
||||
toReturn.maxX = 0.7 - offset;
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 0.3 + offset;
|
||||
toReturn.maxX = 0.75 - offset;
|
||||
toReturn.maxY = 0.25 + offset + ((float)i / (float)stages)*height;
|
||||
toReturn.maxZ = 0.25 + offset;
|
||||
break;
|
||||
}
|
||||
case SOUTH:
|
||||
{
|
||||
toReturn.minX = 0.3 + offset;
|
||||
toReturn.minY = 0.3 + offset;
|
||||
toReturn.minZ = 0.7 - offset;
|
||||
toReturn.minX = 0.25 + offset;
|
||||
toReturn.minY = 0.25 + offset;
|
||||
toReturn.minZ = 0.75 - offset;
|
||||
|
||||
toReturn.maxX = 0.7 - offset;
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxX = 0.75 - offset;
|
||||
toReturn.maxY = 0.25 + offset + ((float)i / (float)stages)*height;
|
||||
toReturn.maxZ = 1.0;
|
||||
break;
|
||||
}
|
||||
case WEST:
|
||||
{
|
||||
toReturn.minX = 0.0;
|
||||
toReturn.minY = 0.3 + offset;
|
||||
toReturn.minZ = 0.3 + offset;
|
||||
toReturn.minY = 0.25 + offset;
|
||||
toReturn.minZ = 0.25 + offset;
|
||||
|
||||
toReturn.maxX = 0.3 + offset;
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 0.7 - offset;
|
||||
toReturn.maxX = 0.25 + offset;
|
||||
toReturn.maxY = 0.25 + offset + ((float)i / (float)stages)*height;
|
||||
toReturn.maxZ = 0.75 - offset;
|
||||
break;
|
||||
}
|
||||
case EAST:
|
||||
{
|
||||
toReturn.minX = 0.7 - offset;
|
||||
toReturn.minY = 0.3 + offset;
|
||||
toReturn.minZ = 0.3 + offset;
|
||||
toReturn.minX = 0.75 - offset;
|
||||
toReturn.minY = 0.25 + offset;
|
||||
toReturn.minZ = 0.25 + offset;
|
||||
|
||||
toReturn.maxX = 1.0;
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 0.7 - offset;
|
||||
toReturn.maxY = 0.25 + offset + ((float)i / (float)stages)*height;
|
||||
toReturn.maxZ = 0.75 - offset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,6 +157,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
|
|||
for(ITransmitter<FluidNetwork> pipe : iterPipes)
|
||||
{
|
||||
if(pipe instanceof TileEntityMechanicalPipe && ((TileEntityMechanicalPipe)pipe).isActive) continue;
|
||||
|
||||
IFluidHandler[] acceptors = PipeUtils.getConnectedAcceptors((TileEntity)pipe);
|
||||
|
||||
for(IFluidHandler acceptor : acceptors)
|
||||
|
|
|
@ -66,7 +66,7 @@ public class BlockTransmitter extends Block
|
|||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(metadata < 3)
|
||||
if(metadata < 2)
|
||||
{
|
||||
return SMALL_MIN_BOUND;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class BlockTransmitter extends Block
|
|||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(metadata < 3)
|
||||
if(metadata < 2)
|
||||
{
|
||||
return SMALL_MAX_BOUND;
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ public class ItemConfigurator extends ItemEnergized
|
|||
{
|
||||
TileEntityMechanicalPipe tileEntity = (TileEntityMechanicalPipe)world.getBlockTileEntity(x, y, z);
|
||||
tileEntity.isActive = !tileEntity.isActive;
|
||||
tileEntity.getTransmitterNetwork().refresh();
|
||||
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTileEntity().setParams(Object3D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ import mekanism.api.transmitters.TransmissionType;
|
|||
import mekanism.common.FluidNetwork;
|
||||
import mekanism.common.ITileNetwork;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PipeUtils;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.PipeUtils;
|
||||
import mekanism.common.network.PacketDataRequest;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -40,6 +40,8 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
|
|||
/** This pipe's active state. */
|
||||
public boolean isActive = false;
|
||||
|
||||
public int transferDelay = 0;
|
||||
|
||||
/** The scale (0F -> 1F) of this pipe's fluid level. */
|
||||
public float fluidScale;
|
||||
|
||||
|
@ -47,13 +49,15 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
|
|||
{
|
||||
if(fluidStack.isFluidEqual(refFluid))
|
||||
{
|
||||
fluidScale = Math.min(1, fluidScale+((float)fluidStack.amount/50F));
|
||||
fluidScale = Math.min(1, fluidScale+((float)fluidStack.amount/1000F));
|
||||
}
|
||||
else if(refFluid == null)
|
||||
{
|
||||
refFluid = fluidStack.copy();
|
||||
fluidScale += Math.min(1, ((float)fluidStack.amount/50F));
|
||||
fluidScale += Math.min(1, ((float)fluidStack.amount/1000F));
|
||||
}
|
||||
|
||||
transferDelay = 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -146,12 +150,18 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
|
|||
{
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
if(fluidScale > 0)
|
||||
if(transferDelay == 0)
|
||||
{
|
||||
fluidScale -= .01;
|
||||
if(fluidScale > 0)
|
||||
{
|
||||
fluidScale -= .01;
|
||||
}
|
||||
else {
|
||||
refFluid = null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
refFluid = null;
|
||||
transferDelay--;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -169,7 +179,7 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
|
|||
|
||||
if(received != null && received.amount != 0)
|
||||
{
|
||||
container.drain(side, getTransmitterNetwork().emit(received, true, Object3D.get(this).getFromSide(side).getTileEntity(worldObj)), true);
|
||||
container.drain(side, getTransmitterNetwork().emit(received, true, (TileEntity)container), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1069,6 +1069,24 @@ public final class MekanismUtils
|
|||
return Mekanism.hooks.BuildCraftLoaded || Mekanism.forceBuildcraft;
|
||||
}
|
||||
|
||||
public static int getSideOffset(ForgeDirection side)
|
||||
{
|
||||
if(side.offsetX != 0)
|
||||
{
|
||||
return side.offsetX;
|
||||
}
|
||||
else if(side.offsetY != 0)
|
||||
{
|
||||
return side.offsetY;
|
||||
}
|
||||
else if(side.offsetZ != 0)
|
||||
{
|
||||
return side.offsetZ;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static enum ResourceType
|
||||
{
|
||||
GUI("gui"),
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 9.1 KiB |
Loading…
Add table
Reference in a new issue