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.

Zipree

Members
  • Joined

  • Last visited

Everything posted by Zipree

  1. On server side, how to reduce players item from inventory? I used below codes. It doesn't work. Nothing changed. @Override public IMessage onMessage(CostMessage message, MessageContext ctx) { EntityPlayerMP player = ctx.getServerHandler().player; if (message != null) { ItemStack stack = message.getItemStack(); if (stack == null) return null; InventoryPlayer inv = player.inventory; inv.deleteStack(stack); } return null; } It caused NoSuchMethodException with func_184429_b @Override public IMessage onMessage(CostMessage message, MessageContext ctx) { EntityPlayerMP player = ctx.getServerHandler().player; if (message != null) { ItemStack stack = message.getItemStack(); if (stack == null) return null; InventoryPlayer inv = player.inventory; int amount = stack.getCount(); int p = 0, cnt = stack.getCount(); while (cnt > 0) { int slot = inv.getSlotFor(stack); int cntFrom = inv.getStackInSlot(slot).getCount(); cnt -= cntFrom; if (cnt > 0) { inv.setInventorySlotContents(slot, null); } else if (cnt != 0) { stack.setCount(-cnt); inv.setInventorySlotContents(slot, stack); } } } return null; } Is there any method or way to reduce items from player's inventory by item name & count?
  2. then, how to send a packet to server from guiscreen? is there any network object for guiscreen or from forge? or should i make custom network IO connection?
  3. I have a class which extends GuiScreen I want to change player's inventory in it and sync with server I used below code if(ItemStack.areItemsEqual(iStack, new ItemStack(ModItems.whiteCoin))){ player.inventory.mainInventory.set(slotNum, new ItemStack(ModItems.whiteCoin, itemAmount)); } but it doesn't sync with client and server both. How can i change EntityPlayerSP's inventory and sync data with server?

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.