Dungeon Hooks
Dungeon hooks are a cool feature included with forge that can help you customize dungeons in minecraft. The way to use these hooks are simple, just add the single line of code for the hook into the initialization method contained within your @Mod/Core file.
Adding loot to the dungeon loot chests
To add loot to the dungeon loot chests we will need to add this one like to the Initialization method within the @Mod/Core mod file.
MinecraftForge.addDungeonLoot(new ItemStack(TheItem), Rarity,Minimum,maximum);
The hook required four things to generate your item in the dungeon chests. The first thing that is required is the ItemStack. The item will usually look like YourMod.YourItem or YourModItems.YourItem.
Next up we have the rarity. The rarity is a number that determines how likely the item is to spawn in the loot chest. The Higher the number the more likely it is to spawn. A gold apple has a value of 001 and bread is 100. This value can be higher than 100.
The third value is the minimum amount of that item that will be in a stack. If the min is set to 2 then two of that item will be spawned in a single stack.
The final value is the maximum amount of the item in a stack. If you set it to 4 then you will not find any more than 4 in a stack. The maximum must be higher than the minimum or the game will crash when the dungeon chest is opened.
Here is an example of what one of my lines looks like.
DungeonHooks.addDungeonLoot(new ItemStack(RWItems.rupeeGreen), 100, 1, 1);
MinecraftForge.addDungeonLoot(new ItemStack(TheItem), Rarity,Minimum,maximum);
The hook required four things to generate your item in the dungeon chests. The first thing that is required is the ItemStack. The item will usually look like YourMod.YourItem or YourModItems.YourItem.
Next up we have the rarity. The rarity is a number that determines how likely the item is to spawn in the loot chest. The Higher the number the more likely it is to spawn. A gold apple has a value of 001 and bread is 100. This value can be higher than 100.
The third value is the minimum amount of that item that will be in a stack. If the min is set to 2 then two of that item will be spawned in a single stack.
The final value is the maximum amount of the item in a stack. If you set it to 4 then you will not find any more than 4 in a stack. The maximum must be higher than the minimum or the game will crash when the dungeon chest is opened.
Here is an example of what one of my lines looks like.
DungeonHooks.addDungeonLoot(new ItemStack(RWItems.rupeeGreen), 100, 1, 1);