diff options
| author | Draknyte1 <Draknyte1@hotmail.com> | 2016-08-27 01:34:08 +1000 |
|---|---|---|
| committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-08-27 01:34:08 +1000 |
| commit | 072f6322fb789703f163030edf4b60bf5a0201af (patch) | |
| tree | 9d2d9c2ba6fe3bc5139a9868ee4eca95629fdd95 /src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui | |
| parent | f555ac2e146e572155e176131c23e73cd74684f1 (diff) | |
| download | GT5-Unofficial-072f6322fb789703f163030edf4b60bf5a0201af.tar.gz GT5-Unofficial-072f6322fb789703f163030edf4b60bf5a0201af.tar.bz2 GT5-Unofficial-072f6322fb789703f163030edf4b60bf5a0201af.zip | |
+ Attempted to add custom IC2 generators.
% Refactored the xmod package to be a parent, beside core. No longer is it a child, it needs room to grow.
Diffstat (limited to 'src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui')
| -rw-r--r-- | src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui/CONTAINER_RadioThermalGenerator.java | 98 | ||||
| -rw-r--r-- | src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui/GUI_RadioThermalGenerator.java | 49 |
2 files changed, 147 insertions, 0 deletions
diff --git a/src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui/CONTAINER_RadioThermalGenerator.java b/src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui/CONTAINER_RadioThermalGenerator.java new file mode 100644 index 0000000000..b70bb6bd8d --- /dev/null +++ b/src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui/CONTAINER_RadioThermalGenerator.java @@ -0,0 +1,98 @@ +package miscutil.xmod.ic2.block.RTGGenerator.gui; + +import miscutil.core.lib.CORE; +import miscutil.core.slots.SlotRTG; +import miscutil.xmod.ic2.block.RTGGenerator.TileEntityRTG; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import forestry.api.apiculture.IHiveFrame; +import forestry.core.gui.tooltips.ToolTip; + +public class CONTAINER_RadioThermalGenerator extends Container +{ + private TileEntityRTG te; + + public static final int INPUT_1 = 0; + private final ResourceLocation beeFrameIcon = new ResourceLocation(CORE.MODID, "textures/items/machine_Charger.png"); + public ToolTip newTip = new ToolTip(); + public final SlotRTG rtgSlot; + + private int slotID = 0; + + public CONTAINER_RadioThermalGenerator(TileEntityRTG te, EntityPlayer player) + { + this.te = te; + this.rtgSlot = new SlotRTG(te, slotID++, 80, 35); + + //Fuel Slot A + rtgSlot.setBackgroundIconTexture(beeFrameIcon); + + addSlotToContainer(rtgSlot); + + //Inventory + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 9; j++) + { + addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + // Hotbar + for (int i = 0; i < 9; i++) + { + addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) + { + ItemStack stack = null; + Slot slot = (Slot)inventorySlots.get(slotRaw); + + if (slot != null && slot.getHasStack()) + { + ItemStack stackInSlot = slot.getStack(); + stack = stackInSlot.copy(); + + + //If your inventory only stores certain instances of Items, + //you can implement shift-clicking to your inventory like this: + // Check that the item is the right type + if (!(stack.getItem() instanceof IHiveFrame)){ + return null; + } + + if (slotRaw < 1) + { + if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) + { + return null; + } + } + else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) + { + return null; + } + + if (stackInSlot.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + } + return stack; + } + + @Override + public boolean canInteractWith(EntityPlayer player) + { + return te.isUseableByPlayer(player); + } +}
\ No newline at end of file diff --git a/src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui/GUI_RadioThermalGenerator.java b/src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui/GUI_RadioThermalGenerator.java new file mode 100644 index 0000000000..4c9442d56d --- /dev/null +++ b/src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui/GUI_RadioThermalGenerator.java @@ -0,0 +1,49 @@ +package miscutil.xmod.ic2.block.RTGGenerator.gui; + +import miscutil.core.lib.CORE; +import miscutil.xmod.ic2.block.RTGGenerator.TileEntityRTG; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +public class GUI_RadioThermalGenerator extends GuiContainer +{ + private ResourceLocation texture = new ResourceLocation(CORE.MODID, "textures/gui/machine_Charger.png"); + + private InventoryPlayer inventory; + private TileEntityRTG te; + + public GUI_RadioThermalGenerator(TileEntityRTG te, EntityPlayer player) + { + super(new CONTAINER_RadioThermalGenerator(te, player)); + inventory = player.inventory; + this.te = te; + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + Minecraft.getMinecraft().renderEngine.bindTexture(texture); + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + fontRendererObj.drawString(I18n.format("Alveary Frame Housing"), (xSize / 2) - (fontRendererObj.getStringWidth(I18n.format("Alveary Frame Housing")) / 2), 6, 4210752, false); + fontRendererObj.drawString(I18n.format(inventory.getInventoryName()), 8, ySize - 96 + 2, 4210752); + //fontRendererObj.drawString(I18n.format("Charge:"+te.getCharge()+"~"), 8, ySize - 96 + 2, 4210752); + //fontRendererObj.drawString(I18n.format("Progress:"+te.getProgress()+"ticks"), 80, ySize - 96 + 2, 4210752); + } +}
\ No newline at end of file |
