Jump to content

kaaz

Members
  • Posts

    3
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

kaaz's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Thanks I think I understand. If I wanted to add more variables to the message I can just put it below the other ByteBufUtils.write.. and I just need to make sure I read it in the same sequence? But how do I go from there to the players equiped item, can I just use the MessageContext.playerEntity.getCurrentEquippedItem() or is it a bad way to do it like that since the equipment slot could potentially have changed?
  2. Thats the method where I store the upgrades public void upgradeStat(ItemStack itemStack, String statName) { if (itemStack.stackTagCompound != null && Arrays.asList(stats).contains(statName)) { int points = itemStack.stackTagCompound.getInteger("points"); if (points > 0) { itemStack.stackTagCompound.setInteger("stats_" + statName, itemStack.stackTagCompound.getInteger("stats_" + statName) + 1); itemStack.stackTagCompound.setInteger("points", points - 1); System.out.println("upgraded " + statName); } } } Could I use something like http://www.minecraftforge.net/wiki/Advanced_Packet_Handling ? Or is it outdated
  3. Hello all, A few days ago I started playing around with Forge, and I'm having fun with it for the most part, but I'm stuck on getting the gui buttons to upgrade my item. What I want: Rightclick an item -> open interface -> options/buttons to upgrade item in question -> actually upgrade the item [dmg/speed/etc.] I've searched for a while and followed tutorials such as http://www.minecraftforge.net/wiki/Containers_and_GUIs I know I'm supposed to do something with a Container in order to sync the client with the server but I'm not sure how. I could really use a push in the right direction. What I'm doing currently: In my Pickaxe<Extends ItemTool>'s onItemRightClick I'm calling player.openGui() @Override public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { if (world.isRemote) {//client player.openGui(PassiveEnchanting.instance, PassiveEnchanting.GUI_ITEM_UPGRADE, world, (int) player.posX, (int) player.posY, (int) player.posZ); } return super.onItemRightClick(itemStack, world, player); } In my mod's preinit I've registered a gui handler which goes like @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiProxy()); } The guiproxy creates the gui object for the client. public class GuiProxy implements IGuiHandler { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if (ID == PassiveEnchanting.GUI_ITEM_UPGRADE) { return new ItemUpgradeGui(player); } return null; } } I think the problem lies in the ItemUpgradeGui.actionPerformed method. At the moment I'm just sending the player's equiped itemstack to the Item class. The complete project can be found at https://bitbucket.org/novaz/passive-enchants/src
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.