Slot background images are now painted at runtime

This commit is contained in:
HenryLoenwind committed 2015-10-26 18:37:28 +01:00
1 parent 01b80a7e35
commit 141d806d51
40 files changed
+292 -12

No files matched your search

@@ -12,6 +12,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.client.gui.widget.GhostBackgroundItemSlot;
import com.enderio.core.client.gui.widget.GhostSlot;
import com.enderio.core.common.ContainerEnder;
import com.enderio.core.common.util.ItemUtil;
@@ -41,6 +43,7 @@ public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrade
private final List<Point> slotLocations = new ArrayList<Point>();
final List<FilterChangeListener> filterListeners = new ArrayList<FilterChangeListener>();
final List<GhostBackgroundItemSlot> bgSlots = new ArrayList<GhostBackgroundItemSlot>();
public ExternalConnectionContainer(InventoryPlayer playerInv, IConduitBundle bundle, ForgeDirection dir) {
super(playerInv, new InventoryUpgrades(bundle.getConduit(IItemConduit.class), dir));
@@ -55,11 +58,13 @@ public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrade
y = 47;
slotOutputFilterUpgrades = addSlotToContainer(new FilterSlot(getInv(), 3, x, y));
slotLocations.add(new Point(x, y));
bgSlots.add(new GhostBackgroundItemSlot(EnderIO.itemBasicFilterUpgrade, slotOutputFilterUpgrades));
x = 10;
y = 47;
slotInputFilterUpgrades = addSlotToContainer(new FilterSlot(getInv(), 2, x, y));
slotLocations.add(new Point(x, y));
bgSlots.add(new GhostBackgroundItemSlot(EnderIO.itemBasicFilterUpgrade, slotInputFilterUpgrades));
x = 28;
y = 47;
@@ -75,6 +80,7 @@ public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrade
}
});
slotLocations.add(new Point(x, y));
bgSlots.add(new GhostBackgroundItemSlot(EnderIO.itemExtractSpeedUpgrade, slotSpeedUpgrades));
x = 10;
y = 65;
@@ -90,9 +96,14 @@ public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrade
}
});
slotLocations.add(new Point(x, y));
bgSlots.add(new GhostBackgroundItemSlot(EnderIO.itemFunctionUpgrade, slotFunctionUpgrades));
}
}
public void createGhostSlots(List<GhostSlot> slots) {
slots.addAll(bgSlots);
}
@Override
public Point getPlayerInventoryOffset() {
return new Point(23, 113);
@@ -113,6 +113,7 @@ public class GuiExternalConnection extends GuiContainerBase {
public void initGui() {
super.initGui();
buttonList.clear();
((ExternalConnectionContainer) inventorySlots).createGhostSlots(getGhostSlots());
for (int i = 0; i < tabs.size(); i++) {
if(i == activeTab) {
tabs.get(i).onGuiInit(guiLeft + 10, guiTop, xSize - 20, ySize - 20);
@@ -120,7 +121,6 @@ public class GuiExternalConnection extends GuiContainerBase {
tabs.get(i).deactivate();
}
}
}
@Override
@@ -231,4 +231,9 @@ public class GuiExternalConnection extends GuiContainerBase {
itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, stack, x, y, "");
}
public void clearGhostSlots() {
getGhostSlots().clear();
((ExternalConnectionContainer) inventorySlots).createGhostSlots(getGhostSlots());
}
}
@@ -428,7 +428,7 @@ public class ItemSettings extends BaseSettingsPanel {
filterGui.deactivate();
filterGui = null;
}
gui.getGhostSlots().clear();
gui.clearGhostSlots();
}
}
@@ -1,5 +1,7 @@
package crazypants.enderio.machine.enchanter;
import java.util.List;
import net.minecraft.enchantment.EnchantmentData;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -7,8 +9,12 @@ import net.minecraft.init.Items;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import com.enderio.core.client.gui.widget.GhostBackgroundItemSlot;
import com.enderio.core.client.gui.widget.GhostSlot;
import com.enderio.core.common.ContainerEnder;
import crazypants.enderio.EnderIO;
public class ContainerEnchanter extends ContainerEnder<TileEnchanter> {
public ContainerEnchanter(EntityPlayer player, InventoryPlayer playerInv, TileEnchanter te) {
@@ -101,6 +107,10 @@ public class ContainerEnchanter extends ContainerEnder<TileEnchanter> {
});
}
public void createGhostSlots(List<GhostSlot> slots) {
slots.add(new GhostBackgroundItemSlot(Items.writable_book, 27, 35));
}
public boolean playerHasEnoughLevels(EntityPlayer player) {
if(player.capabilities.isCreativeMode) {
return true;
@@ -13,6 +13,7 @@ import com.enderio.core.client.render.RenderUtil;
import crazypants.enderio.EnderIO;
import crazypants.enderio.gui.IconEIO;
import crazypants.enderio.machine.obelisk.attractor.ContainerAttractor;
public class GuiEnchanter extends GuiContainerBase {
@@ -35,6 +36,7 @@ public class GuiEnchanter extends GuiContainerBase {
super.initGui();
recipeButton.onGuiInit();
recipeButton.visible = EnderIO.proxy.isNeiInstalled();
((ContainerEnchanter) inventorySlots).createGhostSlots(getGhostSlots());
}
@Override
@@ -1,14 +1,70 @@
package crazypants.enderio.machine.farm;
import java.awt.Point;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import com.enderio.core.client.gui.widget.GhostBackgroundItemSlot;
import com.enderio.core.client.gui.widget.GhostSlot;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import crazypants.enderio.config.Config;
import crazypants.enderio.item.darksteel.DarkSteelItems;
import crazypants.enderio.machine.farm.farmers.RubberTreeFarmerIC2;
import crazypants.enderio.machine.gui.AbstractMachineContainer;
public class FarmStationContainer extends AbstractMachineContainer<TileFarmStation> {
// TODO: This is a mess. Someone should make some nice, hand-selected lists of
// what to put in here.
static private final Item[] slotItems1 = { Items.wooden_hoe, Items.stone_hoe, Items.iron_hoe, Items.golden_hoe, Items.diamond_hoe };
static private final List<ItemStack> slotItemsStacks1 = new ArrayList<ItemStack>();
static {
for (Item item : slotItems1) {
slotItemsStacks1.add(new ItemStack(item));
}
slotItemsStacks1.addAll(Config.farmHoes);
}
static private final Item[] slotItems2 = { Items.wooden_axe, Items.stone_axe, Items.iron_axe, Items.golden_axe,
Items.diamond_axe, DarkSteelItems.itemDarkSteelAxe };
static private final Item[] slotItems3 = RubberTreeFarmerIC2.treeTap != null ? new Item[] { Items.shears,
DarkSteelItems.itemDarkSteelShears, GameRegistry.findItem("IC2", "itemTreetap") } : new Item[] { Items.shears,
DarkSteelItems.itemDarkSteelShears };
static public final List<ItemStack> slotItemsSeeds = new ArrayList<ItemStack>();
static {
slotItemsSeeds.add(new ItemStack(Items.wheat_seeds));
slotItemsSeeds.add(new ItemStack(Blocks.carrots));
slotItemsSeeds.add(new ItemStack(Blocks.potatoes));
slotItemsSeeds.add(new ItemStack(Blocks.red_mushroom));
slotItemsSeeds.add(new ItemStack(Blocks.brown_mushroom));
slotItemsSeeds.add(new ItemStack(Blocks.nether_wart));
slotItemsSeeds.add(new ItemStack(Blocks.sapling));
slotItemsSeeds.add(new ItemStack(Items.reeds));
}
static public final List<ItemStack> slotItemsProduce = new ArrayList<ItemStack>();
static {
slotItemsProduce.add(new ItemStack(Blocks.log, 1, 0));
slotItemsProduce.add(new ItemStack(Blocks.wheat));
slotItemsProduce.add(new ItemStack(Blocks.leaves, 1, 0));
slotItemsProduce.add(new ItemStack(Items.apple));
}
static public final List<ItemStack> slotItemsFertilizer = new ArrayList<ItemStack>();
static {
slotItemsFertilizer.add(new ItemStack(Items.dye, 1, 15));
}
static private final Random rand = new Random();
private static final int ROW_TOOLS = 19;
private static final int ROW_IO = 44;
@@ -22,14 +78,7 @@ public class FarmStationContainer extends AbstractMachineContainer<TileFarmStati
private static final int TWO = 1 * SLOT_SIZE;
private static final int THREE = 2 * SLOT_SIZE;
public FarmStationContainer(InventoryPlayer inventory, TileFarmStation te) {
super(inventory,te);
}
@Override
protected void addMachineSlots(InventoryPlayer playerInv) {
Point[] points = new Point[] {
private static final Point[] points = new Point[] {
new Point(COL_TOOLS + ONE, ROW_TOOLS),
new Point(COL_TOOLS + TWO, ROW_TOOLS),
new Point(COL_TOOLS + THREE, ROW_TOOLS),
@@ -50,6 +99,12 @@ public class FarmStationContainer extends AbstractMachineContainer<TileFarmStati
new Point(COL_OUTPUT + THREE, ROW_IO + TWO),
};
public FarmStationContainer(InventoryPlayer inventory, TileFarmStation te) {
super(inventory, te);
}
@Override
protected void addMachineSlots(InventoryPlayer playerInv) {
int i=0;
for(Point p : points) {
final int slot = i;
@@ -69,6 +124,42 @@ public class FarmStationContainer extends AbstractMachineContainer<TileFarmStati
}
private static void clean(List list) {
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
final Object o = iterator.next();
if (o == null || (o instanceof ItemStack && ((ItemStack) o).getItem() == null)) {
iterator.remove();
}
}
}
public void createGhostSlots(List<GhostSlot> slots) {
clean(slotItemsStacks1);
clean(slotItemsFertilizer);
clean(slotItemsSeeds);
clean(slotItemsProduce);
slots.add(new GhostBackgroundItemSlot(slotItemsStacks1.get(rand.nextInt(slotItemsStacks1.size())), points[0].x, points[0].y));
slots.add(new GhostBackgroundItemSlot(slotItems2[rand.nextInt(slotItems2.length)], points[1].x, points[1].y));
slots.add(new GhostBackgroundItemSlot(slotItems3[rand.nextInt(slotItems3.length)], points[2].x, points[2].y));
slots.add(new GhostBackgroundItemSlot(slotItemsFertilizer.get(rand.nextInt(slotItemsFertilizer.size())), points[3].x,
points[3].y));
slots.add(new GhostBackgroundItemSlot(slotItemsFertilizer.get(rand.nextInt(slotItemsFertilizer.size())), points[4].x,
points[4].y));
for (int i = 0; i < 4; i++) {
slots.add(new GhostBackgroundItemSlot(slotItemsSeeds.get(rand.nextInt(slotItemsSeeds.size())), points[5 + i].x,
points[5 + i].y));
}
for (int i = 0; i < 6; i++) {
slots.add(new GhostBackgroundItemSlot(slotItemsProduce.get(rand.nextInt(slotItemsProduce.size())), points[9 + i].x,
points[9 + i].y));
}
}
@Override
public Point getPlayerInventoryOffset() {
return new Point(8,87);
@@ -102,6 +102,9 @@ public enum Fertilizer {
private Fertilizer(ItemStack stack) {
this.stack = stack == null || stack.getItem() == null ? null : stack;
if (this.stack != null) {
FarmStationContainer.slotItemsFertilizer.add(this.stack);
}
}
private static final List<Fertilizer> validFertilizers = Lists.newArrayList();
@@ -17,6 +17,7 @@ import com.enderio.core.common.vecmath.Vector4f;
import crazypants.enderio.EnderIO;
import crazypants.enderio.gui.IconEIO;
import crazypants.enderio.machine.gui.GuiPoweredMachineBase;
import crazypants.enderio.machine.killera.ContainerKillerJoe;
public class GuiFarmStation extends GuiPoweredMachineBase<TileFarmStation> {
@@ -39,6 +40,8 @@ public class GuiFarmStation extends GuiPoweredMachineBase<TileFarmStation> {
buttonList.add(createLockButton(TileFarmStation.minSupSlot + 1, x + 52, y));
buttonList.add(createLockButton(TileFarmStation.minSupSlot + 2, x, y + 20));
buttonList.add(createLockButton(TileFarmStation.minSupSlot + 3, x + 52, y + 20));
((FarmStationContainer) inventorySlots).createGhostSlots(getGhostSlots());
}
private IconButton createLockButton(int slot, int x, int y) {
@@ -13,6 +13,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.common.util.BlockCoord;
import crazypants.enderio.machine.farm.FarmStationContainer;
import crazypants.enderio.machine.farm.TileFarmStation;
public class CustomSeedFarmer implements IFarmerJoe {
@@ -39,6 +40,7 @@ public class CustomSeedFarmer implements IFarmerJoe {
this.plantedBlockMeta = plantedBlockMeta;
this.grownBlockMeta = grownBlockMeta;
this.seeds = seeds;
FarmStationContainer.slotItemsSeeds.add(seeds);
addTilledBlock(Blocks.farmland);
}
@@ -5,11 +5,13 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import com.enderio.core.common.util.BlockCoord;
import crazypants.enderio.machine.farm.FarmStationContainer;
import crazypants.enderio.machine.farm.TileFarmStation;
public class FlowerPicker implements IFarmerJoe {
@@ -23,6 +25,7 @@ public class FlowerPicker implements IFarmerJoe {
for (Block block : flowers) {
if (block != null) {
this.flowers.add(block);
FarmStationContainer.slotItemsProduce.add(new ItemStack(block));
}
}
return this;
@@ -9,6 +9,7 @@ import net.minecraft.world.World;
import com.enderio.core.common.util.BlockCoord;
import cpw.mods.fml.common.registry.GameRegistry;
import crazypants.enderio.machine.farm.FarmStationContainer;
import crazypants.enderio.machine.farm.TileFarmStation;
import crazypants.enderio.machine.farm.TileFarmStation.ToolType;
@@ -26,6 +27,7 @@ public class RubberTreeFarmerIC2 extends TreeFarmer {
item = GameRegistry.findItem("IC2", "itemHarz");
if(item != null) {
stickyResin = new ItemStack(item);
FarmStationContainer.slotItemsProduce.add(stickyResin);
}
}
@@ -5,6 +5,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import scala.actors.threadpool.Arrays;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
@@ -18,6 +19,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.common.util.BlockCoord;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.farm.FarmStationContainer;
import crazypants.enderio.machine.farm.TileFarmStation;
public class TreeFarmer implements IFarmerJoe {
@@ -35,8 +37,12 @@ public class TreeFarmer implements IFarmerJoe {
this.sapling = sapling;
if(sapling != null) {
saplingItem = new ItemStack(sapling);
FarmStationContainer.slotItemsSeeds.add(saplingItem);
}
woods = wood;
for (Block awood : woods) {
FarmStationContainer.slotItemsProduce.add(new ItemStack(awood));
}
}
public TreeFarmer(boolean ignoreMeta, Block sapling, Block... wood) {
@@ -59,6 +59,10 @@ public abstract class AbstractMachineContainer<T extends AbstractMachineEntity>
return upgradeSlot;
}
/**
* ATTN: Do not access any non-static field from this method. Your object has
* not yet been constructed when it is called!
*/
protected abstract void addMachineSlots(InventoryPlayer playerInv);
@Override
@@ -39,6 +39,7 @@ import crazypants.enderio.EnderIO;
import crazypants.enderio.config.Config;
import crazypants.enderio.fluid.Fluids;
import crazypants.enderio.gui.IconEIO;
import crazypants.enderio.machine.enchanter.ContainerEnchanter;
import crazypants.enderio.machine.gui.GuiMachineBase;
import crazypants.enderio.machine.invpanel.client.CraftingHelper;
import crazypants.enderio.machine.invpanel.client.DatabaseView;
@@ -262,6 +263,7 @@ public class GuiInventoryPanel extends GuiMachineBase<TileInventoryPanel> {
btnClear.onGuiInit();
btnSync.onGuiInit();
addScrollbar(scrollbar);
((InventoryPanelContainer) inventorySlots).createGhostSlots(getGhostSlots());
}
@Override
@@ -23,9 +23,12 @@ import net.minecraft.item.crafting.CraftingManager;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
import com.enderio.core.client.gui.widget.GhostBackgroundItemSlot;
import com.enderio.core.client.gui.widget.GhostSlot;
import com.enderio.core.common.util.ItemUtil;
import cpw.mods.fml.common.FMLCommonHandler;
import crazypants.enderio.EnderIO;
import crazypants.enderio.machine.gui.AbstractMachineContainer;
import crazypants.enderio.machine.invpanel.server.ChangeLog;
import crazypants.enderio.machine.invpanel.server.InventoryDatabaseServer;
@@ -128,6 +131,10 @@ public class InventoryPanelContainer extends AbstractMachineContainer<TileInvent
endSlotReturn = inventorySlots.size();
}
public void createGhostSlots(List<GhostSlot> slots) {
slots.add(new GhostBackgroundItemSlot(EnderIO.itemBasicFilterUpgrade, FILTER_SLOT_X, FILTER_SLOT_Y));
}
@Override
public Point getPlayerInventoryOffset() {
return new Point(24+39, 130);
@@ -1,12 +1,26 @@
package crazypants.enderio.machine.killera;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import com.enderio.core.client.gui.widget.GhostBackgroundItemSlot;
import com.enderio.core.client.gui.widget.GhostSlot;
import crazypants.enderio.item.darksteel.DarkSteelItems;
import crazypants.enderio.machine.gui.AbstractMachineContainer;
public class ContainerKillerJoe extends AbstractMachineContainer<TileKillerJoe> {
static private final Item[] slotItems = { Items.wooden_sword, Items.stone_sword, Items.iron_sword, Items.golden_sword,
Items.diamond_sword, DarkSteelItems.itemDarkSteelSword };
static private final Random rand = new Random();
public ContainerKillerJoe(InventoryPlayer playerInv, TileKillerJoe te) {
super(playerInv, te);
}
@@ -21,4 +35,8 @@ public class ContainerKillerJoe extends AbstractMachineContainer<TileKillerJoe>
});
}
public void createGhostSlots(List<GhostSlot> slots) {
slots.add(new GhostBackgroundItemSlot(slotItems[rand.nextInt(slotItems.length)], 80, 25));
}
}
@@ -17,6 +17,7 @@ import crazypants.enderio.fluid.Fluids;
import crazypants.enderio.gui.IconEIO;
import crazypants.enderio.machine.IoMode;
import crazypants.enderio.machine.gui.GuiMachineBase;
import crazypants.enderio.machine.invpanel.InventoryPanelContainer;
import crazypants.enderio.network.PacketHandler;
import crazypants.enderio.xp.ExperienceBarRenderer;
import crazypants.enderio.xp.PacketGivePlayerXP;
@@ -60,6 +61,7 @@ public class GuiKillerJoe extends GuiMachineBase<TileKillerJoe> {
super.initGui();
xpB.onGuiInit();
xp10B.onGuiInit();
((ContainerKillerJoe) inventorySlots).createGhostSlots(getGhostSlots());
}
@Override
@@ -1,8 +1,15 @@
package crazypants.enderio.machine.obelisk.attractor;
import java.util.ArrayList;
import java.util.List;
import com.enderio.core.client.gui.widget.GhostBackgroundItemSlot;
import com.enderio.core.client.gui.widget.GhostSlot;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import crazypants.enderio.EnderIO;
import crazypants.enderio.machine.gui.AbstractMachineContainer;
public class ContainerAttractor extends AbstractMachineContainer<TileAttractor> {
@@ -31,4 +38,16 @@ public class ContainerAttractor extends AbstractMachineContainer<TileAttractor>
}
}
public void createGhostSlots(List<GhostSlot> slots) {
int y = 10;
for (int row = 0; row < 3; row++) {
int x = 62;
for (int col = 0; col < 4; col++) {
slots.add(new GhostBackgroundItemSlot(EnderIO.itemSoulVessel, x, y));
x += 18;
}
y += 18;
}
}
}
@@ -15,6 +15,7 @@ import com.enderio.core.client.render.RenderUtil;
import com.google.common.collect.Lists;
import crazypants.enderio.EnderIO;
import crazypants.enderio.conduit.gui.ExternalConnectionContainer;
import crazypants.enderio.gui.IconEIO;
import crazypants.enderio.machine.gui.GuiPoweredMachineBase;
@@ -43,6 +44,7 @@ public class GuiAttractor extends GuiPoweredMachineBase<TileAttractor> {
super.initGui();
showRangeB.onGuiInit();
showRangeB.setSelected(getTileEntity().isShowingRange());
((ContainerAttractor) inventorySlots).createGhostSlots(getGhostSlots());
}
@Override
@@ -1,14 +1,28 @@
package crazypants.enderio.machine.slicensplice;
import java.awt.Point;
import java.util.List;
import java.util.Random;
import com.enderio.core.client.gui.widget.GhostBackgroundItemSlot;
import com.enderio.core.client.gui.widget.GhostSlot;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import crazypants.enderio.item.darksteel.DarkSteelItems;
import crazypants.enderio.machine.gui.AbstractMachineContainer;
public class ContainerSliceAndSplice extends AbstractMachineContainer<TileSliceAndSplice> {
static private final Item[] slotItems1 = { Items.wooden_axe, Items.stone_axe, Items.iron_axe, Items.golden_axe,
Items.diamond_axe, DarkSteelItems.itemDarkSteelAxe };
static private final Item[] slotItems2 = { Items.shears, Items.shears, Items.shears, Items.shears,
DarkSteelItems.itemDarkSteelShears };
static private final Random rand = new Random();
public static final Point[] INPUT_SLOTS = new Point[] {
new Point(44,40),
new Point(62,40),
@@ -50,4 +64,9 @@ public class ContainerSliceAndSplice extends AbstractMachineContainer<TileSliceA
}
public void createGhostSlots(List<GhostSlot> slots) {
slots.add(new GhostBackgroundItemSlot(slotItems1[rand.nextInt(slotItems1.length)], 54, 16));
slots.add(new GhostBackgroundItemSlot(slotItems2[rand.nextInt(slotItems2.length)], 72, 16));
}
}
@@ -7,6 +7,7 @@ import org.lwjgl.opengl.GL11;
import com.enderio.core.client.render.RenderUtil;
import crazypants.enderio.machine.gui.GuiPoweredMachineBase;
import crazypants.enderio.machine.killera.ContainerKillerJoe;
public class GuiSliceAndSplice extends GuiPoweredMachineBase<TileSliceAndSplice> {
@@ -16,6 +17,12 @@ public class GuiSliceAndSplice extends GuiPoweredMachineBase<TileSliceAndSplice>
addProgressTooltip(103, 49, 24, 16);
}
@Override
public void initGui() {
super.initGui();
((ContainerSliceAndSplice) inventorySlots).createGhostSlots(getGhostSlots());
}
/**
* Draw the background layer for the GuiContainer (everything behind the
* items)
@@ -1,8 +1,15 @@
package crazypants.enderio.machine.soul;
import java.util.List;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import com.enderio.core.client.gui.widget.GhostBackgroundItemSlot;
import com.enderio.core.client.gui.widget.GhostSlot;
import crazypants.enderio.EnderIO;
import crazypants.enderio.machine.gui.AbstractMachineContainer;
public class ContainerSoulBinder extends AbstractMachineContainer<TileSoulBinder> {
@@ -39,4 +46,9 @@ public class ContainerSoulBinder extends AbstractMachineContainer<TileSoulBinde
});
}
public void createGhostSlots(List<GhostSlot> slots) {
slots.add(new GhostBackgroundItemSlot(EnderIO.itemSoulVessel, 38, 34));
slots.add(new GhostBackgroundItemSlot(EnderIO.itemBrokenSpawner, 59, 34));
}
}
@@ -11,6 +11,7 @@ import com.enderio.core.client.render.RenderUtil;
import com.enderio.core.common.util.SoundUtil;
import crazypants.enderio.gui.IconEIO;
import crazypants.enderio.machine.enchanter.ContainerEnchanter;
import crazypants.enderio.machine.gui.GuiPoweredMachineBase;
import crazypants.enderio.network.PacketHandler;
import crazypants.enderio.xp.ExperienceBarRenderer;
@@ -36,6 +37,7 @@ public class GuiSoulBinder extends GuiPoweredMachineBase<TileSoulBinder> {
public void initGui() {
super.initGui();
usePlayerXP.onGuiInit();
((ContainerSoulBinder) inventorySlots).createGhostSlots(getGhostSlots());
}
@Override
@@ -1,8 +1,15 @@
package crazypants.enderio.machine.spawner;
import java.util.List;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import com.enderio.core.client.gui.widget.GhostBackgroundItemSlot;
import com.enderio.core.client.gui.widget.GhostSlot;
import crazypants.enderio.EnderIO;
import crazypants.enderio.machine.gui.AbstractMachineContainer;
public class ContainerPoweredSpawner extends AbstractMachineContainer<TilePoweredSpawner> {
@@ -30,6 +37,12 @@ public class ContainerPoweredSpawner extends AbstractMachineContainer<TilePowere
});
}
public void createGhostSlots(List<GhostSlot> slots) {
final GhostBackgroundItemSlot ghostBackgroundItemSlot = new GhostBackgroundItemSlot(EnderIO.itemSoulVessel, slotInput);
ghostBackgroundItemSlot.y = 42;
slots.add(ghostBackgroundItemSlot);
}
public void setSlotVisibility(boolean visible) {
slotInput.yDisplayPosition = visible ? 42 : -3000;
slotOutput.yDisplayPosition = visible ? 42 : -3000;
@@ -16,6 +16,7 @@ import com.enderio.core.common.Lang;
import crazypants.enderio.EnderIO;
import crazypants.enderio.machine.gui.GuiPoweredMachineBase;
import crazypants.enderio.machine.killera.ContainerKillerJoe;
import crazypants.enderio.network.PacketHandler;
public class GuiPoweredSpawner extends GuiPoweredMachineBase<TilePoweredSpawner> {
@@ -41,6 +42,7 @@ public class GuiPoweredSpawner extends GuiPoweredMachineBase<TilePoweredSpawner>
public void initGui() {
super.initGui();
modeB.onGuiInit();
((ContainerPoweredSpawner) inventorySlots).createGhostSlots(getGhostSlots());
}
@Override
@@ -1,12 +1,25 @@
package crazypants.enderio.machine.tank;
import java.util.List;
import java.util.Random;
import com.enderio.core.client.gui.widget.GhostBackgroundItemSlot;
import com.enderio.core.client.gui.widget.GhostSlot;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import crazypants.enderio.EnderIO;
import crazypants.enderio.machine.gui.AbstractMachineContainer;
public class ContainerTank extends AbstractMachineContainer<TileTank> {
static private final Item[] slotItems = { Items.water_bucket, Items.lava_bucket, EnderIO.itemBucketNutrientDistillation,
EnderIO.itemBucketHootch, EnderIO.itemBucketRocketFuel, EnderIO.itemBucketFireWater };
static private final Random rand = new Random();
public ContainerTank(InventoryPlayer playerInv, TileTank te) {
super(playerInv, te);
}
@@ -45,4 +58,11 @@ public class ContainerTank extends AbstractMachineContainer<TileTank> {
});
}
public void createGhostSlots(List<GhostSlot> slots) {
slots.add(new GhostBackgroundItemSlot(slotItems[rand.nextInt(slotItems.length)], 44, 21));
slots.add(new GhostBackgroundItemSlot(Items.bucket, 116, 21));
slots.add(new GhostBackgroundItemSlot(Items.bucket, 44, 52));
slots.add(new GhostBackgroundItemSlot(slotItems[rand.nextInt(slotItems.length)], 116, 52));
}
}
@@ -21,6 +21,7 @@ import crazypants.enderio.EnderIO;
import crazypants.enderio.fluid.Fluids;
import crazypants.enderio.gui.IconEIO;
import crazypants.enderio.machine.gui.GuiMachineBase;
import crazypants.enderio.machine.killera.ContainerKillerJoe;
import crazypants.enderio.network.PacketHandler;
public class GuiTank extends GuiMachineBase<TileTank> {
@@ -85,6 +86,7 @@ public class GuiTank extends GuiMachineBase<TileTank> {
super.initGui();
voidBut.onGuiInit();
voidBut.setMode(getTileEntity().getVoidMode());
((ContainerTank) inventorySlots).createGhostSlots(getGhostSlots());
}
@Override
@@ -1,14 +1,19 @@
package crazypants.enderio.machine.vacuum;
import java.awt.Point;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import com.enderio.core.client.gui.widget.GhostBackgroundItemSlot;
import com.enderio.core.client.gui.widget.GhostSlot;
import com.enderio.core.common.ContainerEnder;
import crazypants.enderio.EnderIO;
public class ContainerVacuumChest extends ContainerEnder<TileVacuumChest> {
private Slot filterSlot;
@@ -33,6 +38,10 @@ public class ContainerVacuumChest extends ContainerEnder<TileVacuumChest> {
addSlotToContainer(filterSlot);
}
public void createGhostSlots(List<GhostSlot> slots) {
slots.add(new GhostBackgroundItemSlot(EnderIO.itemBasicFilterUpgrade, filterSlot));
}
@Override
public Point getPlayerInventoryOffset() {
Point p = super.getPlayerInventoryOffset();
@@ -25,6 +25,7 @@ import crazypants.enderio.EnderIO;
import crazypants.enderio.conduit.item.filter.ItemFilter;
import crazypants.enderio.gui.IconEIO;
import crazypants.enderio.gui.RedstoneModeButton;
import crazypants.enderio.machine.killera.ContainerKillerJoe;
import crazypants.enderio.network.PacketHandler;
public class GuiVacuumChest extends GuiContainerBase {
@@ -116,6 +117,7 @@ public class GuiVacuumChest extends GuiContainerBase {
addToolTip(rangeTooltip);
filterChanged();
((ContainerVacuumChest) inventorySlots).createGhostSlots(getGhostSlots());
}
@Override
@@ -180,8 +182,6 @@ public class GuiVacuumChest extends GuiContainerBase {
if(te.getItemFilter() != null) {
drawTexturedModalRect(sx + FILTER_LEFT, sy + FILTER_TOP, 0, 238, TileVacuumChest.FILTER_SLOTS*18, 18);
drawGhostSlots(mouseX, mouseY);
}
int headerColor = 0x404040;
@@ -195,6 +195,8 @@ public class GuiVacuumChest extends GuiContainerBase {
String str = Integer.toString(te.getRange());
int sw = fr.getStringWidth(str);
fr.drawString(str, sx + RANGE_LEFT + RANGE_WIDTH - sw - 5, sy + RANGE_TOP + 5, ColorUtil.getRGB(Color.black));
super.drawGuiContainerBackgroundLayer(par1, mouseX, mouseY);
}
class FilterGhostSlot extends GhostSlot {