Started work on Fluidic Plenisher

This commit is contained in:
Aidan C. Brady 2014-06-19 12:42:59 +02:00
parent 55937cd7d4
commit 90da466ca1
13 changed files with 641 additions and 34 deletions

View file

@ -24,6 +24,7 @@ import mekanism.client.gui.GuiEnergizedSmelter;
import mekanism.client.gui.GuiEnergyCube;
import mekanism.client.gui.GuiEnrichmentChamber;
import mekanism.client.gui.GuiFactory;
import mekanism.client.gui.GuiFluidicPlenisher;
import mekanism.client.gui.GuiGasTank;
import mekanism.client.gui.GuiMetallurgicInfuser;
import mekanism.client.gui.GuiOsmiumCompressor;
@ -68,6 +69,7 @@ import mekanism.client.render.tileentity.RenderElectricChest;
import mekanism.client.render.tileentity.RenderElectricPump;
import mekanism.client.render.tileentity.RenderElectrolyticSeparator;
import mekanism.client.render.tileentity.RenderEnergyCube;
import mekanism.client.render.tileentity.RenderFluidicPlenisher;
import mekanism.client.render.tileentity.RenderGasTank;
import mekanism.client.render.tileentity.RenderLogisticalSorter;
import mekanism.client.render.tileentity.RenderMetallurgicInfuser;
@ -115,6 +117,7 @@ import mekanism.common.tile.TileEntityEnergizedSmelter;
import mekanism.common.tile.TileEntityEnergyCube;
import mekanism.common.tile.TileEntityEnrichmentChamber;
import mekanism.common.tile.TileEntityFactory;
import mekanism.common.tile.TileEntityFluidicPlenisher;
import mekanism.common.tile.TileEntityGasTank;
import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.tile.TileEntityMetallurgicInfuser;
@ -297,6 +300,7 @@ public class ClientProxy extends CommonProxy
ClientRegistry.registerTileEntity(TileEntitySeismicVibrator.class, "SeismicVibrator", new RenderSeismicVibrator());
ClientRegistry.registerTileEntity(TileEntityPRC.class, "PressurizedReactionChamber", new RenderPressurizedReactionChamber());
ClientRegistry.registerTileEntity(TileEntityPortableTank.class, "PortableTank", new RenderPortableTank());
ClientRegistry.registerTileEntity(TileEntityFluidicPlenisher.class, "FluidicPlenisher", new RenderFluidicPlenisher());
}
@Override
@ -448,6 +452,8 @@ public class ClientProxy extends CommonProxy
return new GuiPRC(player.inventory, (TileEntityPRC)tileEntity);
case 41:
return new GuiPortableTank(player.inventory, (TileEntityPortableTank)tileEntity);
case 42:
return new GuiFluidicPlenisher(player.inventory, (TileEntityFluidicPlenisher)tileEntity);
}
return null;

View file

@ -0,0 +1,67 @@
package mekanism.client.gui;
import mekanism.client.gui.GuiFluidGauge.IFluidInfoHandler;
import mekanism.client.gui.GuiSlot.SlotOverlay;
import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.common.inventory.container.ContainerFluidicPlenisher;
import mekanism.common.tile.TileEntityFluidicPlenisher;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidTank;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiFluidicPlenisher extends GuiMekanism
{
public TileEntityFluidicPlenisher tileEntity;
public ResourceLocation guiLocation = MekanismUtils.getResource(ResourceType.GUI, "GuiElectricPump.png");
public GuiFluidicPlenisher(InventoryPlayer inventory, TileEntityFluidicPlenisher tentity)
{
super(new ContainerFluidicPlenisher(inventory, tentity));
tileEntity = tentity;
guiElements.add(new GuiSlot(SlotType.NORMAL, this, guiLocation, 27, 19));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, guiLocation, 27, 50));
guiElements.add(new GuiSlot(SlotType.POWER, this, guiLocation, 142, 34).with(SlotOverlay.POWER));
guiElements.add(new GuiPowerBar(this, tileEntity, guiLocation, 164, 15));
guiElements.add(new GuiFluidGauge(new IFluidInfoHandler() {
@Override
public FluidTank getTank()
{
return tileEntity.fluidTank;
}
}, GuiGauge.Type.STANDARD, this, guiLocation, 6, 13));
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
fontRendererObj.drawString(tileEntity.getInventoryName(), 45, 6, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 94) + 2, 0x404040);
fontRendererObj.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), 51, 26, 0x00CD00);
fontRendererObj.drawString(tileEntity.fluidTank.getFluid() != null ? tileEntity.fluidTank.getFluid().getFluid().getName() + ": " + tileEntity.fluidTank.getFluid().amount : MekanismUtils.localize("gui.noFluid"), 51, 35, 0x00CD00);
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
{
mc.renderEngine.bindTexture(guiLocation);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
}
}

View file

@ -47,6 +47,7 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
public ModelChemicalCrystallizer chemicalCrystallizer = new ModelChemicalCrystallizer();
public ModelSeismicVibrator seismicVibrator = new ModelSeismicVibrator();
public ModelPressurizedReactionChamber pressurizedReactionChamber = new ModelPressurizedReactionChamber();
public ModelElectricPump fluidicPlenisher = new ModelElectricPump();
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
@ -173,6 +174,14 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "PressurizedReactionChamber.png"));
pressurizedReactionChamber.render(0.0625F);
}
else if(type == MachineType.FLUIDIC_PLENISHER)
{
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90F, 0.0F, -1.0F, 0.0F);
GL11.glTranslatef(0.0F, -0.85F, 0.0F);
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ElectricPump.png"));
fluidicPlenisher.render(0.0560F);
}
else {
MekanismRenderer.renderItem(renderer, metadata, block);
}

View file

@ -0,0 +1,45 @@
package mekanism.client.render.tileentity;
import mekanism.client.model.ModelElectricPump;
import mekanism.common.tile.TileEntityFluidicPlenisher;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderFluidicPlenisher extends TileEntitySpecialRenderer
{
private ModelElectricPump model = new ModelElectricPump();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
{
renderAModelAt((TileEntityFluidicPlenisher)tileEntity, x, y, z, partialTick);
}
private void renderAModelAt(TileEntityFluidicPlenisher tileEntity, double x, double y, double z, float partialTick)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ElectricPump.png"));
switch(tileEntity.facing)
{
case 2: GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); break;
case 3: GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); break;
case 4: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break;
case 5: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break;
}
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
model.render(0.0625F);
GL11.glPopMatrix();
}
}

View file

@ -21,6 +21,7 @@ import mekanism.common.inventory.container.ContainerElectrolyticSeparator;
import mekanism.common.inventory.container.ContainerEnergyCube;
import mekanism.common.inventory.container.ContainerFactory;
import mekanism.common.inventory.container.ContainerFilter;
import mekanism.common.inventory.container.ContainerFluidicPlenisher;
import mekanism.common.inventory.container.ContainerGasTank;
import mekanism.common.inventory.container.ContainerMetallurgicInfuser;
import mekanism.common.inventory.container.ContainerNull;
@ -61,6 +62,7 @@ import mekanism.common.tile.TileEntityEnergizedSmelter;
import mekanism.common.tile.TileEntityEnergyCube;
import mekanism.common.tile.TileEntityEnrichmentChamber;
import mekanism.common.tile.TileEntityFactory;
import mekanism.common.tile.TileEntityFluidicPlenisher;
import mekanism.common.tile.TileEntityGasTank;
import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.tile.TileEntityMetallurgicInfuser;
@ -132,6 +134,7 @@ public class CommonProxy
GameRegistry.registerTileEntity(TileEntitySeismicVibrator.class, "SeismicVibrator");
GameRegistry.registerTileEntity(TileEntityPRC.class, "PressurizedReactionChamber");
GameRegistry.registerTileEntity(TileEntityPortableTank.class, "PortableTank");
GameRegistry.registerTileEntity(TileEntityFluidicPlenisher.class, "FluidicPlenisher");
}
/**
@ -261,6 +264,7 @@ public class CommonProxy
Mekanism.chemicalCrystallizerUsage = Mekanism.configuration.get("usage", "ChemicalCrystallizerUsage", 400D).getDouble(400D);
Mekanism.seismicVibratorUsage = Mekanism.configuration.get("usage", "SeismicVibratorUsage", 50D).getDouble(50D);
Mekanism.pressurizedReactionBaseUsage = Mekanism.configuration.get("usage", "PressurizedReactionBaseUsage", 5D).getDouble(5D);
Mekanism.fluidicPlenisherUsage = Mekanism.configuration.get("usage", "FluidicPlenisherUsage", 100D).getDouble(100D);
Mekanism.configuration.save();
}
@ -415,6 +419,8 @@ public class CommonProxy
return new ContainerPRC(player.inventory, (TileEntityPRC)tileEntity);
case 41:
return new ContainerPortableTank(player.inventory, (TileEntityPortableTank)tileEntity);
case 42:
return new ContainerFluidicPlenisher(player.inventory, (TileEntityFluidicPlenisher)tileEntity);
}
return null;

View file

@ -336,6 +336,7 @@ public class Mekanism
public static double chemicalCrystallizerUsage;
public static double seismicVibratorUsage;
public static double pressurizedReactionBaseUsage;
public static double fluidicPlenisherUsage;
/**
* Adds all in-game crafting and smelting recipes.

View file

@ -45,6 +45,7 @@ import mekanism.common.tile.TileEntityEliteFactory;
import mekanism.common.tile.TileEntityEnergizedSmelter;
import mekanism.common.tile.TileEntityEnrichmentChamber;
import mekanism.common.tile.TileEntityFactory;
import mekanism.common.tile.TileEntityFluidicPlenisher;
import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.tile.TileEntityMetallurgicInfuser;
import mekanism.common.tile.TileEntityOsmiumCompressor;
@ -1262,7 +1263,8 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
CHEMICAL_CRYSTALLIZER(Mekanism.MachineBlock2, 8, "ChemicalCrystallizer", 37, 20000, TileEntityChemicalCrystallizer.class, true, true, false),
SEISMIC_VIBRATOR(Mekanism.MachineBlock2, 9, "SeismicVibrator", 39, 20000, TileEntitySeismicVibrator.class, true, true, false),
PRESSURIZED_REACTION_CHAMBER(Mekanism.MachineBlock2, 10, "PressurizedReactionChamber", 40, 20000, TileEntityPRC.class, true, true, false),
PORTABLE_TANK(Mekanism.MachineBlock2, 11, "PortableTank", 41, 0, TileEntityPortableTank.class, false, true, false);
PORTABLE_TANK(Mekanism.MachineBlock2, 11, "PortableTank", 41, 0, TileEntityPortableTank.class, false, true, false),
FLUIDIC_PLENISHER(Mekanism.MachineBlock2, 12, "FluidicPlenisher", 42, 10000, TileEntityFluidicPlenisher.class, true, true, false);
public Block typeBlock;
public int meta;

View file

@ -0,0 +1,150 @@
package mekanism.common.inventory.container;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotOutput;
import mekanism.common.tile.TileEntityFluidicPlenisher;
import mekanism.common.util.ChargeUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidContainerRegistry;
public class ContainerFluidicPlenisher extends Container
{
private TileEntityFluidicPlenisher tileEntity;
public ContainerFluidicPlenisher(InventoryPlayer inventory, TileEntityFluidicPlenisher tentity)
{
tileEntity = tentity;
addSlotToContainer(new Slot(tentity, 0, 28, 20));
addSlotToContainer(new SlotOutput(tentity, 1, 28, 51));
addSlotToContainer(new SlotDischarge(tentity, 2, 143, 35));
int slotX;
for(slotX = 0; slotX < 3; ++slotX)
{
for(int slotY = 0; slotY < 9; ++slotY)
{
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18));
}
}
for(slotX = 0; slotX < 9; ++slotX)
{
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
}
tileEntity.open(inventory.player);
tileEntity.openInventory();
}
@Override
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onContainerClosed(entityplayer);
tileEntity.close(entityplayer);
tileEntity.closeInventory();
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer)
{
return tileEntity.isUseableByPlayer(entityplayer);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{
ItemStack stack = null;
Slot currentSlot = (Slot)inventorySlots.get(slotID);
if(currentSlot != null && currentSlot.getHasStack())
{
ItemStack slotStack = currentSlot.getStack();
stack = slotStack.copy();
if(ChargeUtils.canBeDischarged(slotStack))
{
if(slotID != 2)
{
if(!mergeItemStack(slotStack, 2, 3, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
{
return null;
}
}
}
else if(FluidContainerRegistry.isEmptyContainer(slotStack))
{
if(slotID != 0)
{
if(!mergeItemStack(slotStack, 0, 1, false))
{
return null;
}
}
else if(slotID == 0)
{
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
{
return null;
}
}
}
else if(slotID == 1)
{
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
{
return null;
}
}
else {
if(slotID >= 3 && slotID <= 29)
{
if(!mergeItemStack(slotStack, 30, inventorySlots.size(), false))
{
return null;
}
}
else if(slotID > 29)
{
if(!mergeItemStack(slotStack, 3, 29, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
{
return null;
}
}
}
if(slotStack.stackSize == 0)
{
currentSlot.putStack((ItemStack)null);
}
else {
currentSlot.onSlotChanged();
}
if(slotStack.stackSize == stack.stackSize)
{
return null;
}
currentSlot.onPickupFromSlot(player, slotStack);
}
return stack;
}
}

View file

@ -822,7 +822,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
MachineType type = MachineType.get((ItemStack)data[0]);
return type == MachineType.ELECTRIC_PUMP || type == MachineType.ROTARY_CONDENSENTRATOR
|| type == MachineType.PORTABLE_TANK;
|| type == MachineType.PORTABLE_TANK || type == MachineType.FLUIDIC_PLENISHER;
}
@Override

View file

@ -71,6 +71,7 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
dataStream.writeDouble(Mekanism.chemicalWasherUsage);
dataStream.writeDouble(Mekanism.chemicalCrystallizerUsage);
dataStream.writeDouble(Mekanism.seismicVibratorUsage);
dataStream.writeDouble(Mekanism.fluidicPlenisherUsage);
try {
for(IModule module : Mekanism.modulesLoaded)
@ -135,6 +136,7 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
Mekanism.chemicalWasherUsage = dataStream.readDouble();
Mekanism.chemicalCrystallizerUsage = dataStream.readDouble();
Mekanism.seismicVibratorUsage = dataStream.readDouble();
Mekanism.fluidicPlenisherUsage = dataStream.readDouble();
try {
for(IModule module : Mekanism.modulesLoaded)

View file

@ -37,7 +37,7 @@ import net.minecraftforge.fluids.IFluidHandler;
public class TileEntityElectricPump extends TileEntityElectricBlock implements IFluidHandler, ISustainedTank, IConfigurable
{
/** This pump's tank */
public FluidTank fluidTank;
public FluidTank fluidTank = new FluidTank(10000);
/** The nodes that have full sources near them or in them */
public Set<Coord4D> recurringNodes = new HashSet<Coord4D>();
@ -48,52 +48,54 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
public TileEntityElectricPump()
{
super("ElectricPump", 10000);
fluidTank = new FluidTank(10000);
inventory = new ItemStack[3];
}
@Override
public void onUpdate()
{
ChargeUtils.discharge(2, this);
if(inventory[0] != null)
if(!worldObj.isRemote)
{
if(fluidTank.getFluid() != null && fluidTank.getFluid().amount >= FluidContainerRegistry.BUCKET_VOLUME)
ChargeUtils.discharge(2, this);
if(inventory[0] != null)
{
if(FluidContainerRegistry.isEmptyContainer(inventory[0]))
if(fluidTank.getFluid() != null && fluidTank.getFluid().amount >= FluidContainerRegistry.BUCKET_VOLUME)
{
ItemStack tempStack = FluidContainerRegistry.fillFluidContainer(fluidTank.getFluid(), inventory[0]);
if(tempStack != null)
if(FluidContainerRegistry.isEmptyContainer(inventory[0]))
{
if(inventory[1] == null)
ItemStack tempStack = FluidContainerRegistry.fillFluidContainer(fluidTank.getFluid(), inventory[0]);
if(tempStack != null)
{
fluidTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
inventory[1] = tempStack;
inventory[0].stackSize--;
if(inventory[0].stackSize <= 0)
if(inventory[1] == null)
{
inventory[0] = null;
fluidTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
inventory[1] = tempStack;
inventory[0].stackSize--;
if(inventory[0].stackSize <= 0)
{
inventory[0] = null;
}
markDirty();
}
markDirty();
}
else if(tempStack.isItemEqual(inventory[1]) && tempStack.getMaxStackSize() > inventory[1].stackSize)
{
fluidTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
inventory[1].stackSize++;
inventory[0].stackSize--;
if(inventory[0].stackSize <= 0)
else if(tempStack.isItemEqual(inventory[1]) && tempStack.getMaxStackSize() > inventory[1].stackSize)
{
inventory[0] = null;
fluidTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
inventory[1].stackSize++;
inventory[0].stackSize--;
if(inventory[0].stackSize <= 0)
{
inventory[0] = null;
}
markDirty();
}
markDirty();
}
}
}

View file

@ -0,0 +1,314 @@
package mekanism.common.tile;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.IConfigurable;
import mekanism.common.ISustainedTank;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.PipeUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentText;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implements IConfigurable, IFluidHandler, ISustainedTank
{
public Set<Coord4D> activeNodes = new HashSet<Coord4D>();
public FluidTank fluidTank = new FluidTank(10000);
public TileEntityFluidicPlenisher()
{
super("FluidicPlenisher", MachineType.FLUIDIC_PLENISHER.baseEnergy);
inventory = new ItemStack[3];
}
@Override
public void onUpdate()
{
if(!worldObj.isRemote)
{
ChargeUtils.discharge(2, this);
if(FluidContainerRegistry.isFilledContainer(inventory[0]))
{
FluidStack itemFluid = FluidContainerRegistry.getFluidForFilledItem(inventory[0]);
if((fluidTank.getFluid() == null && itemFluid.amount <= fluidTank.getCapacity()) || fluidTank.getFluid().amount+itemFluid.amount <= fluidTank.getCapacity())
{
if(fluidTank.getFluid() != null && !fluidTank.getFluid().isFluidEqual(itemFluid))
{
return;
}
ItemStack containerItem = inventory[0].getItem().getContainerItem(inventory[0]);
boolean filled = false;
if(containerItem != null)
{
if(inventory[1] == null || (inventory[1].isItemEqual(containerItem) && inventory[1].stackSize+1 <= containerItem.getMaxStackSize()))
{
inventory[0] = null;
if(inventory[1] == null)
{
inventory[1] = containerItem;
}
else {
inventory[1].stackSize++;
}
filled = true;
}
}
else {
inventory[0].stackSize--;
if(inventory[0].stackSize == 0)
{
inventory[0] = null;
}
filled = true;
}
if(filled)
{
fluidTank.fill(itemFluid, true);
}
}
}
if(g)
doPlenish();
}
}
private void doPlenish()
{
}
@Override
public void handlePacketData(ByteBuf dataStream)
{
super.handlePacketData(dataStream);
if(dataStream.readInt() == 1)
{
fluidTank.setFluid(new FluidStack(dataStream.readInt(), dataStream.readInt()));
}
else {
fluidTank.setFluid(null);
}
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
}
@Override
public ArrayList getNetworkedData(ArrayList data)
{
super.getNetworkedData(data);
if(fluidTank.getFluid() != null)
{
data.add(1);
data.add(fluidTank.getFluid().fluidID);
data.add(fluidTank.getFluid().amount);
}
else {
data.add(0);
}
return data;
}
public int getScaledFluidLevel(int i)
{
return fluidTank.getFluid() != null ? fluidTank.getFluid().amount*i / 10000 : 0;
}
@Override
public void writeToNBT(NBTTagCompound nbtTags)
{
super.writeToNBT(nbtTags);
if(fluidTank.getFluid() != null)
{
nbtTags.setTag("fluidTank", fluidTank.writeToNBT(new NBTTagCompound()));
}
}
@Override
public void readFromNBT(NBTTagCompound nbtTags)
{
super.readFromNBT(nbtTags);
if(nbtTags.hasKey("fluidTank"))
{
fluidTank.readFromNBT(nbtTags.getCompoundTag("fluidTank"));
}
}
@Override
public boolean isItemValidForSlot(int slotID, ItemStack itemstack)
{
if(slotID == 1)
{
return false;
}
else if(slotID == 0)
{
return FluidContainerRegistry.isFilledContainer(itemstack);
}
else if(slotID == 2)
{
return ChargeUtils.canBeDischarged(itemstack);
}
return false;
}
@Override
public boolean canExtractItem(int slotID, ItemStack itemstack, int side)
{
if(slotID == 2)
{
return ChargeUtils.canBeOutputted(itemstack, false);
}
else if(slotID == 1)
{
return true;
}
return false;
}
@Override
protected EnumSet<ForgeDirection> getConsumingSides()
{
return EnumSet.of(ForgeDirection.getOrientation(facing).getOpposite());
}
@Override
public boolean canSetFacing(int side)
{
return side != 0 && side != 1;
}
@Override
public int[] getAccessibleSlotsFromSide(int side)
{
if(side == 1)
{
return new int[] {0};
}
else if(side == 0)
{
return new int[] {1};
}
else {
return new int[] {2};
}
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection direction)
{
if(direction == ForgeDirection.getOrientation(1))
{
return new FluidTankInfo[] {fluidTank.getInfo()};
}
return PipeUtils.EMPTY;
}
@Override
public void setFluidStack(FluidStack fluidStack, Object... data)
{
fluidTank.setFluid(fluidStack);
}
@Override
public FluidStack getFluidStack(Object... data)
{
return fluidTank.getFluid();
}
@Override
public boolean hasTank(Object... data)
{
return true;
}
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
{
if(fluidTank.getFluid() != null && fluidTank.getFluid().getFluid() == resource.getFluid() && from == ForgeDirection.getOrientation(1))
{
return drain(from, resource.amount, doDrain);
}
return null;
}
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{
if(from == ForgeDirection.UP)
{
return fluidTank.fill(resource, true);
}
return 0;
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
{
return null;
}
@Override
public boolean canFill(ForgeDirection from, Fluid fluid)
{
return from == ForgeDirection.UP;
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid)
{
return false;
}
@Override
public boolean onSneakRightClick(EntityPlayer player, int side)
{
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + MekanismUtils.localize("tooltip.configurator.plenisherReset")));
return true;
}
@Override
public boolean onRightClick(EntityPlayer player, int side)
{
return false;
}
}

View file

@ -102,6 +102,7 @@ tile.MachineBlock2.SeismicVibrator.name=Seismic Vibrator
tile.MachineBlock2.PressurizedReactionChamber.name=Pressurized Reaction Chamber
tile.MachineBlock2.PressurizedReactionChamber.short.name=PRC
tile.MachineBlock2.PortableTank.name=Portable Tank
tile.MachineBlock2.FluidicPlenisher.name=Fluidic Plenisher
//Plastic
tile.PlasticBlock.name=Plastic Block
@ -430,6 +431,7 @@ tooltip.configurator.noLink=No link
tooltip.configurator.linkMsg=Bound to
tooltip.configurator.dim=dimension
tooltip.configurator.setLink=Set link to block
tooltip.configurator.plenisherReset=Reset Fluidic Plenisher calculation
tooltip.upgrade.speed=Speed
tooltip.upgrade.energy=Energy
@ -521,6 +523,7 @@ tooltip.ChemicalCrystallizer=An ultimate machine used to crystallize !npurified
tooltip.SeismicVibrator=A machine that uses seismic vibrations to !nprovide information on differing layers !nof the world.
tooltip.PressurizedReactionChamber=An advanced machine that processes a solid, liquid and gaseous mixture and creates both a gaseous and solid product.
tooltip.PortableTank=A handy, portable tank that lets you carry 14 !nbuckets of fluid wherever you !nplease. Also doubles as a bucket!
tooltip.FluidicPlenisher=A machine that is capable of creating entire !nlakes by filling ravines with fluids.
tooltip.HeatGenerator=A generator that uses the heat of lava or !nother burnable resources to produce energy.
tooltip.SolarGenerator=A generator that uses the power of the !nsun to produce energy.