Worked on that GUI, I think I've got down how this is gonna work

This commit is contained in:
Aidan Brady 2013-10-26 00:02:57 -04:00
parent 8bb6b7ac43
commit 51f24f058a
19 changed files with 194 additions and 78 deletions

View file

@ -351,7 +351,7 @@ public class ClientProxy extends CommonProxy
case 25: case 25:
return new GuiRobitRepair(player.inventory, world, x); return new GuiRobitRepair(player.inventory, world, x);
case 26: case 26:
return new GuiLogisticalSorter(player.inventory, (TileEntityLogisticalSorter)tileEntity); return new GuiLogisticalSorter(player, (TileEntityLogisticalSorter)tileEntity);
} }
return null; return null;

View file

@ -16,16 +16,16 @@ public abstract class GuiElement
protected ResourceLocation RESOURCE; protected ResourceLocation RESOURCE;
public GuiContainer guiContainer; public GuiScreen guiObj;
public TileEntity tileEntity; public TileEntity tileEntity;
public ResourceLocation defaultLocation; public ResourceLocation defaultLocation;
public GuiElement(ResourceLocation resource, GuiContainer gui, TileEntity tile, ResourceLocation def) public GuiElement(ResourceLocation resource, GuiScreen gui, TileEntity tile, ResourceLocation def)
{ {
RESOURCE = resource; RESOURCE = resource;
guiContainer = gui; guiObj = gui;
tileEntity = tile; tileEntity = tile;
defaultLocation = def; defaultLocation = def;
} }
@ -35,26 +35,32 @@ public abstract class GuiElement
try { try {
Method m = GuiContainer.class.getDeclaredMethod("drawCreativeTabHoveringText", String.class, Integer.TYPE, Integer.TYPE); Method m = GuiContainer.class.getDeclaredMethod("drawCreativeTabHoveringText", String.class, Integer.TYPE, Integer.TYPE);
m.setAccessible(true); m.setAccessible(true);
m.invoke(guiContainer, s, xAxis, yAxis); m.invoke(guiObj, s, xAxis, yAxis);
} catch(Exception e) {} } catch(Exception e) {}
} }
protected void offsetX(int xSize) protected void offsetX(int xSize)
{ {
try { if(guiObj instanceof GuiContainer)
Field f = GuiContainer.class.getDeclaredField("xSize"); {
f.setAccessible(true); try {
f.set(guiContainer, ((Integer)f.get(guiContainer))+xSize); Field f = GuiContainer.class.getDeclaredField("xSize");
} catch(Exception e) {} f.setAccessible(true);
f.set(guiObj, ((Integer)f.get(guiObj))+xSize);
} catch(Exception e) {}
}
} }
protected void offsetY(int ySize) protected void offsetY(int ySize)
{ {
try { if(guiObj instanceof GuiContainer)
Field f = GuiContainer.class.getDeclaredField("ySize"); {
f.setAccessible(true); try {
f.set(guiContainer, ((Integer)f.get(guiContainer))+ySize); Field f = GuiContainer.class.getDeclaredField("ySize");
} catch(Exception e) {} f.setAccessible(true);
f.set(guiObj, ((Integer)f.get(guiObj))+ySize);
} catch(Exception e) {}
}
} }
protected FontRenderer getFontRenderer() protected FontRenderer getFontRenderer()
@ -62,7 +68,7 @@ public abstract class GuiElement
try { try {
Field f = GuiScreen.class.getDeclaredField("fontRenderer"); Field f = GuiScreen.class.getDeclaredField("fontRenderer");
f.setAccessible(true); f.setAccessible(true);
return (FontRenderer)f.get(guiContainer); return (FontRenderer)f.get(guiObj);
} catch(Exception e) {} } catch(Exception e) {}
return null; return null;

View file

@ -0,0 +1,5 @@
package mekanism.client.gui;
public class GuiItemStackFilter {
}

View file

@ -1,11 +1,11 @@
package mekanism.client.gui; package mekanism.client.gui;
import mekanism.common.inventory.container.ContainerItemStackFilter; import mekanism.common.inventory.container.ContainerNull;
import mekanism.common.tileentity.TileEntityLogisticalSorter; import mekanism.common.tileentity.TileEntityLogisticalSorter;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.StatCollector; import net.minecraft.entity.player.EntityPlayer;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@ -17,26 +17,60 @@ public class GuiLogisticalSorter extends GuiMekanism
{ {
public TileEntityLogisticalSorter tileEntity; public TileEntityLogisticalSorter tileEntity;
public GuiLogisticalSorter(InventoryPlayer inventory, TileEntityLogisticalSorter tentity) public GuiLogisticalSorter(EntityPlayer player, TileEntityLogisticalSorter tentity)
{ {
super(new ContainerItemStackFilter(inventory, tentity)); super(new ContainerNull(player, tentity));
tileEntity = tentity; tileEntity = tentity;
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiLogisticalSorter.png"))); guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiLogisticalSorter.png")));
} }
@Override @Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) public boolean doesGuiPauseGame()
{ {
super.drawGuiContainerForegroundLayer(mouseX, mouseY); return false;
}
@Override
public void initGui()
{
super.initGui();
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
buttonList.clear();
buttonList.add(new GuiButton(0, guiWidth + 56, guiHeight + 136, 54, 20, "ItemStack"));
buttonList.add(new GuiButton(1, guiWidth + 110, guiHeight + 136, 43, 20, "OreDict"));
}
@Override
protected void actionPerformed(GuiButton guibutton)
{
super.actionPerformed(guibutton);
if(guibutton.id == 0)
{
}
else if(guibutton.id == 1)
{
}
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
int xAxis = (mouseX - (width - xSize) / 2); int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2); int yAxis = (mouseY - (height - ySize) / 2);
fontRenderer.drawString("Logistical Sorter", 43, 6, 0x404040); fontRenderer.drawString("Logistical Sorter", 43, 6, 0x404040);
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 0x404040); fontRenderer.drawString("Filters:", 11, 17, 0x00CD00);
} fontRenderer.drawString("- " + tileEntity.filters.size(), 11, 26, 0x00CD00);
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
}
@Override @Override
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY) protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
{ {
@ -47,8 +81,5 @@ public class GuiLogisticalSorter extends GuiMekanism
int guiWidth = (width - xSize) / 2; int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2; int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize); drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
int xAxis = mouseX - guiWidth;
int yAxis = mouseY - guiHeight;
} }
} }

View file

@ -0,0 +1,9 @@
package mekanism.client.gui;
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
import net.minecraft.client.gui.GuiScreen;
public class GuiOreDictFilter extends GuiScreen
{
public TileEntityLogisticalTransporter tileEntity;
}

View file

@ -19,12 +19,12 @@ public class GuiRecipeType extends GuiElement
{ {
mc.renderEngine.bindTexture(RESOURCE); mc.renderEngine.bindTexture(RESOURCE);
guiContainer.drawTexturedModalRect(guiWidth + 176, guiHeight + 70, 0, 0, 26, 63); guiObj.drawTexturedModalRect(guiWidth + 176, guiHeight + 70, 0, 0, 26, 63);
TileEntityFactory factory = (TileEntityFactory)tileEntity; TileEntityFactory factory = (TileEntityFactory)tileEntity;
int displayInt = factory.getScaledRecipeProgress(15); int displayInt = factory.getScaledRecipeProgress(15);
guiContainer.drawTexturedModalRect(guiWidth + 181, guiHeight + 94, 26, 0, 10, displayInt); guiObj.drawTexturedModalRect(guiWidth + 181, guiHeight + 94, 26, 0, 10, displayInt);
mc.renderEngine.bindTexture(defaultLocation); mc.renderEngine.bindTexture(defaultLocation);
} }

View file

@ -8,13 +8,13 @@ import mekanism.common.PacketHandler.Transmission;
import mekanism.common.network.PacketRedstoneControl; import mekanism.common.network.PacketRedstoneControl;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
public class GuiRedstoneControl extends GuiElement public class GuiRedstoneControl extends GuiElement
{ {
public GuiRedstoneControl(GuiContainer gui, TileEntity tile, ResourceLocation def) public GuiRedstoneControl(GuiScreen gui, TileEntity tile, ResourceLocation def)
{ {
super(MekanismUtils.getResource(ResourceType.GUI, "GuiRedstoneControl.png"), gui, tile, def); super(MekanismUtils.getResource(ResourceType.GUI, "GuiRedstoneControl.png"), gui, tile, def);
} }
@ -24,17 +24,17 @@ public class GuiRedstoneControl extends GuiElement
{ {
mc.renderEngine.bindTexture(RESOURCE); mc.renderEngine.bindTexture(RESOURCE);
guiContainer.drawTexturedModalRect(guiWidth + 176, guiHeight + 138, 0, 0, 26, 26); guiObj.drawTexturedModalRect(guiWidth + 176, guiHeight + 138, 0, 0, 26, 26);
IRedstoneControl control = (IRedstoneControl)tileEntity; IRedstoneControl control = (IRedstoneControl)tileEntity;
int renderX = 26 + (18*control.getControlType().ordinal()); int renderX = 26 + (18*control.getControlType().ordinal());
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 142 && yAxis <= 160) if(xAxis >= 179 && xAxis <= 197 && yAxis >= 142 && yAxis <= 160)
{ {
guiContainer.drawTexturedModalRect(guiWidth + 179, guiHeight + 142, renderX, 0, 18, 18); guiObj.drawTexturedModalRect(guiWidth + 179, guiHeight + 142, renderX, 0, 18, 18);
} }
else { else {
guiContainer.drawTexturedModalRect(guiWidth + 179, guiHeight + 142, renderX, 18, 18, 18); guiObj.drawTexturedModalRect(guiWidth + 179, guiHeight + 142, renderX, 18, 18, 18);
} }
mc.renderEngine.bindTexture(defaultLocation); mc.renderEngine.bindTexture(defaultLocation);
@ -70,6 +70,7 @@ public class GuiRedstoneControl extends GuiElement
RedstoneControl current = control.getControlType(); RedstoneControl current = control.getControlType();
int ordinalToSet = current.ordinal() < (RedstoneControl.values().length-1) ? current.ordinal()+1 : 0; int ordinalToSet = current.ordinal() < (RedstoneControl.values().length-1) ? current.ordinal()+1 : 0;
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
PacketHandler.sendPacket(Transmission.SERVER, new PacketRedstoneControl().setParams(Object3D.get(tileEntity), RedstoneControl.values()[ordinalToSet])); PacketHandler.sendPacket(Transmission.SERVER, new PacketRedstoneControl().setParams(Object3D.get(tileEntity), RedstoneControl.values()[ordinalToSet]));
} }
} }

View file

@ -23,12 +23,12 @@ public class GuiUpgradeManagement extends GuiElement
{ {
mc.renderEngine.bindTexture(RESOURCE); mc.renderEngine.bindTexture(RESOURCE);
guiContainer.drawTexturedModalRect(guiWidth + 176, guiHeight + 6, 0, 0, 26, 63); guiObj.drawTexturedModalRect(guiWidth + 176, guiHeight + 6, 0, 0, 26, 63);
IUpgradeTile upgradeTile = (IUpgradeTile)tileEntity; IUpgradeTile upgradeTile = (IUpgradeTile)tileEntity;
int displayInt = upgradeTile.getComponent().getScaledUpgradeProgress(14); int displayInt = upgradeTile.getComponent().getScaledUpgradeProgress(14);
guiContainer.drawTexturedModalRect(guiWidth + 180, guiHeight + 30, 26, 0, 10, displayInt); guiObj.drawTexturedModalRect(guiWidth + 180, guiHeight + 30, 26, 0, 10, displayInt);
mc.renderEngine.bindTexture(defaultLocation); mc.renderEngine.bindTexture(defaultLocation);
} }

View file

@ -8,9 +8,10 @@ import mekanism.common.inventory.container.ContainerElectricMachine;
import mekanism.common.inventory.container.ContainerElectricPump; import mekanism.common.inventory.container.ContainerElectricPump;
import mekanism.common.inventory.container.ContainerEnergyCube; import mekanism.common.inventory.container.ContainerEnergyCube;
import mekanism.common.inventory.container.ContainerFactory; import mekanism.common.inventory.container.ContainerFactory;
import mekanism.common.inventory.container.ContainerFilter;
import mekanism.common.inventory.container.ContainerGasTank; import mekanism.common.inventory.container.ContainerGasTank;
import mekanism.common.inventory.container.ContainerItemStackFilter;
import mekanism.common.inventory.container.ContainerMetallurgicInfuser; import mekanism.common.inventory.container.ContainerMetallurgicInfuser;
import mekanism.common.inventory.container.ContainerNull;
import mekanism.common.inventory.container.ContainerRobitCrafting; import mekanism.common.inventory.container.ContainerRobitCrafting;
import mekanism.common.inventory.container.ContainerRobitInventory; import mekanism.common.inventory.container.ContainerRobitInventory;
import mekanism.common.inventory.container.ContainerRobitMain; import mekanism.common.inventory.container.ContainerRobitMain;
@ -21,6 +22,7 @@ import mekanism.common.tileentity.TileEntityAdvancedElectricMachine;
import mekanism.common.tileentity.TileEntityAdvancedFactory; import mekanism.common.tileentity.TileEntityAdvancedFactory;
import mekanism.common.tileentity.TileEntityChargepad; import mekanism.common.tileentity.TileEntityChargepad;
import mekanism.common.tileentity.TileEntityCombiner; import mekanism.common.tileentity.TileEntityCombiner;
import mekanism.common.tileentity.TileEntityContainerBlock;
import mekanism.common.tileentity.TileEntityCrusher; import mekanism.common.tileentity.TileEntityCrusher;
import mekanism.common.tileentity.TileEntityDynamicTank; import mekanism.common.tileentity.TileEntityDynamicTank;
import mekanism.common.tileentity.TileEntityDynamicValve; import mekanism.common.tileentity.TileEntityDynamicValve;
@ -33,7 +35,6 @@ import mekanism.common.tileentity.TileEntityEnergyCube;
import mekanism.common.tileentity.TileEntityEnrichmentChamber; import mekanism.common.tileentity.TileEntityEnrichmentChamber;
import mekanism.common.tileentity.TileEntityFactory; import mekanism.common.tileentity.TileEntityFactory;
import mekanism.common.tileentity.TileEntityGasTank; import mekanism.common.tileentity.TileEntityGasTank;
import mekanism.common.tileentity.TileEntityLogisticalSorter;
import mekanism.common.tileentity.TileEntityLogisticalTransporter; import mekanism.common.tileentity.TileEntityLogisticalTransporter;
import mekanism.common.tileentity.TileEntityMechanicalPipe; import mekanism.common.tileentity.TileEntityMechanicalPipe;
import mekanism.common.tileentity.TileEntityMetallurgicInfuser; import mekanism.common.tileentity.TileEntityMetallurgicInfuser;
@ -283,7 +284,11 @@ public class CommonProxy
case 25: case 25:
return new ContainerRobitRepair(player.inventory, world); return new ContainerRobitRepair(player.inventory, world);
case 26: case 26:
return new ContainerItemStackFilter(player.inventory, (TileEntityLogisticalSorter)tileEntity); return new ContainerNull(player, (TileEntityContainerBlock)tileEntity);
case 27:
return new ContainerFilter(player.inventory);
case 28:
return new ContainerFilter(player.inventory);
} }
return null; return null;

View file

@ -59,6 +59,7 @@ import mekanism.common.network.PacketDataRequest;
import mekanism.common.network.PacketDigitUpdate; import mekanism.common.network.PacketDigitUpdate;
import mekanism.common.network.PacketElectricBowState; import mekanism.common.network.PacketElectricBowState;
import mekanism.common.network.PacketElectricChest; import mekanism.common.network.PacketElectricChest;
import mekanism.common.network.PacketLogisticalSorterGui;
import mekanism.common.network.PacketPortableTeleport; import mekanism.common.network.PacketPortableTeleport;
import mekanism.common.network.PacketPortalFX; import mekanism.common.network.PacketPortalFX;
import mekanism.common.network.PacketRedstoneControl; import mekanism.common.network.PacketRedstoneControl;
@ -1136,6 +1137,7 @@ public class Mekanism
PacketHandler.registerPacket(PacketRemoveUpgrade.class); PacketHandler.registerPacket(PacketRemoveUpgrade.class);
PacketHandler.registerPacket(PacketRedstoneControl.class); PacketHandler.registerPacket(PacketRedstoneControl.class);
PacketHandler.registerPacket(PacketWalkieTalkieState.class); PacketHandler.registerPacket(PacketWalkieTalkieState.class);
PacketHandler.registerPacket(PacketLogisticalSorterGui.class);
//Donators //Donators
donators.add("mrgreaper"); donators.add("mrgreaper");

View file

@ -21,6 +21,7 @@ import mekanism.common.PacketHandler.Transmission;
import mekanism.common.Tier; import mekanism.common.Tier;
import mekanism.common.network.PacketElectricChest; import mekanism.common.network.PacketElectricChest;
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType; import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
import mekanism.common.network.PacketLogisticalSorterGui;
import mekanism.common.tileentity.TileEntityAdvancedFactory; import mekanism.common.tileentity.TileEntityAdvancedFactory;
import mekanism.common.tileentity.TileEntityBasicBlock; import mekanism.common.tileentity.TileEntityBasicBlock;
import mekanism.common.tileentity.TileEntityChargepad; import mekanism.common.tileentity.TileEntityChargepad;
@ -828,6 +829,19 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
return super.getCollisionBoundingBoxFromPool(world, x, y, z); return super.getCollisionBoundingBoxFromPool(world, x, y, z);
} }
@Override
public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side)
{
int metadata = world.getBlockMetadata(x, y, z);
if(metadata != MachineType.CHARGEPAD.meta)
{
return true;
}
return false;
}
public static enum MachineType public static enum MachineType
{ {

View file

@ -1,25 +1,20 @@
package mekanism.common.inventory.container; package mekanism.common.inventory.container;
import mekanism.api.gas.EnumGas; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotStorageTank; import mekanism.common.tileentity.TileEntityTeleporter;
import mekanism.common.tileentity.TileEntityLogisticalSorter; import mekanism.common.util.ChargeUtils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class ContainerItemStackFilter extends Container public class ContainerFilter extends Container
{ {
private TileEntityLogisticalSorter tileEntity; public ContainerFilter(InventoryPlayer inventory)
{
public ContainerItemStackFilter(InventoryPlayer inventory, TileEntityLogisticalSorter tentity) int slotX;
{
tileEntity = tentity;
addSlotToContainer(new Slot(tentity, 0, 8, 8));
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)
@ -32,23 +27,18 @@ public class ContainerItemStackFilter extends Container
{ {
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142)); addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
} }
tileEntity.openChest();
tileEntity.playersUsing.add(inventory.player);
} }
@Override @Override
public void onContainerClosed(EntityPlayer entityplayer) public void onContainerClosed(EntityPlayer entityplayer)
{ {
super.onContainerClosed(entityplayer); super.onContainerClosed(entityplayer);
tileEntity.closeChest();
tileEntity.playersUsing.remove(entityplayer);
} }
@Override @Override
public boolean canInteractWith(EntityPlayer entityplayer) public boolean canInteractWith(EntityPlayer entityplayer)
{ {
return tileEntity.isUseableByPlayer(entityplayer); return true;
} }
@Override @Override
@ -61,8 +51,27 @@ public class ContainerItemStackFilter extends Container
{ {
ItemStack slotStack = currentSlot.getStack(); ItemStack slotStack = currentSlot.getStack();
stack = slotStack.copy(); stack = slotStack.copy();
//TODO if(slotID >= 0 && slotID <= 26)
{
if(!mergeItemStack(slotStack, 27, inventorySlots.size(), false))
{
return null;
}
}
else if(slotID > 26)
{
if(!mergeItemStack(slotStack, 0, 26, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 0, inventorySlots.size(), true))
{
return null;
}
}
if(slotStack.stackSize == 0) if(slotStack.stackSize == 0)
{ {

View file

@ -0,0 +1,33 @@
package mekanism.common.inventory.container;
import mekanism.common.tileentity.TileEntityContainerBlock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
public class ContainerNull extends Container
{
private TileEntityContainerBlock tileEntity;
public ContainerNull(EntityPlayer player, TileEntityContainerBlock tile)
{
tileEntity = tile;
tileEntity.openChest();
tileEntity.playersUsing.add(player);
}
@Override
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onContainerClosed(entityplayer);
tileEntity.closeChest();
tileEntity.playersUsing.remove(entityplayer);
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer)
{
return true;
}
}

View file

@ -1,14 +1,10 @@
package mekanism.common.network; package mekanism.common.network;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.util.ArrayList;
import mekanism.api.Object3D; import mekanism.api.Object3D;
import mekanism.common.ITileNetwork; import mekanism.common.ITileNetwork;
import mekanism.common.PacketHandler; import mekanism.common.Mekanism;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.tileentity.TileEntityDynamicTank;
import mekanism.common.tileentity.TileEntityLogisticalSorter;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -21,7 +17,7 @@ public class PacketLogisticalSorterGui implements IMekanismPacket
{ {
public Object3D object3D; public Object3D object3D;
public int filterIndex; public int type;
@Override @Override
public String getName() public String getName()
@ -33,7 +29,7 @@ public class PacketLogisticalSorterGui implements IMekanismPacket
public IMekanismPacket setParams(Object... data) public IMekanismPacket setParams(Object... data)
{ {
object3D = (Object3D)data[0]; object3D = (Object3D)data[0];
filterIndex = (Integer)data[1]; type = (Integer)data[1];
return this; return this;
} }
@ -47,7 +43,7 @@ public class PacketLogisticalSorterGui implements IMekanismPacket
int id = dataStream.readInt(); int id = dataStream.readInt();
int index = dataStream.readInt(); int type = dataStream.readInt();
World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(id); World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(id);
@ -55,12 +51,14 @@ public class PacketLogisticalSorterGui implements IMekanismPacket
{ {
TileEntity tileEntity = worldServer.getBlockTileEntity(x, y, z); TileEntity tileEntity = worldServer.getBlockTileEntity(x, y, z);
if(tileEntity instanceof TileEntityLogisticalSorter) if(type == 0)
{ {
((TileEntityDynamicTank)tileEntity).sendStructure = true; player.openGui(Mekanism.instance, 27, worldServer, x, y, z);
}
else if(type == 1)
{
player.openGui(Mekanism.instance, 28, worldServer, x, y, z);
} }
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTileEntity().setParams(Object3D.get(worldServer.getBlockTileEntity(x, y, z)), ((ITileNetwork)worldServer.getBlockTileEntity(x, y, z)).getNetworkedData(new ArrayList())));
} }
} }
@ -73,6 +71,6 @@ public class PacketLogisticalSorterGui implements IMekanismPacket
dataStream.writeInt(object3D.dimensionId); dataStream.writeInt(object3D.dimensionId);
dataStream.writeInt(filterIndex); dataStream.writeInt(type);
} }
} }

View file

@ -89,6 +89,9 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
inventory.setInventorySlotContents(inInventory.slotID, null); inventory.setInventorySlotContents(inInventory.slotID, null);
setActive(true); setActive(true);
} }
else {
inventory.setInventorySlotContents(inInventory.slotID, inInventory.itemStack);
}
} }
delayTicks = 10; delayTicks = 10;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB