Fixed teleposers

This commit is contained in:
Arcaratus 2015-05-11 19:08:06 -04:00
parent 307184fb85
commit 1eefcda6ca
4 changed files with 20 additions and 25 deletions

View file

@ -1,13 +1,11 @@
package WayofTime.alchemicalWizardry.common.commands; package WayofTime.alchemicalWizardry.common.commands;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import net.minecraft.command.CommandBase; import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException; import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender; import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import java.util.List; import java.util.List;
@ -99,7 +97,7 @@ public class CommandSN extends CommandBase
} }
else if (astring.length == 2) else if (astring.length == 2)
{ {
return getListOfStringsMatchingLastWord(astring, "add", "subtract", "fill", "empty"); return getListOfStringsMatchingLastWord(astring, "add", "subtract", "fill", "empty", "get");
} }
return null; return null;

View file

@ -1,5 +1,6 @@
package WayofTime.alchemicalWizardry.common.tileEntity.container; package WayofTime.alchemicalWizardry.common.tileEntity.container;
import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer; import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
@ -14,7 +15,7 @@ public class ContainerTeleposer extends Container
public ContainerTeleposer(InventoryPlayer inventoryPlayer, TETeleposer te) public ContainerTeleposer(InventoryPlayer inventoryPlayer, TETeleposer te)
{ {
tileEntity = te; tileEntity = te;
addSlotToContainer(new Slot(tileEntity, 0, 80, 67)); addSlotToContainer(new Slot(tileEntity, 0, 80, 15));
bindPlayerInventory(inventoryPlayer); bindPlayerInventory(inventoryPlayer);
} }
@ -30,13 +31,13 @@ public class ContainerTeleposer extends Container
{ {
for (int j = 0; j < 9; j++) for (int j = 0; j < 9; j++)
{ {
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 140 + i * 18)); addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 39 + i * 18));
} }
} }
for (int i = 0; i < 9; i++) for (int i = 0; i < 9; i++)
{ {
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 198)); addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 97));
} }
} }
@ -45,30 +46,27 @@ public class ContainerTeleposer extends Container
{ {
ItemStack stack = null; ItemStack stack = null;
Slot slotObject = (Slot) inventorySlots.get(slot); Slot slotObject = (Slot) inventorySlots.get(slot);
int slots = inventorySlots.size();
if (slotObject != null && slotObject.getHasStack()) if (slotObject != null && slotObject.getHasStack())
{ {
ItemStack stackInSlot = slotObject.getStack(); ItemStack stackInSlot = slotObject.getStack();
stack = stackInSlot.copy(); stack = stackInSlot.copy();
System.out.println("Slots: " + slots);
if (slot == 7) if (stack.getItem() instanceof TelepositionFocus)
{ {
if (!this.mergeItemStack(stackInSlot, 7, 35, true)) if (slot <= slots)
{
if (!this.mergeItemStack(stackInSlot, 0, slots, false))
{
return null;
}
}
else if (!this.mergeItemStack(stackInSlot, slots, 36 + slots, false))
{ {
return null; return null;
} }
slotObject.onSlotChange(stackInSlot, stack);
}
if (slot < 1)
{
if (!this.mergeItemStack(stackInSlot, 7, 35, true))
{
return null;
}
}
else if (!this.mergeItemStack(stackInSlot, 0, 0, false))
{
return null;
} }
if (stackInSlot.stackSize == 0) if (stackInSlot.stackSize == 0)

View file

@ -15,16 +15,16 @@ public class GuiTeleposer extends GuiContainer
{ {
super(new ContainerTeleposer(inventoryPlayer, tileEntity)); super(new ContainerTeleposer(inventoryPlayer, tileEntity));
xSize = 176; xSize = 176;
ySize = 222; ySize = 121;
} }
@Override @Override
protected void drawGuiContainerForegroundLayer(int param1, int param2) protected void drawGuiContainerForegroundLayer(int param1, int param2)
{ {
//the parameters for drawString are: string, x, y, color //the parameters for drawString are: string, x, y, color
fontRendererObj.drawString("Teleposer", 8, 6, 4210752); fontRendererObj.drawString("Teleposer", 64, 5, 4210752);
//draws "Inventory" or your regional equivalent //draws "Inventory" or your regional equivalent
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, 130, 4210752); fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, 29, 4210752);
} }
@Override @Override
@ -37,6 +37,5 @@ public class GuiTeleposer extends GuiContainer
int x = (width - xSize) / 2; int x = (width - xSize) / 2;
int y = (height - ySize) / 2; int y = (height - ySize) / 2;
this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
GuiBrewingStand d;
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 986 B

After

Width:  |  Height:  |  Size: 1.2 KiB