Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

kaaz

Members
  • Joined

  • Last visited

  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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.