Jump to content

Ezio214

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by Ezio214

  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.
  16. Ok Thank you I will have a look into that. There is only one last question I need answered. What is the last paramter for in the method drawCenteredString() (I looked at minecraft code and they set it either to -1 or 16777215) and is there a way I can make only ONE Component.translatable() with text that goes multiple lines, because sadly it doesn't work with \n For example: "This is the first line.\nThis is the second line" Output: This is the first line. This is the second line
  17. I'm trying to create a custom screen for the first time and I came across two problems. How can I add a picture in the center? ( I want to have like 3 layers: black background (this.renderBackground(PoseStack)) ---> texture.png on top of black background ---> Text/Buttons on top of everything [ if this isn't posible with Screen, tell me with what I can realise that pls ]) How can I fix my Button problem? Code: public class QuestScreen extends Screen { private final ResourceLocation backgroundTexture = new ResourceLocation(Tutorialmod.MODID, "textures/screens/quest_background.png"); public QuestScreen(String title) { super(Component.literal(title).withStyle(ChatFormatting.GOLD)); } @Override protected void init() { addRenderableWidget(new Button(this.width/2 - 100, this.height/2 + 50, 100, 50, Component.literal("Accept"), QuestScreen::onAccept)); } public void render(PoseStack p_96692_, int p_96693_, int p_96694_, float p_96695_) { this.renderBackground(p_96692_); drawCenteredString(p_96692_, this.font, this.title, this.width / 2, 20, 16777215); super.render(p_96692_, p_96693_, p_96694_, p_96695_); } private static void onAccept(Button button) { } @Override public boolean isPauseScreen() { return false; } }
  18. Thank you very much. Overriding getDimensions(Pose) and returning new dimensions I calculate did it for me.
  19. I'm trying to understand hitboxes in minecraft and found out about EntityEvent.Size. But where do I use that? In the render of my custom entity? Also is this on "common" side or "client" ?
  20. Nevermind got it. I had to change this line return new ResourceLocation(Reference.modid, "textures/entity/Monster1.png"); into this: return new ResourceLocation(Reference.modid, "textures/entity/monster1.png"); I didn't knew it had to be all in lower case. Would be nice if someone could explain why.
  21. Yes I forgot. Thank you. I registered them at the FMLClientSetupEvent as you can see here: private void clientRegisteries(final FMLClientSetupEvent event) { logger.info("ClientRegistries works!"); MorecraftRenderRegistry.registryEntityRenders(); } And here is the class for the RenderingRegistry: But now I got a diffrent problem. On the Logs it says: [29Feb2020 11:48:04.760] [Client thread/ERROR] [net.minecraft.client.renderer.entity.LivingRenderer/]: Couldn't render entity net.minecraft.util.ResourceLocationException: Non [a-z0-9/._-] character in path of location: morecraft:textures/entity/Monster1.png at net.minecraft.util.ResourceLocation.<init>(SourceFile:38) ~[forge-1.14.4-28.2.1_mapped_snapshot_20200119-1.14.4.jar:?] at net.minecraft.util.ResourceLocation.<init>(SourceFile:47) ~[forge-1.14.4-28.2.1_mapped_snapshot_20200119-1.14.4.jar:?] at morecraft.entity.renders.Monster1Render.getEntityTexture(Monster1Render.java:22) ~[main/:?] at morecraft.entity.renders.Monster1Render.getEntityTexture(Monster1Render.java:12) ~[main/:?] Here is the Monster1Render class:
  22. Hello There! So I'm new to this so please don't flame me. I want to create a custom Entity. I done the modeling with tabula and exported it as a java file. As you can see here: I also made a renderer for it. Renderer class: And I made a class where I create it: Here I create the Entities: And on my main class I added this: Still when I spawn the Entity it looks like this (which is not the model I did): I hope someone can help me with this, because I'm unable to find the mistake myself.
  23. Ähm.... ups I forgot I assume. Can't belive I did such a idiot mistake ?. Thanks btw. Fixed my Issue
  24. I recommend you to watch a modding tutorial to learn the basics. With that I also started and created some own items & blocks. Just go trough all the steps.
  25. Hello, I have the problem that when I harvest a iron, gold, diamond or redstone block with my custom pickaxe it doesn't drop the item. Instead the block just gets destroyed. Only the coal block gives me coal. My ToolMaterial Class: (Harvestlevel is set to 3) My Custom Pickaxe Class:
×
×
  • Create New...

Important Information

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