2014-04-29 10:54:20 +10:00
|
|
|
package codechicken.nei;
|
|
|
|
|
|
2022-06-24 12:32:13 +01:00
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.List;
|
2023-01-28 17:55:51 -08:00
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
import net.minecraft.client.gui.inventory.GuiChest;
|
|
|
|
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
|
|
|
|
import net.minecraft.inventory.ContainerChest;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
|
|
|
|
|
import codechicken.nei.api.INEIGuiAdapter;
|
|
|
|
|
import codechicken.nei.api.TaggedInventoryArea;
|
2023-01-28 17:55:51 -08:00
|
|
|
|
2022-06-24 12:32:13 +01:00
|
|
|
public class NEIChestGuiHandler extends INEIGuiAdapter {
|
2023-01-28 17:55:51 -08:00
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
public int chestSize(GuiContainer gui) {
|
|
|
|
|
return ((ContainerChest) gui.inventorySlots).getLowerChestInventory().getSizeInventory();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Iterable<Integer> getItemSpawnSlots(GuiContainer gui, ItemStack item) {
|
2019-12-30 20:19:16 -08:00
|
|
|
return gui instanceof GuiChest ? NEIServerUtils.getRange(0, chestSize(gui)) : Collections.emptyList();
|
2014-04-29 10:54:20 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui) {
|
2022-06-24 12:32:13 +01:00
|
|
|
return gui instanceof GuiChest
|
|
|
|
|
? Collections.singletonList(new TaggedInventoryArea("Chest", 0, chestSize(gui), gui.inventorySlots))
|
|
|
|
|
: null;
|
2014-04-29 10:54:20 +10:00
|
|
|
}
|
|
|
|
|
}
|