Jump to content

Recommended Posts

Posted

Hey!

 

I can't believe I've been making mods for four years and have never posted here before... 

 

Anyway, I need some advice about a mod I'm working on. One of the goals of the mod is to be able to change loot based on things like biome, dimension, etc. which means the loot context needs to record the position where the loot is generated (so then it can be looked at in the loot conditions and functions). Now unfortunately, the vanilla loot system doesn't do this. I've gotten it to work using ASM (by passing my own 'extended' loot context with position info in the different places in the code where loot is generated), but would rather avoid ASM if I can. Would it be worth it to create a pull request in forge adding that to the vanilla loot context, and use that instead?

 

Also, anther goal of the mod is to be able to load loot tables, recipes, advancements, functions, and structures from a file outside of the world files. Basically I want these as a 'middle' source, with files in the world save taking precedence, then these, then built in files. Now fortunately I got loot tables to work nicely with the loot table load event, and discovered recipes are a pain to work with (I can add the recipes just fine in the mod's init, which is what I'm doing now, but if I try overriding the vanilla recipes, it seems to work until I open the vanilla crafting book in the game, which crashes), but the only way I could find to add/override the advancements, functions, and structures was ASM. Would it be a good idea to add a few events in forge much like the loot table load event for when the advancements, functions, and structures load?

 

I appreciate the advice. =)

 

Tmtravlr

Posted

1) Don't color your text is looks horrid on the dark theam

2) You don't need ASM for any of this and you will get no help writing coremods here.

3) You crash because you're screwing with things incorrectly. We have explicit Register events for a reason use them -.-

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted (edited)

Hi,

 

1. What do you mean? I never colored the text in the post.

 

2. I don't want help writing coremods. In fact, I don't want a coremod at all. That's the whole reason for this post. I want to find a way to do these things without a coremod. If I'm going to take the time to do this, I'd rather do it right.

 

3. I assume you mean the crafting book crash? I'm registering the recipes by creating the JsonContext, then calling

recipe = CraftingHelper.getRecipe(json, ctx);

where json is the JsonObject and ctx is the JsonContext, And then registering them using

ForgeRegistries.RECIPES.register(recipe.setRegistryName(recipeId));

where recipeId is a ResourceLocation with the id I want to replace (or a new id). Is there a better way to read them in and register them?

 

Edit: Maybe my title for the thread is misleading... I'll change it.

Wait... can I not change it?

Edited by Tmtravlr
Posted

Hey Leviathan,

 

Yeah, that does help with my problem. I'm glad to see someone else cares about this. =)

 

Adding the looted entity would work great for most cases, since you can get the position from it (I even see you added a biome condition check in your test =D ). There's just the case of someone looting a chest (or other tile entity container) without actually opening it, like if they break it. I'm rather surprised vanilla doesn't add the block position itself to the loot context. Seems like something that should be there.

 

I'm also using loot tables in my mod for block drops, which wouldn't have entities involved if not broken by a player... but I think I can find a way around that.

 

The PR looks good to me, though if there were a way to get the position from chests without the player, that would be even more awesome!

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



×
×
  • Create New...

Important Information

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