Some work on new tank renderer
This commit is contained in:
parent
6d38db4d68
commit
3048d94f7a
5 changed files with 228 additions and 250 deletions
|
@ -25,6 +25,6 @@ public class ClientProxy extends CommonProxy
|
|||
MinecraftForgeClient.registerItemRenderer(Mechanical.blockTank.blockID, new ItemTankRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(Mechanical.blockPipe.blockID, new ItemPipeRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TilePipe.class, new RenderPipe());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTank.class, new RenderTank());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTank.class, RenderTank.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
|
||||
public class BlockTank extends BlockFluidNetwork
|
||||
{
|
||||
public static int tankVolume = 16;
|
||||
|
||||
public BlockTank()
|
||||
{
|
||||
super("tank");
|
||||
|
@ -39,9 +37,17 @@ public class BlockTank extends BlockFluidNetwork
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass()
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderType()
|
||||
{
|
||||
return MechanicalBlockRenderingHandler.ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,20 +57,6 @@ public class BlockTank extends BlockFluidNetwork
|
|||
return checkBlockID == this.blockID ? false : super.shouldSideBeRendered(blockAccess, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderType()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
package resonantinduction.mechanical.fluid.tank;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.render.RenderFluidHelper;
|
||||
import resonantinduction.mechanical.Mechanical;
|
||||
import resonantinduction.old.client.model.ModelTankSide;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
@ -20,105 +16,52 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class ItemTankRenderer implements IItemRenderer
|
||||
{
|
||||
private ModelTankSide tank = new ModelTankSide();
|
||||
private ModelTankSide tank = new ModelTankSide();
|
||||
private final TileTank tileTank = new TileTank();
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
if (item.itemID == Mechanical.blockTank.blockID)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||
|
||||
if (type == ItemRenderType.ENTITY)
|
||||
{
|
||||
GL11.glTranslatef(0F, 0.2F, 0F);
|
||||
}
|
||||
else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON)
|
||||
{
|
||||
GL11.glTranslatef(0.4F, 0.6F, 0.2F);
|
||||
}
|
||||
else if (type == ItemRenderType.EQUIPPED)
|
||||
{
|
||||
GL11.glTranslatef(0.1F, 0.4F, 1.2F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef(0.7F, .45F, 0.7F);
|
||||
}
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(Reference.DOMAIN, item.getItemDamage() == 1 ? "textures/blocks/obsidian.png" : "textures/blocks/iron_block.png"));
|
||||
GL11.glTranslatef(0.0F, -0.9F, 0.0F);
|
||||
tank.render(0.0625F, false, false, false, false);
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
tank.render(0.0625F, false, false, false, false);
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
tank.render(0.0625F, false, false, false, false);
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
tank.render(0.0625F, false, false, false, false);
|
||||
GL11.glPopMatrix();
|
||||
if (type == ItemRenderType.ENTITY)
|
||||
{
|
||||
GL11.glTranslatef(0F, 0.2F, 0F);
|
||||
}
|
||||
else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON)
|
||||
{
|
||||
GL11.glTranslatef(0.4F, 0.6F, 0.2F);
|
||||
}
|
||||
else if (type == ItemRenderType.EQUIPPED)
|
||||
{
|
||||
GL11.glTranslatef(0.1F, 0.4F, 1.2F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef(0.7F, .45F, 0.7F);
|
||||
}
|
||||
|
||||
}
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(Reference.DOMAIN, item.getItemDamage() == 1 ? "textures/blocks/obsidian.png" : "textures/blocks/iron_block.png"));
|
||||
FluidStack fluid = null;
|
||||
if (item.getTagCompound() != null && item.getTagCompound().hasKey("fluid"))
|
||||
{
|
||||
fluid = FluidStack.loadFluidStackFromNBT(item.getTagCompound().getCompoundTag("fluid"));
|
||||
}
|
||||
|
||||
if (item.getTagCompound() != null && item.getTagCompound().hasKey("fluid"))
|
||||
{
|
||||
FluidStack liquid = FluidStack.loadFluidStackFromNBT(item.getTagCompound().getCompoundTag("fluid"));
|
||||
|
||||
if (liquid != null && liquid.amount > 100)
|
||||
{
|
||||
|
||||
int[] displayList = RenderFluidHelper.getFluidDisplayLists(liquid, Minecraft.getMinecraft().theWorld, false);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
//GL11.glScalef(0.80F, 0.9F, 0.80F);
|
||||
if (type == ItemRenderType.ENTITY)
|
||||
{
|
||||
GL11.glTranslatef(-.5F, -0.2F, -.5F);
|
||||
}
|
||||
else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON)
|
||||
{
|
||||
GL11.glTranslatef(-0.1F, 0.2F, -.3F);
|
||||
}
|
||||
else if (type == ItemRenderType.EQUIPPED)
|
||||
{
|
||||
GL11.glScalef(0.9F, 0.9F, 0.9F);
|
||||
GL11.glTranslatef(-0.4F, 0.1F, 0.9F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glScalef(0.80F, 0.9F, 0.80F);
|
||||
GL11.glTranslatef(0.5F, .2F, 0.5F);
|
||||
}
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture((RenderFluidHelper.getFluidSheet(liquid)));
|
||||
|
||||
int cap = BlockTank.tankVolume * FluidContainerRegistry.BUCKET_VOLUME;
|
||||
if (liquid.getFluid().isGaseous())
|
||||
{
|
||||
cap = liquid.amount;
|
||||
}
|
||||
GL11.glCallList(displayList[(int) Math.min(((float) liquid.amount / (float) (cap) * (RenderFluidHelper.DISPLAY_STAGES - 1)), displayList.length - 1)]);
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
RenderTank.INSTANCE.renderTank(tileTank, 0, 0, 0, fluid);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,12 +4,15 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonantinduction.core.render.RenderFluidHelper;
|
||||
import resonantinduction.mechanical.Mechanical;
|
||||
import resonantinduction.old.client.model.ModelTankSide;
|
||||
import calclavia.lib.render.RenderUtility;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.lib.helpers.ColorCode;
|
||||
|
@ -17,111 +20,149 @@ import dark.lib.helpers.ColorCode;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class RenderTank extends TileEntitySpecialRenderer
|
||||
{
|
||||
private ModelTankSide model;
|
||||
public static final RenderTank INSTANCE = new RenderTank();
|
||||
public final ModelTankSide model = new ModelTankSide();
|
||||
|
||||
public RenderTank()
|
||||
{
|
||||
model = new ModelTankSide();
|
||||
}
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float var8)
|
||||
{
|
||||
this.renderTank(tileEntity, x, y, z, tileEntity instanceof TileTank ? ((TileTank) tileEntity).getTank().getFluid() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float var8)
|
||||
{
|
||||
FluidStack liquid = tileEntity instanceof TileTank ? ((TileTank) tileEntity).getTank().getFluid(): null;
|
||||
this.renderTank(tileEntity, x, y, z, 0, liquid);
|
||||
}
|
||||
public void renderTank(TileEntity tileEntity, double x, double y, double z, FluidStack fluid)
|
||||
{
|
||||
byte renderSides = 0;
|
||||
|
||||
public void renderTank(TileEntity tileEntity, double x, double y, double z, int meta, FluidStack liquid)
|
||||
{
|
||||
if (liquid != null && liquid.amount > 100)
|
||||
{
|
||||
int[] displayList = RenderFluidHelper.getFluidDisplayLists(liquid, tileEntity.worldObj, false);
|
||||
if (tileEntity instanceof TileTank)
|
||||
{
|
||||
renderSides = ((TileTank) tileEntity).renderSides;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
boolean down = TileTank.canRenderSide(renderSides, ForgeDirection.UP);
|
||||
boolean up = TileTank.canRenderSide(renderSides, ForgeDirection.DOWN);
|
||||
boolean north = TileTank.canRenderSide(renderSides, ForgeDirection.NORTH);
|
||||
boolean south = TileTank.canRenderSide(renderSides, ForgeDirection.SOUTH);
|
||||
boolean east = TileTank.canRenderSide(renderSides, ForgeDirection.EAST);
|
||||
boolean west = TileTank.canRenderSide(renderSides, ForgeDirection.WEST);
|
||||
|
||||
bindTexture(RenderFluidHelper.getFluidSheet(liquid));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
GL11.glScalef(1.01F, 1.01F, 1.01F);
|
||||
int cap = tileEntity instanceof TileTank ? ((TileTank) tileEntity).getTank().getCapacity() : liquid.amount;
|
||||
GL11.glCallList(displayList[(int) ((float) liquid.amount / (float) (cap) * (RenderFluidHelper.DISPLAY_STAGES - 1))]);
|
||||
if (!east)
|
||||
{
|
||||
if (!north)
|
||||
{
|
||||
// north east
|
||||
RenderUtility.renderCube(0.475, -0.501, -0.501, 0.501, 0.501, -0.475, Mechanical.blockTank, null);
|
||||
}
|
||||
if (!south)
|
||||
{
|
||||
// south east
|
||||
RenderUtility.renderCube(0.475, -0.501, 0.475, 0.501, 0.501, 0.501, Mechanical.blockTank, null);
|
||||
}
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (!down)
|
||||
{
|
||||
// bottom east
|
||||
RenderUtility.renderCube(0.475, -0.501, -0.501, 0.501, -0.475, 0.501, Mechanical.blockTank, null);
|
||||
}
|
||||
|
||||
/*
|
||||
byte renderSides = 0;
|
||||
if (tileEntity instanceof TileTank)
|
||||
{
|
||||
renderSides = ((TileTank) tileEntity).renderSides;
|
||||
}
|
||||
|
||||
boolean bot = TileTank.canRenderSide(renderSides, ForgeDirection.UP);
|
||||
boolean top = TileTank.canRenderSide(renderSides, ForgeDirection.DOWN);
|
||||
boolean north = TileTank.canRenderSide(renderSides, ForgeDirection.NORTH);
|
||||
boolean south = TileTank.canRenderSide(renderSides, ForgeDirection.SOUTH);
|
||||
boolean east = TileTank.canRenderSide(renderSides, ForgeDirection.EAST);
|
||||
boolean west = TileTank.canRenderSide(renderSides, ForgeDirection.WEST);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i + 2);
|
||||
if (!up)
|
||||
{
|
||||
// top east
|
||||
RenderUtility.renderCube(0.475, 0.475, -0.501, 0.501, 0.501, 0.501, Mechanical.blockTank, null);
|
||||
}
|
||||
}
|
||||
|
||||
if (!TileTank.canRenderSide(renderSides, dir.getOpposite()))
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
if (!west)
|
||||
{
|
||||
if (!north)
|
||||
{
|
||||
// north west
|
||||
RenderUtility.renderCube(-0.501, -0.501, -0.501, -0.475, 0.501, -0.475, Mechanical.blockTank, null);
|
||||
}
|
||||
if (!south)
|
||||
{
|
||||
// south west
|
||||
RenderUtility.renderCube(-0.501, -0.501, 0.475, -0.475, 0.501, 0.501, Mechanical.blockTank, null);
|
||||
}
|
||||
if (!down)
|
||||
{
|
||||
// bottom west
|
||||
RenderUtility.renderCube(-0.501, -0.501, -0.501, -0.475, -0.475, 0.501, Mechanical.blockTank, null);
|
||||
}
|
||||
if (!up)
|
||||
{
|
||||
// top west
|
||||
RenderUtility.renderCube(-0.501, 0.475, -0.501, -0.475, 0.501, 0.501, Mechanical.blockTank, null);
|
||||
}
|
||||
}
|
||||
if (!north)
|
||||
{
|
||||
if (!up)
|
||||
{
|
||||
// top north
|
||||
RenderUtility.renderCube(-0.501, 0.475, -0.501, 0.501, 0.501, -0.475, Mechanical.blockTank, null);
|
||||
}
|
||||
if (!down)
|
||||
{
|
||||
// bottom north
|
||||
RenderUtility.renderCube(-0.501, -0.501, -0.501, 0.501, -0.475, -0.475, Mechanical.blockTank, null);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
boolean left = false;
|
||||
boolean right = false;
|
||||
switch (dir)
|
||||
{
|
||||
case NORTH:
|
||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||
left = west;
|
||||
right = east;
|
||||
break;
|
||||
case SOUTH:
|
||||
GL11.glRotatef(0f, 0f, 1f, 0f);
|
||||
left = east;
|
||||
right = west;
|
||||
break;
|
||||
case WEST:
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
left = south;
|
||||
right = north;
|
||||
break;
|
||||
case EAST:
|
||||
GL11.glRotatef(270f, 0f, 1f, 0f);
|
||||
left = north;
|
||||
right = south;
|
||||
break;
|
||||
}
|
||||
bindTexture(this.getTexture(tileEntity.getBlockType().blockID, tileEntity.getBlockMetadata()));
|
||||
model.render(0.0625F, left, right, top, bot);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}*/
|
||||
if (!south)
|
||||
{
|
||||
if (!up)
|
||||
{
|
||||
// top south
|
||||
RenderUtility.renderCube(-0.501, 0.475, 0.475, 0.501, 0.501, 0.501, Mechanical.blockTank, null);
|
||||
}
|
||||
if (!down)
|
||||
{
|
||||
// bottom south
|
||||
RenderUtility.renderCube(-0.501, -0.501, 0.475, 0.501, -0.475, 0.501, Mechanical.blockTank, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
//TODO: Remove
|
||||
fluid = new FluidStack(FluidRegistry.WATER, 8000);
|
||||
|
||||
public ResourceLocation getTexture(int block, int meta)
|
||||
{
|
||||
String texture = "";
|
||||
if (ColorCode.get(meta) == ColorCode.RED)
|
||||
{
|
||||
texture = "textures/blocks/obsidian.png";
|
||||
}
|
||||
else
|
||||
{
|
||||
texture = "textures/blocks/iron_block.png";
|
||||
}
|
||||
return new ResourceLocation(texture);
|
||||
}
|
||||
if (fluid != null && fluid.amount > 100)
|
||||
{
|
||||
int[] displayList = RenderFluidHelper.getFluidDisplayLists(fluid, tileEntity.worldObj, false);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
bindTexture(RenderFluidHelper.getFluidSheet(fluid));
|
||||
// Prevent Z-fighting
|
||||
GL11.glTranslatef((float) x, (float) y + 0.001f, (float) z);
|
||||
int cap = tileEntity instanceof TileTank ? ((TileTank) tileEntity).getTank().getCapacity() : fluid.amount;
|
||||
GL11.glCallList(displayList[(int) ((float) fluid.amount / (float) (cap) * (RenderFluidHelper.DISPLAY_STAGES - 1))]);
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ResourceLocation getTexture(int block, int meta)
|
||||
{
|
||||
String texture = "";
|
||||
if (ColorCode.get(meta) == ColorCode.RED)
|
||||
{
|
||||
texture = "textures/blocks/obsidian.png";
|
||||
}
|
||||
else
|
||||
{
|
||||
texture = "textures/blocks/iron_block.png";
|
||||
}
|
||||
return new ResourceLocation(texture);
|
||||
}
|
||||
}
|
|
@ -8,44 +8,46 @@ import resonantinduction.mechanical.fluid.prefab.TileFluidNetwork;
|
|||
|
||||
public class TileTank extends TileFluidNetwork
|
||||
{
|
||||
public TileTank()
|
||||
{
|
||||
super(BlockTank.tankVolume);
|
||||
}
|
||||
public static final int VOLUME = 16;
|
||||
|
||||
@Override
|
||||
public TankNetwork getNetwork()
|
||||
{
|
||||
if (!(this.network instanceof TankNetwork))
|
||||
{
|
||||
this.setNetwork(new TankNetwork(this));
|
||||
}
|
||||
return (TankNetwork) this.network;
|
||||
}
|
||||
public TileTank()
|
||||
{
|
||||
super(VOLUME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNetwork(IFluidNetwork network)
|
||||
{
|
||||
if (network instanceof TankNetwork)
|
||||
{
|
||||
this.network = (TankNetwork) network;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public TankNetwork getNetwork()
|
||||
{
|
||||
if (!(this.network instanceof TankNetwork))
|
||||
{
|
||||
this.setNetwork(new TankNetwork(this));
|
||||
}
|
||||
return (TankNetwork) this.network;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateConnectionSide(TileEntity tileEntity, ForgeDirection side)
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (tileEntity instanceof TileTank)
|
||||
{
|
||||
if (this.canTileConnect(Connection.NETWORK, side.getOpposite()))
|
||||
{
|
||||
this.getNetwork().merge(((IFluidPart) tileEntity).getNetwork());
|
||||
this.setRenderSide(side, true);
|
||||
connectedBlocks[side.ordinal()] = tileEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setNetwork(IFluidNetwork network)
|
||||
{
|
||||
if (network instanceof TankNetwork)
|
||||
{
|
||||
this.network = (TankNetwork) network;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateConnectionSide(TileEntity tileEntity, ForgeDirection side)
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (tileEntity instanceof TileTank)
|
||||
{
|
||||
if (this.canTileConnect(Connection.NETWORK, side.getOpposite()))
|
||||
{
|
||||
this.getNetwork().merge(((IFluidPart) tileEntity).getNetwork());
|
||||
this.setRenderSide(side, true);
|
||||
connectedBlocks[side.ordinal()] = tileEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue