Converted Centrifuge to scala
This commit is contained in:
parent
6deff382af
commit
b2a874ba9b
8 changed files with 471 additions and 557 deletions
|
@ -1,123 +0,0 @@
|
||||||
package resonantinduction.atomic.machine.centrifuge;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
import net.minecraft.inventory.SlotFurnace;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import resonant.lib.gui.ContainerBase;
|
|
||||||
import resonant.lib.prefab.slot.SlotEnergyItem;
|
|
||||||
import resonantinduction.atomic.Atomic;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Centrifuge container
|
|
||||||
*/
|
|
||||||
public class ContainerCentrifuge extends ContainerBase
|
|
||||||
{
|
|
||||||
private static final int slotCount = 4;
|
|
||||||
private TileCentrifuge tileEntity;
|
|
||||||
|
|
||||||
public ContainerCentrifuge(InventoryPlayer par1InventoryPlayer, TileCentrifuge tileEntity)
|
|
||||||
{
|
|
||||||
super((IInventory) tileEntity);
|
|
||||||
this.tileEntity = tileEntity;
|
|
||||||
// Electric Item
|
|
||||||
this.addSlotToContainer(new SlotEnergyItem((IInventory) tileEntity, 0, 131, 26));
|
|
||||||
// Uranium Gas Tank
|
|
||||||
this.addSlotToContainer(new Slot((IInventory) tileEntity, 1, 25, 50));
|
|
||||||
// Output Uranium 235
|
|
||||||
this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, (IInventory) tileEntity, 2, 81, 26));
|
|
||||||
// Output Uranium 238
|
|
||||||
this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, (IInventory) tileEntity, 3, 101, 26));
|
|
||||||
this.addPlayerInventory(par1InventoryPlayer.player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onContainerClosed(EntityPlayer entityplayer)
|
|
||||||
{
|
|
||||||
super.onContainerClosed(entityplayer);
|
|
||||||
//this.tileEntity.getPlayersUsing().remove(entityplayer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
|
||||||
{
|
|
||||||
return this.tileEntity.isUseableByPlayer(par1EntityPlayer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called to transfer a stack from one inventory to the other eg. when shift clicking.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1)
|
|
||||||
{
|
|
||||||
ItemStack var2 = null;
|
|
||||||
Slot var3 = (Slot) this.inventorySlots.get(par1);
|
|
||||||
|
|
||||||
if (var3 != null && var3.getHasStack())
|
|
||||||
{
|
|
||||||
ItemStack itemStack = var3.getStack();
|
|
||||||
var2 = itemStack.copy();
|
|
||||||
|
|
||||||
if (par1 >= slotCount)
|
|
||||||
{
|
|
||||||
if (this.getSlot(0).isItemValid(itemStack))
|
|
||||||
{
|
|
||||||
if (!this.mergeItemStack(itemStack, 0, 1, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (Atomic.isItemStackUraniumOre(itemStack))
|
|
||||||
{
|
|
||||||
if (!this.mergeItemStack(itemStack, 1, 2, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (Atomic.isItemStackEmptyCell(itemStack))
|
|
||||||
{
|
|
||||||
if (!this.mergeItemStack(itemStack, 3, 4, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (par1 < 27 + slotCount)
|
|
||||||
{
|
|
||||||
if (!this.mergeItemStack(itemStack, 27 + slotCount, 36 + slotCount, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (par1 >= 27 + slotCount && par1 < 36 + slotCount && !this.mergeItemStack(itemStack, 4, 30, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!this.mergeItemStack(itemStack, slotCount, 36 + slotCount, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemStack.stackSize == 0)
|
|
||||||
{
|
|
||||||
var3.putStack((ItemStack) null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var3.onSlotChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemStack.stackSize == var2.stackSize)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var3.onPickupFromSlot(par1EntityPlayer, itemStack);
|
|
||||||
}
|
|
||||||
|
|
||||||
return var2;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
package resonantinduction.atomic.machine.centrifuge
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.{EntityPlayer, InventoryPlayer}
|
||||||
|
import net.minecraft.inventory.{IInventory, Slot, SlotFurnace}
|
||||||
|
import net.minecraft.item.ItemStack
|
||||||
|
import resonant.lib.gui.ContainerBase
|
||||||
|
import resonant.lib.prefab.slot.SlotEnergyItem
|
||||||
|
import resonantinduction.atomic.Atomic
|
||||||
|
|
||||||
|
class ContainerCentrifuge(par1InventoryPlayer: InventoryPlayer, tileEntity: TileCentrifuge) extends ContainerBase(tileEntity)
|
||||||
|
{
|
||||||
|
//Constructor
|
||||||
|
this.addSlotToContainer(new SlotEnergyItem(tileEntity.asInstanceOf[IInventory], 0, 131, 26))
|
||||||
|
this.addSlotToContainer(new Slot(tileEntity.asInstanceOf[IInventory], 1, 25, 50))
|
||||||
|
this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, tileEntity.asInstanceOf[IInventory], 2, 81, 26))
|
||||||
|
this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, tileEntity.asInstanceOf[IInventory], 3, 101, 26))
|
||||||
|
this.addPlayerInventory(par1InventoryPlayer.player)
|
||||||
|
|
||||||
|
override def onContainerClosed(entityplayer: EntityPlayer)
|
||||||
|
{
|
||||||
|
super.onContainerClosed(entityplayer)
|
||||||
|
}
|
||||||
|
|
||||||
|
override def canInteractWith(par1EntityPlayer: EntityPlayer): Boolean =
|
||||||
|
{
|
||||||
|
return this.tileEntity.isUseableByPlayer(par1EntityPlayer)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to transfer a stack from one inventory to the other eg. when shift clicking.
|
||||||
|
*/
|
||||||
|
override def transferStackInSlot(par1EntityPlayer: EntityPlayer, par1: Int): ItemStack =
|
||||||
|
{
|
||||||
|
var var2: ItemStack = null
|
||||||
|
val var3: Slot = this.inventorySlots.get(par1).asInstanceOf[Slot]
|
||||||
|
if (var3 != null && var3.getHasStack)
|
||||||
|
{
|
||||||
|
val itemStack: ItemStack = var3.getStack
|
||||||
|
var2 = itemStack.copy
|
||||||
|
if (par1 >= slotCount)
|
||||||
|
{
|
||||||
|
if (this.getSlot(0).isItemValid(itemStack))
|
||||||
|
{
|
||||||
|
if (!this.mergeItemStack(itemStack, 0, 1, false))
|
||||||
|
{
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Atomic.isItemStackUraniumOre(itemStack))
|
||||||
|
{
|
||||||
|
if (!this.mergeItemStack(itemStack, 1, 2, false))
|
||||||
|
{
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Atomic.isItemStackEmptyCell(itemStack))
|
||||||
|
{
|
||||||
|
if (!this.mergeItemStack(itemStack, 3, 4, false))
|
||||||
|
{
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (par1 < 27 + slotCount)
|
||||||
|
{
|
||||||
|
if (!this.mergeItemStack(itemStack, 27 + slotCount, 36 + slotCount, false))
|
||||||
|
{
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (par1 >= 27 + slotCount && par1 < 36 + slotCount && !this.mergeItemStack(itemStack, 4, 30, false))
|
||||||
|
{
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!this.mergeItemStack(itemStack, slotCount, 36 + slotCount, false))
|
||||||
|
{
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
if (itemStack.stackSize == 0)
|
||||||
|
{
|
||||||
|
var3.putStack(null.asInstanceOf[ItemStack])
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var3.onSlotChanged
|
||||||
|
}
|
||||||
|
if (itemStack.stackSize == var2.stackSize)
|
||||||
|
{
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
var3.onPickupFromSlot(par1EntityPlayer, itemStack)
|
||||||
|
}
|
||||||
|
return var2
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,77 +0,0 @@
|
||||||
package resonantinduction.atomic.machine.centrifuge;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.util.StatCollector;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import resonant.lib.gui.GuiContainerBase;
|
|
||||||
import universalelectricity.api.UnitDisplay;
|
|
||||||
|
|
||||||
public class GuiCentrifuge extends GuiContainerBase
|
|
||||||
{
|
|
||||||
private TileCentrifuge tileEntity;
|
|
||||||
|
|
||||||
public GuiCentrifuge(InventoryPlayer par1InventoryPlayer, TileCentrifuge tileEntity)
|
|
||||||
{
|
|
||||||
super(new ContainerCentrifuge(par1InventoryPlayer, tileEntity));
|
|
||||||
this.tileEntity = tileEntity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draw the foreground layer for the GuiContainer (everything in front of the items)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
|
||||||
{
|
|
||||||
this.fontRendererObj.drawString("Centrifuge", 60, 6, 4210752);
|
|
||||||
|
|
||||||
String displayText = "";
|
|
||||||
|
|
||||||
if (this.tileEntity.timer > 0)
|
|
||||||
{
|
|
||||||
displayText = "Processing";
|
|
||||||
}
|
|
||||||
else if (this.tileEntity.nengYong())
|
|
||||||
{
|
|
||||||
displayText = "Ready";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
displayText = "Idle";
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fontRendererObj.drawString("Status: " + displayText, 70, 50, 4210752);
|
|
||||||
|
|
||||||
this.renderUniversalDisplay(8, 112, TileCentrifuge.DIAN * 20, mouseX, mouseY, UnitDisplay.Unit.WATT);
|
|
||||||
this.renderUniversalDisplay(100, 112, this.tileEntity.electricNode().getVoltage(ForgeDirection.UNKNOWN), mouseX, mouseY, UnitDisplay.Unit.VOLTAGE);
|
|
||||||
|
|
||||||
this.fontRendererObj.drawString("The centrifuge spins", 8, 75, 4210752);
|
|
||||||
this.fontRendererObj.drawString("uranium hexafluoride gas into", 8, 85, 4210752);
|
|
||||||
this.fontRendererObj.drawString("enriched uranium for fission.", 8, 95, 4210752);
|
|
||||||
|
|
||||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
|
||||||
|
|
||||||
//if (this.isPointInRegion(8, 18, this.meterWidth, this.meterHeight, mouseX, mouseY) && this.tileEntity.gasTank.getFluid() != null)
|
|
||||||
//{
|
|
||||||
// this.drawTooltip(mouseX - this.guiLeft, mouseY - this.guiTop + 10, this.tileEntity.gasTank.getFluid().getFluid().getLocalizedName(), this.tileEntity.gasTank.getFluid().amount + " L");
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draw the background layer for the GuiContainer (everything behind the items)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void drawGuiContainerBackgroundLayer(float par1, int x, int y)
|
|
||||||
{
|
|
||||||
super.drawGuiContainerBackgroundLayer(par1, x, y);
|
|
||||||
|
|
||||||
this.drawSlot(80, 25);
|
|
||||||
this.drawSlot(100, 25);
|
|
||||||
this.drawSlot(130, 25, SlotType.BATTERY);
|
|
||||||
|
|
||||||
this.drawBar(40, 26, (float) this.tileEntity.timer / (float) TileCentrifuge.SHI_JIAN);
|
|
||||||
|
|
||||||
// Uranium Gas
|
|
||||||
this.drawMeter(8, 18, (float) this.tileEntity.gasTank.getFluidAmount() / (float) this.tileEntity.gasTank.getCapacity(), this.tileEntity.gasTank.getFluid());
|
|
||||||
this.drawSlot(24, 49, SlotType.GAS);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package resonantinduction.atomic.machine.centrifuge
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer
|
||||||
|
import net.minecraft.util.StatCollector
|
||||||
|
import resonant.lib.gui.GuiContainerBase
|
||||||
|
import resonant.lib.gui.GuiContainerBase.SlotType
|
||||||
|
import universalelectricity.api.UnitDisplay
|
||||||
|
|
||||||
|
class GuiCentrifuge(par1InventoryPlayer: InventoryPlayer, tileEntity: TileCentrifuge) extends GuiContainerBase(new ContainerCentrifuge(par1InventoryPlayer, tileEntity))
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Draw the foreground layer for the GuiContainer (everything in front of the items)
|
||||||
|
*/
|
||||||
|
override def drawGuiContainerForegroundLayer(mouseX: Int, mouseY: Int)
|
||||||
|
{
|
||||||
|
this.fontRendererObj.drawString("Centrifuge", 60, 6, 4210752)
|
||||||
|
var displayText: String = ""
|
||||||
|
if (this.tileEntity.timer > 0)
|
||||||
|
{
|
||||||
|
displayText = "Processing"
|
||||||
|
}
|
||||||
|
else if (this.tileEntity.nengYong)
|
||||||
|
{
|
||||||
|
displayText = "Ready"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
displayText = "Idle"
|
||||||
|
}
|
||||||
|
this.fontRendererObj.drawString("Status: " + displayText, 70, 50, 4210752)
|
||||||
|
this.renderUniversalDisplay(8, 112, TileCentrifuge.DIAN * 20, mouseX, mouseY, UnitDisplay.Unit.WATT)
|
||||||
|
this.renderUniversalDisplay(100, 112, this.tileEntity.getVoltage, mouseX, mouseY, UnitDisplay.Unit.VOLTAGE)
|
||||||
|
this.fontRendererObj.drawString("The centrifuge spins", 8, 75, 4210752)
|
||||||
|
this.fontRendererObj.drawString("uranium hexafluoride gas into", 8, 85, 4210752)
|
||||||
|
this.fontRendererObj.drawString("enriched uranium for fission.", 8, 95, 4210752)
|
||||||
|
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw the background layer for the GuiContainer (everything behind the items)
|
||||||
|
*/
|
||||||
|
protected override def drawGuiContainerBackgroundLayer(par1: Float, x: Int, y: Int)
|
||||||
|
{
|
||||||
|
super.drawGuiContainerBackgroundLayer(par1, x, y)
|
||||||
|
this.drawSlot(80, 25)
|
||||||
|
this.drawSlot(100, 25)
|
||||||
|
this.drawSlot(130, 25, SlotType.BATTERY)
|
||||||
|
this.drawBar(40, 26, this.tileEntity.timer.asInstanceOf[Float] / TileCentrifuge.SHI_JIAN.asInstanceOf[Float])
|
||||||
|
this.drawMeter(8, 18, this.tileEntity.gasTank.getFluidAmount.asInstanceOf[Float] / this.tileEntity.gasTank.getCapacity.asInstanceOf[Float], this.tileEntity.gasTank.getFluid)
|
||||||
|
this.drawSlot(24, 49, SlotType.GAS)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,46 +0,0 @@
|
||||||
package resonantinduction.atomic.machine.centrifuge;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
|
||||||
import net.minecraftforge.client.model.IModelCustom;
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
import resonant.lib.render.RenderUtility;
|
|
||||||
import resonantinduction.core.Reference;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public class RenderCentrifuge extends TileEntitySpecialRenderer
|
|
||||||
{
|
|
||||||
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain(), Reference.modelPath() + "centrifuge.tcn"));
|
|
||||||
public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.domain(), Reference.modelPath() + "centrifuge.png");
|
|
||||||
|
|
||||||
public void render(TileCentrifuge tileEntity, double x, double y, double z, float f)
|
|
||||||
{
|
|
||||||
GL11.glPushMatrix();
|
|
||||||
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
|
|
||||||
|
|
||||||
if (tileEntity.getWorldObj() != null)
|
|
||||||
{
|
|
||||||
RenderUtility.rotateBlockBasedOnDirection(tileEntity.getDirection());
|
|
||||||
}
|
|
||||||
|
|
||||||
bindTexture(TEXTURE);
|
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
|
||||||
GL11.glRotated(Math.toDegrees(tileEntity.rotation), 0, 1, 0);
|
|
||||||
MODEL.renderOnly("C", "JROT", "KROT", "LROT", "MROT");
|
|
||||||
GL11.glPopMatrix();
|
|
||||||
|
|
||||||
MODEL.renderAllExcept("C", "JROT", "KROT", "LROT", "MROT");
|
|
||||||
GL11.glPopMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
|
|
||||||
{
|
|
||||||
this.render((TileCentrifuge) tileEntity, var2, var4, var6, var8);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
package resonantinduction.atomic.machine.centrifuge
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
|
||||||
|
import net.minecraft.tileentity.TileEntity
|
||||||
|
import net.minecraft.util.ResourceLocation
|
||||||
|
import net.minecraftforge.client.model.AdvancedModelLoader
|
||||||
|
import net.minecraftforge.client.model.IModelCustom
|
||||||
|
import org.lwjgl.opengl.GL11
|
||||||
|
import resonant.lib.render.RenderUtility
|
||||||
|
import resonantinduction.core.Reference
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT) object RenderCentrifuge
|
||||||
|
{
|
||||||
|
final val MODEL: IModelCustom = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain, Reference.modelPath + "centrifuge.tcn"))
|
||||||
|
final val TEXTURE: ResourceLocation = new ResourceLocation(Reference.domain, Reference.modelPath + "centrifuge.png")
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT) class RenderCentrifuge extends TileEntitySpecialRenderer
|
||||||
|
{
|
||||||
|
def render(tileEntity: TileCentrifuge, x: Double, y: Double, z: Double, f: Float)
|
||||||
|
{
|
||||||
|
GL11.glPushMatrix
|
||||||
|
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5)
|
||||||
|
if (tileEntity.getWorldObj != null)
|
||||||
|
{
|
||||||
|
RenderUtility.rotateBlockBasedOnDirection(tileEntity.getDirection)
|
||||||
|
}
|
||||||
|
bindTexture(RenderCentrifuge.TEXTURE)
|
||||||
|
GL11.glPushMatrix
|
||||||
|
GL11.glRotated(Math.toDegrees(tileEntity.rotation), 0, 1, 0)
|
||||||
|
RenderCentrifuge.MODEL.renderOnly("C", "JROT", "KROT", "LROT", "MROT")
|
||||||
|
GL11.glPopMatrix
|
||||||
|
RenderCentrifuge.MODEL.renderAllExcept("C", "JROT", "KROT", "LROT", "MROT")
|
||||||
|
GL11.glPopMatrix
|
||||||
|
}
|
||||||
|
|
||||||
|
def renderTileEntityAt(tileEntity: TileEntity, var2: Double, var4: Double, var6: Double, var8: Float)
|
||||||
|
{
|
||||||
|
this.render(tileEntity.asInstanceOf[TileCentrifuge], var2, var4, var6, var8)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,311 +0,0 @@
|
||||||
package resonantinduction.atomic.machine.centrifuge;
|
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.network.Packet;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import net.minecraftforge.fluids.*;
|
|
||||||
import resonant.engine.ResonantEngine;
|
|
||||||
import resonant.lib.content.prefab.java.TileElectricInventory;
|
|
||||||
import resonant.lib.network.discriminator.PacketTile;
|
|
||||||
import resonant.lib.network.discriminator.PacketType;
|
|
||||||
import resonant.lib.network.handle.IPacketReceiver;
|
|
||||||
import resonantinduction.atomic.Atomic;
|
|
||||||
import resonantinduction.atomic.AtomicContent;
|
|
||||||
import resonantinduction.core.Settings;
|
|
||||||
import universalelectricity.compatibility.Compatibility;
|
|
||||||
import universalelectricity.core.transform.vector.Vector3;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Centrifuge TileEntity
|
|
||||||
*/
|
|
||||||
public class TileCentrifuge extends TileElectricInventory implements IPacketReceiver, IFluidHandler
|
|
||||||
{
|
|
||||||
public static final int SHI_JIAN = 20 * 60;
|
|
||||||
|
|
||||||
public static final long DIAN = 500000;
|
|
||||||
public final FluidTank gasTank = new FluidTank(AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE().copy(), FluidContainerRegistry.BUCKET_VOLUME * 5);
|
|
||||||
public int timer = 0;
|
|
||||||
public float rotation = 0;
|
|
||||||
|
|
||||||
public TileCentrifuge()
|
|
||||||
{
|
|
||||||
super(Material.iron);
|
|
||||||
isOpaqueCube(false);
|
|
||||||
normalRender(false);
|
|
||||||
energy().setCapacity(DIAN * 2);
|
|
||||||
setSizeInventory(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update()
|
|
||||||
{
|
|
||||||
super.update();
|
|
||||||
|
|
||||||
if (timer > 0)
|
|
||||||
{
|
|
||||||
rotation += 0.45f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.worldObj.isRemote)
|
|
||||||
{
|
|
||||||
/** Look for nearby tanks that contains uranium gas and try to extract it. */
|
|
||||||
if (this.ticks() % 20 == 0)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 6; i++)
|
|
||||||
{
|
|
||||||
ForgeDirection direction = ForgeDirection.getOrientation(i);
|
|
||||||
TileEntity tileEntity = new Vector3(this).add(direction).getTileEntity(world());
|
|
||||||
|
|
||||||
if (tileEntity instanceof IFluidHandler && tileEntity.getClass() != this.getClass())
|
|
||||||
{
|
|
||||||
IFluidHandler fluidHandler = ((IFluidHandler) tileEntity);
|
|
||||||
|
|
||||||
if (fluidHandler != null)
|
|
||||||
{
|
|
||||||
FluidStack requestFluid = AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE().copy();
|
|
||||||
requestFluid.amount = this.gasTank.getCapacity() - Atomic.getFluidAmount(this.gasTank.getFluid());
|
|
||||||
FluidStack receiveFluid = fluidHandler.drain(direction.getOpposite(), requestFluid, true);
|
|
||||||
|
|
||||||
if (receiveFluid != null)
|
|
||||||
{
|
|
||||||
if (receiveFluid.amount > 0)
|
|
||||||
{
|
|
||||||
if (this.gasTank.fill(receiveFluid, false) > 0)
|
|
||||||
{
|
|
||||||
this.gasTank.fill(receiveFluid, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.nengYong())
|
|
||||||
{
|
|
||||||
this.discharge(getStackInSlot(0));
|
|
||||||
|
|
||||||
if (energy().extractEnergy(TileCentrifuge.DIAN, false) >= DIAN)
|
|
||||||
{
|
|
||||||
if (this.timer == 0)
|
|
||||||
{
|
|
||||||
this.timer = TileCentrifuge.SHI_JIAN;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.timer > 0)
|
|
||||||
{
|
|
||||||
this.timer--;
|
|
||||||
|
|
||||||
if (this.timer < 1)
|
|
||||||
{
|
|
||||||
this.yong();
|
|
||||||
this.timer = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.timer = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
energy().extractEnergy(DIAN, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.timer = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.ticks() % 10 == 0)
|
|
||||||
{
|
|
||||||
//for (EntityPlayer player : this.getPlayersUsing())
|
|
||||||
//{
|
|
||||||
// PacketDispatcher.sendPacketToPlayer(getDescriptionPacket(), (Player) player);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean use(EntityPlayer player, int side, Vector3 hit)
|
|
||||||
{
|
|
||||||
openGui(player, Atomic.INSTANCE());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void read(ByteBuf data, EntityPlayer player, PacketType type)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.timer = data.readInt();
|
|
||||||
this.gasTank.setFluid(new FluidStack(AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE().fluidID, data.readInt()));
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Packet getDescriptionPacket()
|
|
||||||
{
|
|
||||||
return ResonantEngine.instance.packetHandler.toMCPacket(new PacketTile(this, this.timer, Atomic.getFluidAmount(this.gasTank.getFluid())));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return If the machine can be used.
|
|
||||||
*/
|
|
||||||
public boolean nengYong()
|
|
||||||
{
|
|
||||||
if (this.gasTank.getFluid() != null)
|
|
||||||
{
|
|
||||||
if (this.gasTank.getFluid().amount >= Settings.uraniumHexaflourideRatio())
|
|
||||||
{
|
|
||||||
return isItemValidForSlot(2, new ItemStack(AtomicContent.itemUranium())) && isItemValidForSlot(3, new ItemStack(AtomicContent.itemUranium(), 1, 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack
|
|
||||||
*/
|
|
||||||
public void yong()
|
|
||||||
{
|
|
||||||
if (this.nengYong())
|
|
||||||
{
|
|
||||||
this.gasTank.drain(Settings.uraniumHexaflourideRatio(), true);
|
|
||||||
|
|
||||||
if (this.worldObj.rand.nextFloat() > 0.6)
|
|
||||||
{
|
|
||||||
this.incrStackSize(2, new ItemStack(AtomicContent.itemUranium()));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.incrStackSize(3, new ItemStack(AtomicContent.itemUranium(), 1, 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads a tile entity from NBT.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void readFromNBT(NBTTagCompound nbt)
|
|
||||||
{
|
|
||||||
super.readFromNBT(nbt);
|
|
||||||
this.timer = nbt.getInteger("smeltingTicks");
|
|
||||||
|
|
||||||
NBTTagCompound compound = nbt.getCompoundTag("gas");
|
|
||||||
this.gasTank.setFluid(FluidStack.loadFluidStackFromNBT(compound));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes a tile entity to NBT.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound nbt)
|
|
||||||
{
|
|
||||||
super.writeToNBT(nbt);
|
|
||||||
nbt.setInteger("smeltingTicks", this.timer);
|
|
||||||
|
|
||||||
if (this.gasTank.getFluid() != null)
|
|
||||||
{
|
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
|
||||||
this.gasTank.getFluid().writeToNBT(compound);
|
|
||||||
nbt.setTag("gas", compound);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tank Methods
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
|
||||||
{
|
|
||||||
if (AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE().isFluidEqual(resource))
|
|
||||||
{
|
|
||||||
return this.gasTank.fill(resource, doFill);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canFill(ForgeDirection from, Fluid fluid)
|
|
||||||
{
|
|
||||||
return AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE().fluidID == fluid.getID();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canDrain(ForgeDirection from, Fluid fluid)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FluidTankInfo[] getTankInfo(ForgeDirection from)
|
|
||||||
{
|
|
||||||
return new FluidTankInfo[]
|
|
||||||
{ this.gasTank.getInfo() };
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Inventory
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int[] getAccessibleSlotsFromSide(int side)
|
|
||||||
{
|
|
||||||
return side == 1 ? new int[]
|
|
||||||
{ 0, 1 } : new int[]
|
|
||||||
{ 2, 3 };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int slotID, ItemStack itemStack, int side)
|
|
||||||
{
|
|
||||||
return slotID == 1 && this.isItemValidForSlot(slotID, itemStack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canExtractItem(int slotID, ItemStack itemstack, int j)
|
|
||||||
{
|
|
||||||
return slotID == 2 || slotID == 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isItemValidForSlot(int i, ItemStack itemStack)
|
|
||||||
{
|
|
||||||
switch (i)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
return Compatibility.isHandler(itemStack.getItem(), null);
|
|
||||||
case 1:
|
|
||||||
return true;
|
|
||||||
case 2:
|
|
||||||
return itemStack.getItem() == AtomicContent.itemUranium();
|
|
||||||
case 3:
|
|
||||||
return itemStack.getItem() == AtomicContent.itemUranium();
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,281 @@
|
||||||
|
package resonantinduction.atomic.machine.centrifuge
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf
|
||||||
|
import net.minecraft.block.material.Material
|
||||||
|
import net.minecraft.entity.player.EntityPlayer
|
||||||
|
import net.minecraft.inventory.IInventory
|
||||||
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.nbt.NBTTagCompound
|
||||||
|
import net.minecraft.network.Packet
|
||||||
|
import net.minecraft.tileentity.TileEntity
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection
|
||||||
|
import net.minecraftforge.fluids._
|
||||||
|
import resonant.engine.ResonantEngine
|
||||||
|
import resonant.lib.content.prefab.java.TileElectricInventory
|
||||||
|
import resonant.lib.network.discriminator.{PacketTile, PacketType}
|
||||||
|
import resonant.lib.network.handle.IPacketReceiver
|
||||||
|
import resonantinduction.atomic.{Atomic, AtomicContent}
|
||||||
|
import resonantinduction.core.Settings
|
||||||
|
import universalelectricity.compatibility.Compatibility
|
||||||
|
import universalelectricity.core.transform.vector.Vector3
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Centrifuge TileEntity
|
||||||
|
*/
|
||||||
|
object TileCentrifuge
|
||||||
|
{
|
||||||
|
final val SHI_JIAN: Int = 20 * 60
|
||||||
|
final val DIAN: Long = 500000
|
||||||
|
}
|
||||||
|
|
||||||
|
class TileCentrifuge extends TileElectricInventory(Material.iron) with IPacketReceiver with IFluidHandler with IInventory
|
||||||
|
{
|
||||||
|
final val gasTank: FluidTank = new FluidTank(AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE.copy, FluidContainerRegistry.BUCKET_VOLUME * 5)
|
||||||
|
var timer: Int = 0
|
||||||
|
var rotation: Float = 0
|
||||||
|
|
||||||
|
//Constructort
|
||||||
|
isOpaqueCube(false)
|
||||||
|
normalRender(false)
|
||||||
|
energy.setCapacity(TileCentrifuge.DIAN * 2)
|
||||||
|
setSizeInventory(4)
|
||||||
|
|
||||||
|
override def update
|
||||||
|
{
|
||||||
|
super.update
|
||||||
|
if (timer > 0)
|
||||||
|
{
|
||||||
|
rotation += 0.45f
|
||||||
|
}
|
||||||
|
if (!this.worldObj.isRemote)
|
||||||
|
{
|
||||||
|
if (this.ticks % 20 == 0)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
var i: Int = 0
|
||||||
|
while (i < 6)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
val direction: ForgeDirection = ForgeDirection.getOrientation(i)
|
||||||
|
val tileEntity: TileEntity = new Vector3(this).add(direction).getTileEntity(world)
|
||||||
|
if (tileEntity.isInstanceOf[IFluidHandler] && tileEntity.getClass != this.getClass)
|
||||||
|
{
|
||||||
|
val fluidHandler: IFluidHandler = (tileEntity.asInstanceOf[IFluidHandler])
|
||||||
|
if (fluidHandler != null)
|
||||||
|
{
|
||||||
|
val requestFluid: FluidStack = AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE.copy
|
||||||
|
requestFluid.amount = this.gasTank.getCapacity - Atomic.getFluidAmount(this.gasTank.getFluid)
|
||||||
|
val receiveFluid: FluidStack = fluidHandler.drain(direction.getOpposite, requestFluid, true)
|
||||||
|
if (receiveFluid != null)
|
||||||
|
{
|
||||||
|
if (receiveFluid.amount > 0)
|
||||||
|
{
|
||||||
|
if (this.gasTank.fill(receiveFluid, false) > 0)
|
||||||
|
{
|
||||||
|
this.gasTank.fill(receiveFluid, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
({
|
||||||
|
i += 1;
|
||||||
|
i - 1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.nengYong)
|
||||||
|
{
|
||||||
|
this.discharge(getStackInSlot(0))
|
||||||
|
if (energy.extractEnergy(TileCentrifuge.DIAN, false) >= TileCentrifuge.DIAN)
|
||||||
|
{
|
||||||
|
if (this.timer == 0)
|
||||||
|
{
|
||||||
|
this.timer = TileCentrifuge.SHI_JIAN
|
||||||
|
}
|
||||||
|
if (this.timer > 0)
|
||||||
|
{
|
||||||
|
this.timer -= 1
|
||||||
|
if (this.timer < 1)
|
||||||
|
{
|
||||||
|
this.yong
|
||||||
|
this.timer = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.timer = 0
|
||||||
|
}
|
||||||
|
energy.extractEnergy(TileCentrifuge.DIAN, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.timer = 0
|
||||||
|
}
|
||||||
|
if (this.ticks % 10 == 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override def use(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||||
|
{
|
||||||
|
openGui(player, Atomic.INSTANCE)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
def read(data: ByteBuf, player: EntityPlayer, `type`: PacketType)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.timer = data.readInt
|
||||||
|
this.gasTank.setFluid(new FluidStack(AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE.fluidID, data.readInt))
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
case e: Exception =>
|
||||||
|
{
|
||||||
|
e.printStackTrace
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override def getDescriptionPacket: Packet =
|
||||||
|
{
|
||||||
|
return ResonantEngine.instance.packetHandler.toMCPacket(new PacketTile(this, this.timer, Atomic.getFluidAmount(this.gasTank.getFluid)))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return If the machine can be used.
|
||||||
|
*/
|
||||||
|
def nengYong: Boolean =
|
||||||
|
{
|
||||||
|
if (this.gasTank.getFluid != null)
|
||||||
|
{
|
||||||
|
if (this.gasTank.getFluid.amount >= Settings.uraniumHexaflourideRatio)
|
||||||
|
{
|
||||||
|
return isItemValidForSlot(2, new ItemStack(AtomicContent.itemUranium)) && isItemValidForSlot(3, new ItemStack(AtomicContent.itemUranium, 1, 1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack
|
||||||
|
*/
|
||||||
|
def yong
|
||||||
|
{
|
||||||
|
if (this.nengYong)
|
||||||
|
{
|
||||||
|
this.gasTank.drain(Settings.uraniumHexaflourideRatio, true)
|
||||||
|
if (this.worldObj.rand.nextFloat > 0.6)
|
||||||
|
{
|
||||||
|
this.incrStackSize(2, new ItemStack(AtomicContent.itemUranium))
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.incrStackSize(3, new ItemStack(AtomicContent.itemUranium, 1, 1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads a tile entity from NBT.
|
||||||
|
*/
|
||||||
|
override def readFromNBT(nbt: NBTTagCompound)
|
||||||
|
{
|
||||||
|
super.readFromNBT(nbt)
|
||||||
|
this.timer = nbt.getInteger("smeltingTicks")
|
||||||
|
val compound: NBTTagCompound = nbt.getCompoundTag("gas")
|
||||||
|
this.gasTank.setFluid(FluidStack.loadFluidStackFromNBT(compound))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a tile entity to NBT.
|
||||||
|
*/
|
||||||
|
override def writeToNBT(nbt: NBTTagCompound)
|
||||||
|
{
|
||||||
|
super.writeToNBT(nbt)
|
||||||
|
nbt.setInteger("smeltingTicks", this.timer)
|
||||||
|
if (this.gasTank.getFluid != null)
|
||||||
|
{
|
||||||
|
val compound: NBTTagCompound = new NBTTagCompound
|
||||||
|
this.gasTank.getFluid.writeToNBT(compound)
|
||||||
|
nbt.setTag("gas", compound)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tank Methods
|
||||||
|
*/
|
||||||
|
def fill(from: ForgeDirection, resource: FluidStack, doFill: Boolean): Int =
|
||||||
|
{
|
||||||
|
if (AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE.isFluidEqual(resource))
|
||||||
|
{
|
||||||
|
return this.gasTank.fill(resource, doFill)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
def drain(from: ForgeDirection, resource: FluidStack, doDrain: Boolean): FluidStack =
|
||||||
|
{
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
def drain(from: ForgeDirection, maxDrain: Int, doDrain: Boolean): FluidStack =
|
||||||
|
{
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
def canFill(from: ForgeDirection, fluid: Fluid): Boolean =
|
||||||
|
{
|
||||||
|
return AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE.fluidID == fluid.getID
|
||||||
|
}
|
||||||
|
|
||||||
|
def canDrain(from: ForgeDirection, fluid: Fluid): Boolean =
|
||||||
|
{
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
def getTankInfo(from: ForgeDirection): Array[FluidTankInfo] =
|
||||||
|
{
|
||||||
|
return Array[FluidTankInfo](this.gasTank.getInfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inventory
|
||||||
|
*/
|
||||||
|
override def getAccessibleSlotsFromSide(side: Int): Array[Int] =
|
||||||
|
{
|
||||||
|
return if (side == 1) Array[Int](0, 1) else Array[Int](2, 3)
|
||||||
|
}
|
||||||
|
|
||||||
|
override def canInsertItem(slotID: Int, itemStack: ItemStack, side: Int): Boolean =
|
||||||
|
{
|
||||||
|
return slotID == 1 && this.isItemValidForSlot(slotID, itemStack)
|
||||||
|
}
|
||||||
|
|
||||||
|
override def canExtractItem(slotID: Int, itemstack: ItemStack, j: Int): Boolean =
|
||||||
|
{
|
||||||
|
return slotID == 2 || slotID == 3
|
||||||
|
}
|
||||||
|
|
||||||
|
override def isItemValidForSlot(i: Int, itemStack: ItemStack): Boolean =
|
||||||
|
{
|
||||||
|
i match
|
||||||
|
{
|
||||||
|
case 0 =>
|
||||||
|
return Compatibility.isHandler(itemStack.getItem, null)
|
||||||
|
case 1 =>
|
||||||
|
return true
|
||||||
|
case 2 =>
|
||||||
|
return itemStack.getItem eq AtomicContent.itemUranium
|
||||||
|
case 3 =>
|
||||||
|
return itemStack.getItem eq AtomicContent.itemUranium
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue