Worked on Soul Forge GUI and container. GUI texture is VERY WIP and the slot locations as well as the progress par will change. Don't work on it >:3
This commit is contained in:
parent
8b024e1703
commit
fec2236114
8 changed files with 232 additions and 6 deletions
30
src/main/java/WayofTime/bloodmagic/tile/TileSoulForge.java
Normal file
30
src/main/java/WayofTime/bloodmagic/tile/TileSoulForge.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
package WayofTime.bloodmagic.tile;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ITickable;
|
||||
|
||||
public class TileSoulForge extends TileInventory implements ITickable
|
||||
{
|
||||
public TileSoulForge()
|
||||
{
|
||||
super(6, "soulForge");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
super.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
super.writeToNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package WayofTime.bloodmagic.tile.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import WayofTime.bloodmagic.api.soul.ISoul;
|
||||
import WayofTime.bloodmagic.api.soul.ISoulGem;
|
||||
import WayofTime.bloodmagic.item.ItemTelepositionFocus;
|
||||
|
||||
public class ContainerSoulForge extends Container
|
||||
{
|
||||
private final IInventory tileForge;
|
||||
|
||||
public ContainerSoulForge(InventoryPlayer inventoryPlayer, IInventory tileForge)
|
||||
{
|
||||
this.tileForge = tileForge;
|
||||
this.addSlotToContainer(new SlotSoul(tileForge, 0, 152, 51));
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int j = 0; j < 9; j++)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 75 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 133));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot)
|
||||
{
|
||||
ItemStack stack = null;
|
||||
Slot slotObject = inventorySlots.get(slot);
|
||||
int slots = inventorySlots.size();
|
||||
|
||||
if (slotObject != null && slotObject.getHasStack())
|
||||
{
|
||||
ItemStack stackInSlot = slotObject.getStack();
|
||||
stack = stackInSlot.copy();
|
||||
|
||||
if (stack.getItem() instanceof ItemTelepositionFocus)
|
||||
{
|
||||
if (slot <= slots)
|
||||
{
|
||||
if (!this.mergeItemStack(stackInSlot, 0, slots, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
} else if (!this.mergeItemStack(stackInSlot, slots, 36 + slots, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (stackInSlot.stackSize == 0)
|
||||
{
|
||||
slotObject.putStack(null);
|
||||
} else
|
||||
{
|
||||
slotObject.onSlotChanged();
|
||||
}
|
||||
|
||||
if (stackInSlot.stackSize == stack.stackSize)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slotObject.onPickupFromSlot(player, stackInSlot);
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer playerIn)
|
||||
{
|
||||
return this.tileForge.isUseableByPlayer(playerIn);
|
||||
}
|
||||
|
||||
private class SlotSoul extends Slot
|
||||
{
|
||||
public SlotSoul(IInventory inventory, int slotIndex, int x, int y)
|
||||
{
|
||||
super(inventory, slotIndex, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack)
|
||||
{
|
||||
return itemStack.getItem() instanceof ISoulGem || itemStack.getItem() instanceof ISoul;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue