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.

AMRAAM

Members
  • Joined

  • Last visited

  1. Hello! I have been working on a server only mod for the past while but now with the team who is working on the server we are shifting into a mod that also has a client side. But I havent used client side things before, and the small description on the docs outlines the things pretty well but I have a few questions. If I have a custom GUI for example do I need to look into packets to sync things up? I want to replace the normal inventory with an inventory that doesnt have the armor and crafting slots, but has different slots instead for example, or furnace like things where you put in some items and a progress bar moves and something happens, but I want it to be instanced by player (so that other players cant interact with your thing). Or if there is custom information about the player and I want to display it client side in a menu. Like the cold resistance of the player (custom combat/rpg system is mostly in place on the server), do I need a custom packet handler for this, or is there some built in mechanism to facilitate syncing values? Also, very curious about anti cheat methods, how can I ensure that all items remain un-changed and only come from my item factory, and the client has no way of changing them? I already serialize the items with a UUID and store their state on the server, but that uuid is stored in item NBT not sure how safe is that, but also any other anti cheat catches I should be aware of? Thank you!
  2. Is it possible that it is a bug that it isnt being set correctly on the server ?
  3. On the server it always appears to be Minecraft.Air
  4. Continuing this topic I still want to prevent a lot of inventory interaction, is it possible to mess with the itemstack held by the cursor from the server? Only the client appears to know about that, how is that possible, the inventory actually changes when the client picks up an item from their inventory, the server has to know about the new empty slot, or is that it, just a new empty slot that appears? As far as the server is concerned, where is the itemstack that is being held?
  5. Damn, that is slightly problematic for my case. Oh, well I will find a workaround then, thank you
  6. Hello! Is there a good way to detect if a player is trying to open their inventory? I want to open some other container is some cases when they do that. This is only server side. I also want to make sure that in the case where I want to open a different container instead they are 100% unable to take their armor off. I think that may not be possible tho, because it might just be up to the client to modify its inventory and send the changes to the server (like it can say "hey I moved my helmet to slot 35, cool?") But not sure on that, if this is not possible it's not that big of deal, but I will need another solution to make sure they can't move their armor into their inventory (thinking of tagging their armor with something like "disallowed" and then periodically checking if they somehow managed to get a disallowed item). Thanks
  7. Is that so, maybe there is something else I did wrong let me see
  8. Hello! I want to be able to close the player's opened container (like they hit escape) from the server. So send a packet or invoke some function that would close the container without the need for writing client code. I tried PlayerEntity#closeContainer(); But this just introduced desync with the client, but it actually seemed to close the container as far the server was concerned. Thanks
  9. Yeah well I see, as for using the lore tag... How do I produce this structure in the NBT? {display:{Lore:['{"text":"foo"}','{"text":"bar"}']}} The CompoundNBT interface is quite different from json libraries I am used to, I cant figure out how can I add a json object array to lore
  10. I was hoping there was some method to catch when the client is looking for the description and instead of going through the standard way of getting it from the NBT I could supply it with different data, but then the whole NBT is passed to the client, and it decides on how to display it if I understand correctly so yeah out of luck, I will look into regenerating the item Lore some way when something changes
  11. So I am stuck with static strings, cant generate it on the fly
  12. Hello! I have been working on a custom item system where a lot of item properties exist, like vitality, dexterity and many others. This works fine by adding to the NBT of the ItemStack and I can also query the values just fine, however I have a problem displaying these to the user. My mod runs exclusively on the server side, so I can't use ItemTooltipEvent sadly, but that is exactly what I would have needed. I assume I could change the lore and do tricks with that to have it show, but I couldn't get the lore to show properly, I was trying to put my data into the NBT tag. And I also can't remove the default information thing that items display, like armors have "+x Armor" which is awful for my use case as I implement my own armor system. I also need to be able to generate these descriptions on the fly, real time, because I want to be able to change how attributes work/are displayed. So as an example if I put +1 Vitality on an item, and want to display it as "+2 To Life" not as vitality, but then I change my mind, and want to update how item information is displayed. This may sound dumb, but I want to be able to patch items and their properties and if their description is just a static string, even if I change how the underlying data works, I can't change the description. Take that example, what if I decide to change vitality to give +3 life per point not 2, I wouldn't need to change the item's data at all, just the description. I hope I was clear, I'll be around if I need to clear anything up, Thanks
  13. So essentially I create a new class, extend from Container maybe and start implementing things, and maybe go off the implementation of ChestContainer. Will this approach not break the server side only criteria? Does the client not need to know about the custom container?
  14. So, I will populate the slots of the opened "chest" with items that I dont want to be in game items, rather option in a menu, so when a player tries to take one of them I can run some logic because they clicked an "option", instead of the taking the item I want to run a function to do something. Example, the player opens a virtual chest they see their level by the size of the green wool stack, if they try to take the stack, instead of taking 13 green wool, they would get taken to another "chest" with more detailed information about their character. Or a shop interface, where them clicking an item would buy it, put it into their inventory and remove some balance from their account. So I need a mechanism to detect them trying to take an item, and to know what item it is, and one mechanism to prevent them from actually taking the item. I hope it makes sense
  15. Ah okay I got it, I missed the `id` param. It works now for the first part. And as for detecting and canceling interaction, how does one do that?

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.