-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathContainerPrefab.java
42 lines (34 loc) · 1.2 KB
/
ContainerPrefab.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package me.planetguy.lib.prefab;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
public abstract class ContainerPrefab extends Container {
public ContainerPrefab(InventoryPlayer inventoryPlayer, TileEntity te){
makeSlots(te);
bindPlayerInventory(inventoryPlayer);
}
public abstract void makeSlots(TileEntity te);
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;//tileEntity.isUseableByPlayer(player);
}
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
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, 84 + i * 18));
}
}
for (int i = 0; i < 9; i++) {
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p, int slot){
return null;
}
}