Files
CustomNPC-Plus/src/main/java/noppes/npcs/containers/ContainerNPCFollower.java
T

41 lines
1.3 KiB
Java
Raw Normal View History

2018-09-13 12:03:28 -04:00
package noppes.npcs.containers;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.roles.RoleFollower;
2025-03-12 20:12:01 -04:00
public class ContainerNPCFollower extends ContainerNpcInterface {
2018-09-13 12:03:28 -04:00
public InventoryNPC currencyMatrix;
2025-03-12 20:12:01 -04:00
public RoleFollower role;
2018-09-13 12:03:28 -04:00
2025-03-12 20:12:01 -04:00
public ContainerNPCFollower(EntityNPCInterface npc, EntityPlayer player) {
super(player);
2018-09-13 12:03:28 -04:00
role = (RoleFollower) npc.roleInterface;
2025-03-12 20:12:01 -04:00
currencyMatrix = new InventoryNPC("currency", 1, this);
addSlotToContainer(new SlotNpcMercenaryCurrency(role, currencyMatrix, 0, 26, 9));
for (int j1 = 0; j1 < 9; j1++) {
addSlotToContainer(new Slot(player.inventory, j1, 8 + j1 * 18, 142));
2018-09-13 12:03:28 -04:00
}
}
@Override
2025-03-12 20:12:01 -04:00
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int i) {
2018-09-13 12:03:28 -04:00
return null;
}
2025-03-12 20:12:01 -04:00
2018-09-13 12:03:28 -04:00
@Override
2025-03-12 20:12:01 -04:00
public void onContainerClosed(EntityPlayer entityplayer) {
2018-09-13 12:03:28 -04:00
super.onContainerClosed(entityplayer);
2025-03-12 20:12:01 -04:00
if (!entityplayer.worldObj.isRemote) {
ItemStack itemstack = currencyMatrix.getStackInSlotOnClosing(0);
if (itemstack != null && !entityplayer.worldObj.isRemote) {
entityplayer.entityDropItem(itemstack, 0f);
}
2018-09-13 12:03:28 -04:00
}
}
}