Jump to content

Recommended Posts

Posted

Hello,

I'm trying to do a tiny mod for my server for friends, which is based on block break event. Mod is built without any errors, and it's loaded into client, because I can see it and even check in console. No errors.

But when I interacted with block then nothing happens like I missed something or so. Listeners? EventHandlers? Something should happens but there is no reaction at all in-game and even in console logs.

How do I add event listeners? Maybe I messed up something. Here is short snippet:

public MyMod {
	GLM.register(FMLJavaModLoadingContext.get().getModEventBus());
}

private static final DeferredRegister<Codec<? extends IGlobalLootModifier>> GLM = DeferredRegister.create(ForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, MODID);

I would be glad for any advices.

Regards

Posted

Snippets are useless. Post the full code (preferably on github) so we can see everything in context.

All that code shows is you created a deferred registry. Nothing was registered to it. And nothing that would use any modifier registered to it.

 

Here's an example where I was learning the 1.19 GLMs.

It makes breaking a block in the minecraft:leaves block tag drop a diamond.

https://forums.minecraftforge.net/topic/113816-1182-method-for-iterating-over-blocks-belonging-to-a-tag/?do=findComment&comment=505993

 

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted
  On 11/16/2022 at 10:04 AM, warjort said:

Snippets are useless. Post the full code (preferably on github) so we can see everything in context.

All that code shows is you created a deferred registry. Nothing was registered to it. And nothing that would use any modifier registered to it.

 

Here's an example where I was learning the 1.19 GLMs.

It makes breaking a block in the minecraft:leaves block tag drop a diamond.

https://forums.minecraftforge.net/topic/113816-1182-method-for-iterating-over-blocks-belonging-to-a-tag/?do=findComment&comment=505993

 

Expand  

Hi, thanks for reply. I read whole topic that you sent, but I worries that doesn’t work on 1.19.2 but idea and code are similar. Even I did some changes and add more registers, this still didn’t help. My mod did those register events but nothing more. I think I still missing an event listener and I’m reading more about @EventSubscriber, maybe that’s a key. I will send more code if needed.

Posted

Here is a link with code, its kinda messed up because I'm trying a lot of methods to make it works past few days and exhausted to make it clean already.

Code below is based on few examples, and lastest javadoc from forge, however it doesn't work. You can see in console few lines of logs, but the important functions doesn't work. 

https://pastebin.com/PhGySG5P

Posted

Initially you showed the deferred register and nothing else.

Now you show the GLM but not how it is registered?

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted
  On 11/16/2022 at 10:04 AM, warjort said:

Snippets are useless. Post the full code (preferably on github) so we can see everything in context.

All that code shows is you created a deferred registry. Nothing was registered to it. And nothing that would use any modifier registered to it.

Expand  

You still haven't done this. See the underline part.

These are the json files in the data folder.

And we will need to see where those are located so we can confirm you have them in the correct place.

 

I shouldn't have to keep asking for this stuff while you drip feed information. You are just wasting people's time.

Either post all the information (as I said on github is the best) or I am just going to ignore this thread until you do.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted
  On 11/17/2022 at 12:29 PM, warjort said:

You still haven't done this. See the underline part.

These are the json files in the data folder.

And we will need to see where those are located so we can confirm you have them in the correct place.

 

I shouldn't have to keep asking for this stuff while you drip feed information. You are just wasting people's time.

Either post all the information (as I said on github is the best) or I am just going to ignore this thread until you do.

Expand  

Here is whole code with json files: https://github.com/TagonZ/MC/tree/main/src/main

I don't know which part of code I'm missing or have wrong to make it work.

 

Posted

All your files are in the wrong place. They should be src/main/resource/data/<namespace> you are missing the data folder in the path

https://github.com/TagonZ/MC/tree/main/src/main/resources/forge

 

Even then, this file would be in the wrong place:

https://github.com/TagonZ/MC/blob/main/src/main/resources/forge/loot_modifiers/cobblestone.json

You reference it here as cobblestonedrops:cobblestone

https://github.com/TagonZ/MC/blob/main/src/main/resources/forge/loot_modifiers/global_loot_modifiers.json

which means it should be in

src/main/resources/data/cobblestonedrops/loot_modifiers/cobblestone.json

see step (2) in the link I posted above.

  Quote

A serialized json representing your modifier at /data/<modID>/loot_modifiers/

Expand  

 

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted (edited)
  On 11/18/2022 at 12:12 PM, warjort said:

All your files are in the wrong place. They should be src/main/resource/data/<namespace> you are missing the data folder in the path

https://github.com/TagonZ/MC/tree/main/src/main/resources/forge

 

Even then, this file would be in the wrong place:

https://github.com/TagonZ/MC/blob/main/src/main/resources/forge/loot_modifiers/cobblestone.json

You reference it here as cobblestonedrops:cobblestone

https://github.com/TagonZ/MC/blob/main/src/main/resources/forge/loot_modifiers/global_loot_modifiers.json

which means it should be in

src/main/resources/data/cobblestonedrops/loot_modifiers/cobblestone.json

see step (2) in the link I posted above.

 

Expand  

I did those fixes, it works better but still didnt add additional item when mining cobblestone. I pushed on github those fixes. Method doApply isn't used.

https://github.com/TagonZ/MC/tree/main/src/main

Edited by Faxu_
Posted (edited)

There's no such block tag as minecraft:cobblestone

https://github.com/misode/mcmeta/tree/data/data/minecraft/tags/blocks

There is a forge:cobblestone/normal

https://github.com/MinecraftForge/MinecraftForge/blob/1.19.x/src/generated/resources/data/forge/tags/blocks/cobblestone/normal.json

 

Or you can change your GLM to use a LootItemCondition that matches a specific block instead of a block tag.

Edited by warjort
  • Like 1

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted (edited)
  On 11/18/2022 at 2:47 PM, warjort said:

There's no such block tag as minecraft:cobblestone

https://github.com/misode/mcmeta/tree/data/data/minecraft/tags/blocks

There is a forge:cobblestone/normal

https://github.com/MinecraftForge/MinecraftForge/blob/1.19.x/src/generated/resources/data/forge/tags/blocks/cobblestone/normal.json

 

Or you can change your GLM to use a LootItemCondition that matches a specific block instead of a block tag.

Expand  

Thank you, it's working as intended. For the end of this topic I would ask you how can I add more possible drops from cobblestone. For now it's just a diamond and I can't see possibility to set another item to get diamond and for example coal from mining one cobblestone. Do I have to rebuild my cobblestone.json to make "item" as and array or there is another way to do it?

I know that I can hardcode more items but I dont want to do it this way.

 

Edited by Faxu_
Posted

Just change the codec to use a list of items instead of a single item.

https://forge.gemwire.uk/wiki/Codecs

It's really up to you how much and what configuration you want for your modifiers. 

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

One more question. If I would like to add to drop items from another mod. Which way should I take, what do I include to my project to get blocks and items from another mod?

Posted

https://docs.minecraftforge.net/en/latest/concepts/resources/#resourcelocation

minecraft:diamond

yourmodid:your_item

othermodid:other_item

 

You really need to read the docs/wiki instead of asking these minecraft 101 questions.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • https://mclo.gs/bjf9fqs The link is the logs from modrinth  
    • "I want to understand how complex mods with ASM transformation and coremods work, such as Xray or AntiXray. Why do they break when you simply rename packages? What features of their architecture make refactoring difficult? And what techniques are used to protect these mods? I am interested in technical aspects in order to better understand the bytecode and Forge loader system."
    • I can't figure out if you're looking for help trying to steal someone elses work, or cheat at the game....
    • Title: Why Is It So Hard to Rename and Restructure Mods Like Xray or AntiXray? 🤔 Post text: Hey everyone! I’ve been digging into Minecraft modding for a while and have one big question that I can’t figure out on my own. Maybe someone with more experience could help or give me some advice. Here’s the issue: When I take a “normal” Minecraft mod — for example, one that just adds some blocks or new items — I can easily change its structure, package names, or even rebrand it entirely. It’s straightforward. But as soon as I try this with cheat-type mods like XrayMod or AntiXray, everything falls apart. Even if I just rename the classes, refactor the packages, or hide its identity somehow, the mod either breaks or stops working properly. XrayMod in particular is proving to be a nightmare to modify without losing its core function. So my question is — why is this so much harder with cheat mods like Xray? Is there something fundamentally different about how they’re coded, loaded, or protected that prevents simple renaming or restructuring? And if so, how can I actually learn to understand someone else’s cheat mod enough to safely refactor it without breaking the core features? I’ve already been spending over two months trying to figure this out and haven’t gotten anywhere. It feels like there must be some trick or knowledge I’m missing. Would really appreciate any thoughts, tips, or references — maybe there are guides or techniques for understanding cheat-mod internals? Or if you’ve successfully “disguised” a cheat mod like Xray before, I’d love to hear how you did it. Thanks in advance for any help or discussion. ✌️
    • just started making cinamatic contect check it out on my channel or check out my facebook page    Humbug City Minecraft Youtube https://www.youtube.com/watch?v=v2N6OveKwno https://www.facebook.com/profile.php?id=61575866982337  
  • Topics

×
×
  • Create New...

Important Information

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