Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.14.4] Adding Items to Vanilla Generated Chests


Ommina
 Share

Recommended Posts

I expected this to take... a few minutes.  At most.  Yet here I am.

 

Let's say I want to add moditem to the optional bonus chest created at world spawn.  I expected to add a spawn_bonus_chest.json to loot_tables, get it merged into the vanilla version, then be on my way with a nice plate of crackers.

 

Except it is aggressively ignored.  It does seem to be loaded, or at least parsed, insofar as if I put weird values in the json, I will get notes in the console.  But the chest remains bereft of moditem.

 

If I move spawn_bonus_chest.json to the minecraft namespace, it works, but it replaces the vanilla table, instead of adding to it.

 

I note there is a LootTableLoadEvent, but adding the entries via code strikes me as so far from the current data-driven style of controlling loot that I have trouble believing it is the correct way of doing this.  Is there some way of merging my loot_table json with vanilla's?

Link to comment
Share on other sites

Having the same issues when it comes to adding custom loot to dungeons, the docs aren't any help either I've noticed.
It seems the way it was done in 1.13 isn't working for 1.14 anymore since part of the code is now private.
Any help on that end would also be appreciated.

Link to comment
Share on other sites

1 hour ago, Ommina said:

I note there is a LootTableLoadEvent, but adding the entries via code strikes me as so far from the current data-driven style of controlling loot that I have trouble believing it is the correct way of doing this.  Is there some way of merging my loot_table json with vanilla's?

I believe this is the best way to do it at the moment, and yes it does stay away from the data driven system, but currently no way around that. Because datapacks as they are override the whole loot table. Which is a little counter productive when you just want to add to it or remove something from it.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

23 hours ago, Animefan8888 said:

I believe this is the best way to do it at the moment, and yes it does stay away from the data driven system, but currently no way around that. Because datapacks as they are override the whole loot table. Which is a little counter productive when you just want to add to it or remove something from it.

 

Thank you for the reply.  It does wholly make sense that the mod datapack overwrite the vanilla entry.  Still feels weird though!

 

@thinkverse  I don't know how adding custom loot to chests was done in 1.13, so I can't provide any particular "converting one method to another" insights.  In 1.14.4, though, a LootTable object pretty much follows the same 'form' as a loot_tables JSON files, with pretty much the same naming.  If you get a feel for how the JSON works, the LootTable object works pretty much the same way.

 

Generally, the LootTableLoadEvent will give you the LootTable object.  To the LootTable, you add one or more LootPool objects.  To each LootPool, you add one or more LootEntry.  Annnd... to each LootEntry, one or more LootFunction.  Each individual object will store the same bits of information as its corresponding block in the JSON.  For example, the pool object has .rolls().

 

Each of the various objects do seem to have their own JSON deserializer, so it may even be possible to parse some mod-provided JSON and just add the result to the provided LootTable.  I may spend some time going down this avenue at some point, but for now I'm very much in the "make it work so I can go back to being bad at creating textures" phase.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hello Everyone! I just started learning how to code forge mods and this is my first post. I have been coding spigot plugins for 2 years so I'm not totally clueless. I just want to know how to get all the items from a Inventory/GUI. I have no clue how. I tried something like this. but it got me nowhere @SubscribeEvent public void onOpenInventory(GuiOpenEvent e) { e.getGui().itemsplsssss }  
    • I think that is the problem. I changed to using ResourceKeys instead and haven't seen the log since. 
    • That's how, thanks a lot! (≧ ▽ ≦)
    • Sorry if this is something that is solved but i cant find anything. So when I am getting hurt or about to die the game crashes.   ---- Minecraft Crash Report ---- WARNING: coremods are present:   Plugin (NotEnoughIDs-1.5.4.4.jar)   llibrary (llibrary-core-1.0.11-1.12.2.jar)   EnderCorePlugin (EnderCore-1.12.2-0.5.76-core.jar)   LucraftCoreCoreMod (LucraftCore-1.12.2-2.4.16.jar)   ForgelinPlugin (Forgelin-1.8.4.jar)   MicdoodlePlugin (MicdoodleCore-1.12.2-4.0.2.280.jar)   JustEnoughIDs Extension Plugin (JustEnoughIDs-1.0.3-55.jar)   OpenModsCorePlugin (OpenModsLib-1.12.2-0.12.2.jar)   pymtech (PymTech-1.12.2-1.0.2.jar)   SteveKunGLibPlugin (SteveKunG's-Lib-1.12.2-1.1.10.jar)   ObfuscatePlugin (obfuscate-0.4.2-1.12.2.jar)   iceandfire (iceandfire-1.9.1-1.12.2.jar) Contact their authors BEFORE contacting forge // Uh... Did I do that? Time: 9/18/21 6:11 PM Description: Ticking entity java.lang.NoClassDefFoundError: c4/conarm/lib/capabilities/ArmorAbilityHandler     at landmaster.plustic.traits.DeathSaveTrait.timing(DeathSaveTrait.java:70)     at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_1306_DeathSaveTrait_timing_LivingHurtEvent.invoke(.dynamic)     at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)     at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)     at net.minecraftforge.common.ForgeHooks.onLivingHurt(ForgeHooks.java:604)     at net.minecraft.entity.player.EntityPlayer.func_70665_d(EntityPlayer.java:1120)     at net.minecraft.entity.EntityLivingBase.func_70097_a(EntityLivingBase.java:918)     at net.minecraft.entity.player.EntityPlayer.func_70097_a(EntityPlayer.java:1038)     at net.minecraft.entity.player.EntityPlayerMP.func_70097_a(EntityPlayerMP.java:645)     at micdoodle8.mods.galacticraft.core.entities.player.GCEntityPlayerMP.func_70097_a(GCEntityPlayerMP.java:68)     at com.github.alexthe666.iceandfire.entity.EntityMyrmexSoldier.func_70636_d(EntityMyrmexSoldier.java:54)     at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:2179)     at net.minecraft.entity.EntityLiving.func_70071_h_(EntityLiving.java:295)     at com.github.alexthe666.iceandfire.entity.EntityMyrmexBase.func_70071_h_(EntityMyrmexBase.java:240)     at net.minecraft.world.World.func_72866_a(World.java:1996)     at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:832)     at net.minecraft.world.World.func_72870_g(World.java:1958)     at net.minecraft.world.World.func_72939_s(World.java:1762)     at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:613)     at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:767)     at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668)     at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:185)     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)     at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: c4.conarm.lib.capabilities.ArmorAbilityHandler     at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)     ... 24 more Caused by: java.lang.NullPointerException A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Server thread Stacktrace:     at landmaster.plustic.traits.DeathSaveTrait.timing(DeathSaveTrait.java:70)     at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_1306_DeathSaveTrait_timing_LivingHurtEvent.invoke(.dynamic)     at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)     at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)     at net.minecraftforge.common.ForgeHooks.onLivingHurt(ForgeHooks.java:604)     at net.minecraft.entity.player.EntityPlayer.func_70665_d(EntityPlayer.java:1120)     at net.minecraft.entity.EntityLivingBase.func_70097_a(EntityLivingBase.java:918)     at net.minecraft.entity.player.EntityPlayer.func_70097_a(EntityPlayer.java:1038)     at net.minecraft.entity.player.EntityPlayerMP.func_70097_a(EntityPlayerMP.java:645)     at micdoodle8.mods.galacticraft.core.entities.player.GCEntityPlayerMP.func_70097_a(GCEntityPlayerMP.java:68)     at com.github.alexthe666.iceandfire.entity.EntityMyrmexSoldier.func_70636_d(EntityMyrmexSoldier.java:54)     at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:2179)     at net.minecraft.entity.EntityLiving.func_70071_h_(EntityLiving.java:295)     at com.github.alexthe666.iceandfire.entity.EntityMyrmexBase.func_70071_h_(EntityMyrmexBase.java:240)     at net.minecraft.world.World.func_72866_a(World.java:1996)     at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:832)     at net.minecraft.world.World.func_72870_g(World.java:1958) -- Entity being ticked -- Details:     Entity Type: iceandfire:myrmex_soldier (com.github.alexthe666.iceandfire.entity.EntityMyrmexSoldier)     Entity ID: 15     Entity Name: Myrmex Soldier     Entity's Exact location: -183.34, 61.00, -11.63     Entity's Block location: World: (-184,61,-12), Chunk: (at 8,3,4 in -12,-1; contains blocks -192,0,-16 to -177,255,-1), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)     Entity's Momentum: -0.04, -0.08, -0.14     Entity's Passengers: []     Entity's Vehicle: ~~ERROR~~ NullPointerException: null Stacktrace:     at net.minecraft.world.World.func_72939_s(World.java:1762)     at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:613) -- Affected level -- Details:     Level name: New World     All players: 1 total; [GCEntityPlayerMP['Altutium'/390, l='New World', x=-183.77, y=61.00, z=-12.57]]     Chunk stats: ServerChunkCache: 769 Drop: 0     Level seed: 2105410062015924141     Level generator: ID 00 - default, ver 1. Features enabled: true     Level generator options:      Level spawn location: World: (8,64,8), Chunk: (at 8,4,8 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)     Level time: 10758 game time, 10758 day time     Level dimension: 0     Level storage version: 0x04ABD - Anvil     Level weather: Rain time: 5018 (now: false), thunder time: 119120 (now: false)     Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false Stacktrace:     at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:767)     at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668)     at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:185)     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)     at java.lang.Thread.run(Thread.java:745) -- System Details -- Details:     Minecraft Version: 1.12.2     Operating System: Windows 10 (amd64) version 10.0     Java Version: 1.8.0_51, Oracle Corporation     Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation     Memory: 2523489512 bytes (2406 MB) / 5603590144 bytes (5344 MB) up to 6442450944 bytes (6144 MB)     JVM Flags: 8 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx6G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M     IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94     FML: MCP 9.42 Powered by Forge 14.23.5.2855 95 mods loaded, 95 mods active     States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.