Halfway added portable crafting table module.
This commit is contained in:
parent
bc79314bd1
commit
390e62397d
6 changed files with 110 additions and 3 deletions
|
@ -100,6 +100,7 @@ public abstract class ModularCommon {
|
|||
public static final String MODULE_AUTO_FEEDER = "Auto-Feeder";
|
||||
public static final String MODULE_SOLAR_GENERATOR = "Solar Generator";
|
||||
public static final String MODULE_STATIC_GENERATOR = "Static Generator";
|
||||
public static final String MODULE_PORTABLE_CRAFTING = "Portable Crafting Table";
|
||||
public static final String CITIZEN_JOE_STYLE = "Citizen Joe Style";
|
||||
/**
|
||||
* Categories for modules
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package net.machinemuse.general.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.machinemuse.powersuits.container.PortableCraftingContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PortableCraftingGui extends GuiContainer {
|
||||
public PortableCraftingGui(EntityPlayer player, World world, int x, int y, int z) {
|
||||
super(new PortableCraftingContainer(player.inventory, world, x, y, z));
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of
|
||||
* the items)
|
||||
*/
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
this.fontRenderer.drawString(StatCollector.translateToLocal("container.crafting"), 28, 6, 4210752);
|
||||
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the background layer for the GuiContainer (everything behind the
|
||||
* items)
|
||||
*/
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
|
||||
// TODO Variable-ize this
|
||||
int var4 = this.mc.renderEngine.getTexture("/gui/crafting.png");
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(var4);
|
||||
int var5 = (this.width - this.xSize) / 2;
|
||||
int var6 = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
public void onGuiClosed() {
|
||||
|
||||
super.onGuiClosed();
|
||||
|
||||
/*if (this.mc.thePlayer != null) {
|
||||
for (ItemStack itemStack : this.mc.thePlayer.inventory.mainInventory) {
|
||||
if (itemStack != null) {
|
||||
if (NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN)) {
|
||||
NBTHelper.removeTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
|
@ -18,9 +18,10 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class KeybindKeyHandler extends KeyHandler {
|
||||
public static KeyBinding openKeybindGUI = new KeyBinding("Open Muse Keybind GUI", Keyboard.KEY_K);
|
||||
public static KeyBinding openPortableCraftingGUI = new KeyBinding("Open Portable Crafting GUI", Keyboard.KEY_U);
|
||||
|
||||
public KeybindKeyHandler() {
|
||||
super(new KeyBinding[] { openKeybindGUI }, new boolean[] { false });
|
||||
super(new KeyBinding[] { openKeybindGUI, openPortableCraftingGUI }, new boolean[] { false, false });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -37,6 +38,13 @@ public class KeybindKeyHandler extends KeyHandler {
|
|||
player.openGui(ModularPowersuits.instance, 1, world, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
if (kb.equals(openPortableCraftingGUI)) {
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
if (Minecraft.getMinecraft().inGameHasFocus) {
|
||||
player.openGui(ModularPowersuits.instance, 2, world, (int)player.posX, (int)player.posY, (int)player.posZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -558,7 +558,8 @@ public class Config {
|
|||
*/
|
||||
public static enum Guis {
|
||||
GuiTinkerTable,
|
||||
GuiSuitManager;
|
||||
GuiSuitManager,
|
||||
GuiPortableCrafting;
|
||||
}
|
||||
|
||||
public static Configuration getConfig() {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package net.machinemuse.powersuits.common;
|
||||
|
||||
import net.machinemuse.general.gui.KeyConfigGui;
|
||||
import net.machinemuse.general.gui.PortableCraftingGui;
|
||||
import net.machinemuse.powersuits.block.GuiTinkerTable;
|
||||
import net.machinemuse.powersuits.container.PortableCraftingContainer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -21,7 +23,12 @@ public class GuiHandler implements IGuiHandler {
|
|||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
|
||||
int x, int y, int z) {
|
||||
return null;
|
||||
switch (ID) {
|
||||
case 2:
|
||||
return new PortableCraftingContainer(player.inventory, player.worldObj, (int)player.posX, (int)player.posY, (int)player.posZ);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,6 +41,8 @@ public class GuiHandler implements IGuiHandler {
|
|||
return new GuiTinkerTable((EntityClientPlayerMP) player);
|
||||
case 1:
|
||||
return new KeyConfigGui(player);
|
||||
case 2:
|
||||
return new PortableCraftingGui(player, player.worldObj, (int)player.posX, (int)player.posY, (int)player.posZ);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package net.machinemuse.powersuits.container;
|
||||
|
||||
import net.machinemuse.api.MuseItemUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ContainerWorkbench;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PortableCraftingContainer extends ContainerWorkbench {
|
||||
public PortableCraftingContainer(InventoryPlayer inventoryPlayer, World world, int x, int y, int z) {
|
||||
super(inventoryPlayer, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftGuiClosed(EntityPlayer player) {
|
||||
super.onCraftGuiClosed(player);
|
||||
/*if (!player.worldObj.isRemote) {
|
||||
InventoryPlayer inv = player.inventory;
|
||||
for (ItemStack itemStack : inv.mainInventory) {
|
||||
if (itemStack != null) {
|
||||
if (MuseItemUtils.hasTag(itemStack, "derp")) {
|
||||
MuseItemUtils.removeTag(itemStack, "derp");
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue