More work
This commit is contained in:
parent
5767bfb22e
commit
7a1085d38d
6 changed files with 148 additions and 22 deletions
|
@ -27,15 +27,10 @@ public class GuiSolarNeutronActivator extends GuiMekanism
|
|||
super(new ContainerSolarNeutronActivator(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiSolarNeutronActivator.png")));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiSolarNeutronActivator.png")));
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiSolarNeutronActivator.png"), 4, 24).with(SlotOverlay.PLUS));
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiSolarNeutronActivator.png"), 4, 55).with(SlotOverlay.MINUS));
|
||||
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiSolarNeutronActivator.png"), 154, 24));
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiSolarNeutronActivator.png"), 154, 55));
|
||||
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiSolarNeutronActivator.png"), 154, 4).with(SlotOverlay.POWER));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 4, 24).with(SlotOverlay.PLUS));
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 4, 55).with(SlotOverlay.MINUS));
|
||||
|
||||
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
|
||||
@Override
|
||||
|
@ -43,14 +38,14 @@ public class GuiSolarNeutronActivator extends GuiMekanism
|
|||
{
|
||||
return tileEntity.inputTank;
|
||||
}
|
||||
}, GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiSolarNeutronActivator.png"), 25, 13));
|
||||
}, GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 25, 13));
|
||||
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
|
||||
@Override
|
||||
public GasTank getTank()
|
||||
{
|
||||
return tileEntity.outputTank;
|
||||
}
|
||||
}, GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiSolarNeutronActivator.png"), 133, 13));
|
||||
}, GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 133, 13));
|
||||
|
||||
guiElements.add(new GuiProgress(new IProgressInfoHandler()
|
||||
{
|
||||
|
@ -59,7 +54,7 @@ public class GuiSolarNeutronActivator extends GuiMekanism
|
|||
{
|
||||
return tileEntity.isActive ? 1 : 0;
|
||||
}
|
||||
}, ProgressBar.LARGE_RIGHT, this, MekanismUtils.getResource(ResourceType.GUI, "GuiSolarNeutronActivator.png"), 62, 38));
|
||||
}, ProgressBar.LARGE_RIGHT, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 62, 38));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,7 +71,7 @@ public class GuiSolarNeutronActivator extends GuiMekanism
|
|||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiSolarNeutronActivator.png"));
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
|
|
@ -754,15 +754,15 @@ public class Mekanism
|
|||
0,
|
||||
100
|
||||
);
|
||||
|
||||
RecipeHandler.addPRCRecipe(
|
||||
new ItemStack(MekanismItems.Substrate), new FluidStack(FluidRegistry.getFluid("ethene"), 50), new GasStack(GasRegistry.getGas("oxygen"), 10),
|
||||
new ItemStack(MekanismItems.Polyethene), new GasStack(GasRegistry.getGas("oxygen"), 5),
|
||||
1000,
|
||||
60
|
||||
);
|
||||
|
||||
RecipeHandler.addCentrifugeRecipe(new GasStack(GasRegistry.getGas("deuterium"), 10), new GasStack(GasRegistry.getGas("tritium"), 1));
|
||||
|
||||
//Solar Neutron Activator Recipes
|
||||
RecipeHandler.addSolarNeutronRecipe(new GasStack(GasRegistry.getGas("lithium"), 1), new GasStack(GasRegistry.getGas("tritium"), 1));
|
||||
|
||||
//Infuse objects
|
||||
InfuseRegistry.registerInfuseObject(new ItemStack(MekanismItems.BioFuel), new InfuseObject(InfuseRegistry.get("BIO"), 5));
|
||||
|
|
|
@ -24,15 +24,15 @@ public class ContainerElectricPump extends Container
|
|||
addSlotToContainer(new SlotDischarge(tentity, 2, 143, 35));
|
||||
int slotX;
|
||||
|
||||
for(slotX = 0; slotX < 3; ++slotX)
|
||||
for(slotX = 0; slotX < 3; slotX++)
|
||||
{
|
||||
for(int slotY = 0; slotY < 9; ++slotY)
|
||||
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)
|
||||
for(slotX = 0; slotX < 9; slotX++)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
|
||||
}
|
||||
|
|
|
@ -29,15 +29,15 @@ public class ContainerRotaryCondensentrator extends Container
|
|||
|
||||
int slotX;
|
||||
|
||||
for(slotX = 0; slotX < 3; ++slotX)
|
||||
for(slotX = 0; slotX < 3; slotX++)
|
||||
{
|
||||
for(int slotY = 0; slotY < 9; ++slotY)
|
||||
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)
|
||||
for(slotX = 0; slotX < 9; slotX++)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
|
||||
}
|
||||
|
|
|
@ -1,8 +1,138 @@
|
|||
package mekanism.common.inventory.container;
|
||||
|
||||
import mekanism.api.gas.IGasItem;
|
||||
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
|
||||
import mekanism.common.inventory.slot.SlotOutput;
|
||||
import mekanism.common.inventory.slot.SlotStorageTank;
|
||||
import mekanism.common.tile.TileEntitySolarNeutronActivator;
|
||||
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 ContainerSolarNeutronActivator extends Container
|
||||
{
|
||||
private TileEntitySolarNeutronActivator tileEntity;
|
||||
|
||||
public ContainerSolarNeutronActivator(InventoryPlayer inventory, TileEntitySolarNeutronActivator tentity)
|
||||
{
|
||||
tileEntity = tentity;
|
||||
addSlotToContainer(new SlotStorageTank(tentity, 0, 5, 25));
|
||||
addSlotToContainer(new SlotStorageTank(tentity, 1, 5, 56));
|
||||
|
||||
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(slotStack.getItem() instanceof IGasItem)
|
||||
{
|
||||
if(slotID != 0 && slotID != 1)
|
||||
{
|
||||
if(((IGasItem)slotStack.getItem()).canProvideGas(slotStack, tileEntity.inputTank.getGas() != null ? tileEntity.inputTank.getGas().getGas() : null))
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 0, 1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if(((IGasItem)slotStack.getItem()).canReceiveGas(slotStack, tileEntity.inputTank.getGas() != null ? tileEntity.inputTank.getGas().getGas() : null))
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 1, 2, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(slotID >= 2 && slotID <= 28)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 29, inventorySlots.size(), false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if(slotID > 28)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 2, 28, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!mergeItemStack(slotStack, 2, 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
|||
public TileEntitySolarNeutronActivator()
|
||||
{
|
||||
super("SolarNeutronActivator");
|
||||
inventory = new ItemStack[3];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue