More work! Finished off the upgrade tab and removed upgrade slot from all upgrade-wielding containers.

This commit is contained in:
Aidan C. Brady 2014-07-21 18:07:15 -04:00
parent 48183f6670
commit e778449045
8 changed files with 60 additions and 93 deletions

View file

@ -45,6 +45,7 @@ import mekanism.client.gui.GuiSalinationController;
import mekanism.client.gui.GuiSeismicReader;
import mekanism.client.gui.GuiSeismicVibrator;
import mekanism.client.gui.GuiTeleporter;
import mekanism.client.gui.GuiUpgradeManagement;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.render.RenderGlowPanel;
import mekanism.client.render.RenderPartTransmitter;
@ -86,6 +87,7 @@ import mekanism.client.sound.SoundMap;
import mekanism.common.CommonProxy;
import mekanism.common.IElectricChest;
import mekanism.common.IInvConfiguration;
import mekanism.common.IUpgradeTile;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.entity.EntityBabySkeleton;
@ -465,6 +467,8 @@ public class ClientProxy extends CommonProxy
return new GuiPortableTank(player.inventory, (TileEntityPortableTank)tileEntity);
case 42:
return new GuiFluidicPlenisher(player.inventory, (TileEntityFluidicPlenisher)tileEntity);
case 43:
return new GuiUpgradeManagement(player.inventory, (IUpgradeTile)tileEntity);
}
return null;

View file

@ -2,7 +2,6 @@ package mekanism.client.gui;
import mekanism.api.Coord4D;
import mekanism.client.sound.SoundHandler;
import mekanism.common.IRedstoneControl;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage;
import mekanism.common.util.MekanismUtils;
@ -68,8 +67,6 @@ public class GuiConfigurationTab extends GuiElement
@Override
public void mouseClicked(int xAxis, int yAxis, int button)
{
IRedstoneControl control = (IRedstoneControl)tileEntity;
if(button == 0)
{
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 10 && yAxis <= 28)

View file

@ -4,7 +4,6 @@ import mekanism.api.Coord4D;
import mekanism.client.sound.SoundHandler;
import mekanism.common.IUpgradeTile;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketRemoveUpgrade.RemoveUpgradeMessage;
import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -34,12 +33,15 @@ public class GuiUpgradeTab extends GuiElement
{
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedRect(guiWidth + 176, guiHeight + 6, 0, 0, 26, 63);
IUpgradeTile upgradeTile = (IUpgradeTile)tileEntity;
int displayInt = upgradeTile.getComponent().getScaledUpgradeProgress(14);
guiObj.drawTexturedRect(guiWidth + 180, guiHeight + 30, 26, 0, 10, displayInt);
guiObj.drawTexturedRect(guiWidth + 176, guiHeight + 6, 0, 0, 26, 26);
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
{
guiObj.drawTexturedRect(guiWidth + 179, guiHeight + 10, 26, 0, 18, 18);
}
else {
guiObj.drawTexturedRect(guiWidth + 179, guiHeight + 10, 26, 18, 18, 18);
}
mc.renderEngine.bindTexture(defaultLocation);
}
@ -56,7 +58,6 @@ public class GuiUpgradeTab extends GuiElement
displayTooltip(MekanismUtils.localize("gui.upgrades"), xAxis, yAxis);
}
mc.renderEngine.bindTexture(defaultLocation);
}
@ -66,10 +67,13 @@ public class GuiUpgradeTab extends GuiElement
@Override
public void mouseClicked(int xAxis, int yAxis, int button)
{
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
if(button == 0)
{
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 9));
SoundHandler.playSound("gui.button.press");
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
{
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 43));
SoundHandler.playSound("gui.button.press");
}
}
}
}

View file

@ -2,7 +2,6 @@ package mekanism.common;
import java.io.File;
import mekanism.api.Coord4D;
import mekanism.api.MekanismAPI;
import mekanism.common.EnergyDisplay.EnergyType;
import mekanism.common.entity.EntityRobit;
@ -37,6 +36,7 @@ import mekanism.common.inventory.container.ContainerRotaryCondensentrator;
import mekanism.common.inventory.container.ContainerSalinationController;
import mekanism.common.inventory.container.ContainerSeismicVibrator;
import mekanism.common.inventory.container.ContainerTeleporter;
import mekanism.common.inventory.container.ContainerUpgradeManagement;
import mekanism.common.tile.TileEntityAdvancedElectricMachine;
import mekanism.common.tile.TileEntityAdvancedFactory;
import mekanism.common.tile.TileEntityBin;
@ -426,6 +426,8 @@ public class CommonProxy
return new ContainerPortableTank(player.inventory, (TileEntityPortableTank)tileEntity);
case 42:
return new ContainerFluidicPlenisher(player.inventory, (TileEntityFluidicPlenisher)tileEntity);
case 43:
return new ContainerUpgradeManagement(player.inventory, (IUpgradeTile)tileEntity);
}
return null;

View file

@ -3,7 +3,6 @@ package mekanism.common.inventory.container;
import mekanism.common.IFactory.RecipeType;
import mekanism.common.Tier;
import mekanism.common.Tier.FactoryTier;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotMachineUpgrade;
import mekanism.common.inventory.slot.SlotOutput;
@ -25,7 +24,6 @@ public class ContainerFactory extends Container
{
tileEntity = tentity;
addSlotToContainer(new SlotMachineUpgrade(tentity, 0, 180, 11));
addSlotToContainer(new SlotDischarge(tentity, 1, 7, 13));
addSlotToContainer(new Slot(tentity, 2, 180, 75));
addSlotToContainer(new Slot(tentity, 3, 180, 112));
@ -37,14 +35,14 @@ public class ContainerFactory extends Container
{
int xAxis = 55 + (i*38);
addSlotToContainer(new Slot(tentity, 5+i, xAxis, 13));
addSlotToContainer(new Slot(tentity, 4+i, xAxis, 13));
}
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xAxis = 55 + (i*38);
addSlotToContainer(new SlotOutput(tentity, tileEntity.tier.processes+5+i, xAxis, 57));
addSlotToContainer(new SlotOutput(tentity, tileEntity.tier.processes+4+i, xAxis, 57));
}
}
else if(tileEntity.tier == FactoryTier.ADVANCED)
@ -53,14 +51,14 @@ public class ContainerFactory extends Container
{
int xAxis = 35 + (i*26);
addSlotToContainer(new Slot(tentity, 5+i, xAxis, 13));
addSlotToContainer(new Slot(tentity, 4+i, xAxis, 13));
}
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xAxis = 35 + (i*26);
addSlotToContainer(new SlotOutput(tentity, tileEntity.tier.processes+5+i, xAxis, 57));
addSlotToContainer(new SlotOutput(tentity, tileEntity.tier.processes+4+i, xAxis, 57));
}
}
else if(tileEntity.tier == FactoryTier.ELITE)
@ -69,14 +67,14 @@ public class ContainerFactory extends Container
{
int xAxis = 29 + (i*19);
addSlotToContainer(new Slot(tentity, 5+i, xAxis, 13));
addSlotToContainer(new Slot(tentity, 4+i, xAxis, 13));
}
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xAxis = 29 + (i*19);
addSlotToContainer(new SlotOutput(tentity, tileEntity.tier.processes+5+i, xAxis, 57));
addSlotToContainer(new SlotOutput(tentity, tileEntity.tier.processes+4+i, xAxis, 57));
}
}
@ -84,7 +82,7 @@ public class ContainerFactory extends Container
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, 95 + slotX * 18));
}
@ -132,14 +130,14 @@ public class ContainerFactory extends Container
return null;
}
}
else if(slotID != 2 && slotID != 3 && isProperMachine(slotStack) && !slotStack.isItemEqual(tileEntity.getMachineStack()))
else if(slotID != 1 && slotID != 2 && isProperMachine(slotStack) && !slotStack.isItemEqual(tileEntity.getMachineStack()))
{
if(!mergeItemStack(slotStack, 2, 3, false))
if(!mergeItemStack(slotStack, 1, 2, false))
{
return null;
}
}
else if(slotID == 3)
else if(slotID == 2)
{
if(!mergeItemStack(slotStack, tileEntity.inventory.length, inventorySlots.size(), true))
{
@ -150,7 +148,7 @@ public class ContainerFactory extends Container
{
if(!isInputSlot(slotID))
{
if(!mergeItemStack(slotStack, 5, 5+tileEntity.tier.processes, false))
if(!mergeItemStack(slotStack, 4, 4+tileEntity.tier.processes, false))
{
return null;
}
@ -164,14 +162,14 @@ public class ContainerFactory extends Container
}
else if(ChargeUtils.canBeDischarged(slotStack))
{
if(slotID != 1)
if(slotID != 0)
{
if(!mergeItemStack(slotStack, 1, 2, false))
if(!mergeItemStack(slotStack, 0, 1, false))
{
return null;
}
}
else if(slotID == 1)
else if(slotID == 0)
{
if(!mergeItemStack(slotStack, tileEntity.inventory.length, inventorySlots.size(), true))
{
@ -183,23 +181,7 @@ public class ContainerFactory extends Container
{
if(slotID > tileEntity.inventory.length-1)
{
if(!mergeItemStack(slotStack, 4, 5, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, tileEntity.inventory.length, inventorySlots.size(), true))
{
return null;
}
}
}
else if(slotStack.getItem() instanceof ItemMachineUpgrade)
{
if(slotID != 0)
{
if(!mergeItemStack(slotStack, 0, 1, false))
if(!mergeItemStack(slotStack, 3, 4, false))
{
return null;
}
@ -259,13 +241,9 @@ public class ContainerFactory extends Container
{
if(itemStack != null && itemStack.getItem() instanceof ItemBlockMachine)
{
MachineType type = MachineType.get(itemStack);
if(type == MachineType.ENERGIZED_SMELTER || type == MachineType.ENRICHMENT_CHAMBER ||
type == MachineType.CRUSHER || type == MachineType.OSMIUM_COMPRESSOR ||
type == MachineType.COMBINER || type == MachineType.PURIFICATION_CHAMBER)
for(RecipeType type : RecipeType.values())
{
return true;
return itemStack.isItemEqual(type.getStack());
}
}

View file

@ -23,22 +23,21 @@ public class ContainerMetallurgicInfuser extends Container
public ContainerMetallurgicInfuser(InventoryPlayer inventory, TileEntityMetallurgicInfuser tentity)
{
tileEntity = tentity;
addSlotToContainer(new SlotMachineUpgrade(tentity, 0, 180, 11));
addSlotToContainer(new SlotDischarge(tentity, 0, 143, 35));
addSlotToContainer(new Slot(tentity, 1, 17, 35));
addSlotToContainer(new Slot(tentity, 2, 51, 43));
addSlotToContainer(new SlotOutput(tentity, 3, 109, 43));
addSlotToContainer(new SlotDischarge(tentity, 4, 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));
}
@ -73,7 +72,7 @@ public class ContainerMetallurgicInfuser extends Container
ItemStack slotStack = currentSlot.getStack();
stack = slotStack.copy();
if(slotID != 0 && slotID != 1 && slotID != 2 && slotID != 3 && slotID != 4)
if(slotID != 0 && slotID != 1 && slotID != 2 && slotID != 3)
{
if(InfuseRegistry.getObject(slotStack) != null && (tileEntity.type == null || tileEntity.type == InfuseRegistry.getObject(slotStack).type))
{
@ -104,22 +103,22 @@ public class ContainerMetallurgicInfuser extends Container
}
}
else {
if(slotID >= 5 && slotID <= 31)
if(slotID >= 4 && slotID <= 30)
{
if(!mergeItemStack(slotStack, 32, inventorySlots.size(), false))
if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false))
{
return null;
}
}
else if(slotID > 31)
else if(slotID > 30)
{
if(!mergeItemStack(slotStack, 5, 31, false))
if(!mergeItemStack(slotStack, 4, 30, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 5, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}
@ -127,7 +126,7 @@ public class ContainerMetallurgicInfuser extends Container
}
}
else {
if(!mergeItemStack(slotStack, 5, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}

View file

@ -23,7 +23,6 @@ public class ContainerPRC extends Container
addSlotToContainer(new Slot(tentity, 0, 54, 35));
addSlotToContainer(new SlotDischarge(tentity, 1, 141, 19));
addSlotToContainer(new SlotOutput(tentity, 2, 116, 35));
addSlotToContainer(new SlotMachineUpgrade(tentity, 3, 180, 11));
int slotX;
for(slotX = 0; slotX < 3; ++slotX)
@ -71,7 +70,7 @@ public class ContainerPRC extends Container
if(slotID == 2)
{
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
{
return null;
}
@ -87,7 +86,7 @@ public class ContainerPRC extends Container
}
else if(slotID == 1)
{
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
{
return null;
}
@ -103,45 +102,29 @@ public class ContainerPRC extends Container
}
}
else {
if(!mergeItemStack(slotStack, 5, inventorySlots.size(), true))
{
return null;
}
}
}
else if(slotStack.getItem() instanceof ItemMachineUpgrade)
{
if(slotID != 0 && slotID != 1 && slotID != 2 && slotID != 3)
{
if(!mergeItemStack(slotStack, 3, 4, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
{
return null;
}
}
}
else {
if(slotID >= 4 && slotID <= 30)
if(slotID >= 3 && slotID <= 29)
{
if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false))
if(!mergeItemStack(slotStack, 30, inventorySlots.size(), false))
{
return null;
}
}
else if(slotID > 30)
else if(slotID > 29)
{
if(!mergeItemStack(slotStack, 4, 30, false))
if(!mergeItemStack(slotStack, 3, 29, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
{
return null;
}

View file

@ -80,7 +80,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
/** This machine's current RedstoneControl type. */
public RedstoneControl controlType = RedstoneControl.DISABLED;
public TileComponentUpgrade upgradeComponent = new TileComponentUpgrade(this, 0);
public TileComponentUpgrade upgradeComponent = new TileComponentUpgrade(this, 4);
public TileComponentEjector ejectorComponent;
public TileEntityMetallurgicInfuser()
@ -131,7 +131,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
}
}
ChargeUtils.discharge(4, this);
ChargeUtils.discharge(0, this);
if(inventory[1] != null)
{