Jump to content

OnlyMobster

Members
  • Posts

    14
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

OnlyMobster's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Thanks for all the help you guys. Seems like I got it to work now The book appears among other chests. Now I just have to narrow it down to certain chests when I feel like doing that.
  2. I think I found the source of the error, since it came back again. In my previous message, I mentioned the directory change. Interestingly, later when I try to check for the entity being a Lockable entity, i'm assuming the if statement never ended up being true and so generatedLoot.add() never ran. However, when I run it by default, without an if statement, the same "Could not parse loot modifier bden:locked_tomes" is thrown.
  3. I think I figured out why the error was throwing The locked_tomes.json was in the wrong directory, it was in loot_tables, not loot_modifiers I still don't know if my serialized json is correct though
  4. The lootModifier can't be parsed, thats what the error is I assumed that the NullPointerException was causing this, but perhaps its actually the other way around: the parsing error is causing the NullPointerException. What do you think would cause "Could not parse loot modifier bden:locked_tomes"? Its Forge that is running this, its just where it sent me for the location of the NullPointerException.
  5. That makes a lot of sense, but for some reason my code keeps throwing NullPointerExceptions. This is my locked_tomes.json, which is referenced in my global_loot_modifiers.json. { "type": "bden:locked_tomes", "bookItem": "bden:locked_tome", "numBooks": 1, "pools": [ { "conditions": [ { "condition": "random_chance", "chance": 1 } ], "rolls": 1, "entries": [ { "type": "item", "name": "bden:locked_tome", "weight": 100 } ] } ] } Im assuming the conditions here aren't enough? Do you know why it would be throwing a NullPointerException at this lootModifiers line? ILootCondition[] lootConditions = GSON_INSTANCE.fromJson(object.get("conditions"), ILootCondition[].class);
  6. Ok, awesome. In regards to the serialized JSON, I actually had a question about formatting. A lot of examples don't include a POOL, so I'm assuming it works a little differently. I get how values are accessed and represented, but in regards to my mod and wanting to place something in a chest loot table, are conditions even something to care about/include in my JSON? The thing is, I removed the "conditions" section and my code throws a NullPointerException because Conditions is null. Why would conditions matter for this? I guess perhaps there's a chest condition? If so, what is it? Thanks for all the help
  7. Oh, thank you. Would i just put LootParameters.POSITION where lootparam is?
  8. What do you mean by this? Is this supposed to access the lootTable?
  9. I'm starting to figure things out But, i was wondering. When I do context.getWorld().getTitleEntity(), getTitleEntity takes a BlockPos. Is there a way to convert LootParameters.POSITION to a BlocksPos object? Or perhaps should I just use context.getLootTable(LootParameters.POSITION.getId()); Or am I doing this all wrong haha Of course, if I just did getLootTable() I wouldnt be able to filter through certain lootTable types, unless maybe I used getClass()?
  10. For some reason, answer posted twice, so this is a filler reply
  11. So Ive been digging around with LootParameter, and I still have some more questions So, my code recognizes LootParamter.POSITION, but what does that represent? The documentation doesnt really exist for it: does it represent the position of the generated loot? If so, which loot? How would I get the LootParamter.POSITION of a jungle temple chest let's say? Also, I had a question about the doApply() method. What is the generatedLoot parameter? Is it all the Items from a certain loot_table? If so, which one? Anyways, thanks for all the help
  12. Thanks so much! Ok, do I still use the same Registry classes and functions as per https://mcforge.readthedocs.io/en/latest/items/globallootmodifiers/? Also, when you say "certain chests", could I detect every dungeon chest in my world? Not just a few right? Lastly, once I've checked the lootTable, how do I add to it?
  13. So If i'm trying to change desert_pyramid chest loot, what do I call my loot table json? Would it be desert_pyramid_chest.json? Also, what would i put in "the block to modify" and "filename" above?
  14. Hey everyone, so I'm currently working a new mod that adds custom enchantments and enchanting tables to the game. I have this item called a "locked_tome" which I want to spawn naturally in vanilla chests. For example, when a player opens a desert pyramid or dungeon chests, they might find that item there. I have been researching and trying things for days now, but there seems to be lots of options and some of them are deprecated. The one that is brought up often is the use of a Global Loot Modifier. However, because all the documentation and examples are for mob loot with a certain type of tool, instead of chest loot generation, its hard to understand how I would construct my own classes for that situation. Does anyone know how I would edit the dungeon/pyramid chests to include locked_tomes into the mix? Can you use simple loot_table jsons? Would I use CraftTweaker/LootTweaker? Would I use LootTableOnLoad? Or should I use Global Loot Modifiers? If any of these, how? Version I'm using is 1.15.2 Forge and using IntelliJ
×
×
  • Create New...

Important Information

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