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.

Ezio214

Members
  • Joined

  • Last visited

  1. I have a custom 3d model which works perfectly. BUT I want it to be held diffrently on the players hand when the item is being used. My JSON file under assets/examplemod/items looks like this: { "model": { "type": "minecraft:condition", "on_false": { "type": "minecraft:model", "model": "examplemod:item/example_item" }, "on_true": { "type": "minecraft:model", "model": "examplemod:item/example_item_using" }, "property": "minecraft:using_item" } } This works fine until the item is used. The correct model will be displayed but with a full black texture instead of the actuall texture. Any idea why? (I want to use the exact same texture for both items, because their model is the same just diffrent displays on firstperson_righthand and firstperson_lefthand). The models JSON's are fully blockbench files inlcuding the elements, display, textures with texture_size. Also is this the correct way to do it? Because it feels so dumb to change the exact same model just for a diffrent right- and lefthand view. (fyi: ItemUseAnimation is BLOCK for this item)
  2. I haven't tested it but under https://minecraft.wiki/w/Items_model_definition it says now: So I guess the resource location must have changed with 1.24.4, which means you need to move your models/item/ to the new source. But as I said I haven't tested this so it also may be that this wont work. Nevertheless give it a try EDIT (important) So now I tested it and found out how it works Let the model files (e.g. the .json from blockbench) within "assets/<your_mod_id>/models/item" In addition to that do the following: Every model you added will need a new file under "assets/<your_mod_id>/items" That file is also a JSON and looks like this: { "model": { "type": "minecraft:model", "model": "your_mod_id:item/custom_item" } } - "type" can be minecraft:model, minecraft:composite, minecraft:condition, minecraft:select, minecraft:range_dispatch, minecraft:empty, minecraft:bundle/selected_item or minecraft:special. (In most cases you would need minecraft:model) - "model" is the path to your actual model for this item. For example the value above would point to "assets/your_mod_id/models/item/custom_item"
  3. Titles says it all. I found a way to spawn entities all around biomes (Biome modifiers) but what about if I just want an entity to spawn at every village once. Is that possible? What I got but doesn't work: { "type": "forge:add_spawns", "biomes": "#minecraft:village", //if I change this to "minecraft:plains" for example it works "spawners": { "type": "tutorialmod:quest_giver_villager", "weight": 100, "minCount": 1, "maxCount": 1 } }
  4. If you gave me that example in the first place, everything would have been faster and clearer. Sry that I ask so much questions around Capabilites... That system isn't that easy to understand and btw a "Modder Support" forum for me is like a place where I can definitely ask these things if I dont understand them.
  5. So I need a buf.write or buf.read method, ok. But how do I read a String. I found readCharSequence method but that wont work for me, because you need to tell him the length of the string. this.test = buf.readMap(READSTRING, buf.readInt()); So would be nice instead of giving me links to wikis which only help me 60% to actually give me that 1 line of code, if you know. writeMap I dont understand at all. First parameter is the map itself and then two writers. One for the keys and the other one for the entries. buf.writeMap(this.test, KEYWRITER, ENTRYWRITER); I have no clue what to write there, since for example buf.writeInt() (entry) needs the int it writes. Looking at the writeMap code there is forEach-loop which writes all the keys and entries. So I dont need to implement a loop only a one time method call. SO all I'm asking is somebody to tell me, if you know, what I have to write at READSTRING, KEYWRITER and ENTRYWRITER.
  6. I have a custom packet (Server to Client) with following snippet: public CustomS2CPacket(FriendlyByteBuf buf) { this.test = (HashMap) buf.readMap(null, null); // why does this want two FriendlyByteBuf.Reader and how to implement them? } public void toBytes(FriendlyByteBuf buf) { buf.writeMap(this.test, null, null); // why does this want two FriendlyByteBuf.Writer and how to implement them? } comments and title says it all.
  7. Found out that capabilities are saved automatically, I just didn't see that because my client and my server don't seem to synchronize. [12:44:08] [Server thread/INFO] [co.tu.MODID/]: [MODID_DEBUG] :: questStatus quest_0 from player is 1 [12:44:08] [Render thread/INFO] [co.tu.MODID/]: [MODID_DEBUG] :: questStatus quest_0 from player is 0 The Logger gives me this info when I right click my villager to open a Screen only if questStatus equals 0. As soon as I press a button on that Screen both, client and server, are set to 1 -> that works. But it seems like the nbt-data gets only loaded server-side. How can I load the same values for client-side?
  8. After a very long (around 4 hours) brainstorm and trying out code without really understanding it, I found the answer. To anyone courios about how to modify NBT-data or even read it: // somewhere in your code where you need to read/modify the capability // for class structure see here: https://gist.github.com/TheCurle/6db954d680f6f067dcdc791355c32c89 player.getCapability(CustomCapabilityProvider.INSTANCE).ifPresent(capability -> { // change or read your capability here }; Still I dont know how to save the NBT-data when the player leaves his world/server. As soon as I know I'll let you all know.
  9. So after looking again at the post and at the code example I got to something. I just didn't use the attach-method they have. Instead I used the following SubscribeEvent: which works. Thank you for that What I dont understand is how I can save the NBT-data and how I can modify it.
  10. I don't get it. So I have my own capability interface and that needs to have the @AutoRegisterCapability annotation so the capability gets registered. My "Handler" class is the Implementation class of my own capability interface. Do I need now a Capability Provider (Persistent Provider) to access the values I stored or how do I do that?
  11. I'm trying to understand capabilities but since the "system" got recently renewed I can't find any tutorial about it and the forge documentation doesn't give me the info I need. As I understood there is an interface for the capability and a "handler" class which implements the interface. I got the following: interface: handler: Now, first I wanna know how to load the NBT data when a Player connects and second, how to save the NBT data when a Player disconnects. Also I only need to change a value saved in the HashMap questStatus then, which is from player to player different right? If so is there any specific way I have to use or can I somehow access it from the player?
  12. Yep you are right. There is no synch between server <-> client with my variable isTalking, which indeed was for my intention, that only one player can talk to the villager at a time. I removed it completly since I already had in mind to change it because it doesn't make any sense for my mod. With that said, thank you again !
  13. But why dont I get the exception when it opens the first time? Why is it only when it shows the second time? Also I wouldn't like to rewrite it to a new container menu, because I don't need the players inventory. I just want to show some text and give the player to press the accept or decline. Since any vanilla code does not send a network packet to the client I think I shouldn't either. Isn't there any other way I can show a screen to the player when he interacts with an entity?
  14. So do I have to rewrite/modify my QuestScreen to a MenuProvider/SimpleMenuProvider subclass or how can I show my Screen without getting the "Rendersystem called from wrong thread" exception?
  15. I can't figure out why I get the exception "java.lang.IllegalStateException: Rendersystem called from wrong thread" Exception: Custom Screen: Custom Entity When I show the Custom Screen (QuestScreen) for the first time it's all perfect without any exception or error. Just when I close it by clicking a button or pressing ESC and then right click my QuestGiverVillager again the problem occours.

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.