Changing the amount of items added to the dungeon chest is very easy in forge.
To do this you will need a basic mod file, but for this example I will use the file from earlier tutorials.
package Tutorial.common;
import net.minecraft.src.Block;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraftforge.common.DungeonHooks;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "YourName_ModName", name = "ModName", version = "Version number")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Tutorial
{
public static Block oreblock;
public static Item youritem;
@SidedProxy(clientSide = "Tutorial.client.ClientProxyTutorial", serverSide = "Tutorial.common.CommonProxyTutorial")
public static CommonProxyTutorial proxy;
@Init
public void load(FMLInitializationEvent event)
{
oreblock = new BlockOres(230, 0).setStepSound(Block.soundStoneFootstep).setHardness(3F).setResistance(1.0F).setBlockName("oreblock");
GameRegistry.registerBlock(oreblock);
LanguageRegistry.addName(oreblock, "Your Ore");
youritem = new ItemTutorial(550).setIconIndex(1).setItemName("youritem");
LanguageRegistry.addName(youritem, "Your Item");
proxy.registerRenderThings();
DungeonHooks.addDungeonLoot(new ItemStack(youritem), 10, 2, 5);
}
}
To do this you will have to add this line of code.
package Tutorial.common;
import net.minecraft.src.Block;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraftforge.common.DungeonHooks;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "YourName_ModName", name = "ModName", version = "Version number")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Tutorial
{
public static Block oreblock;
public static Item youritem;
@SidedProxy(clientSide = "Tutorial.client.ClientProxyTutorial", serverSide = "Tutorial.common.CommonProxyTutorial")
public static CommonProxyTutorial proxy;
@Init
public void load(FMLInitializationEvent event)
{
oreblock = new BlockOres(230, 0).setStepSound(Block.soundStoneFootstep).setHardness(3F).setResistance(1.0F).setBlockName("oreblock");
GameRegistry.registerBlock(oreblock);
LanguageRegistry.addName(oreblock, "Your Ore");
youritem = new ItemTutorial(550).setIconIndex(1).setItemName("youritem");
LanguageRegistry.addName(youritem, "Your Item");
proxy.registerRenderThings();
DungeonHooks.addDungeonLoot(new ItemStack(youritem), 10, 2, 5);
}
}
To do this you will have to add this line of code.
DungeonHooks.setDungeonLootTries(12);
DungeonHooks is the class where you can find the setDungeonLootTries method. The number between the brackets is the amount of itemstacks it will try to add in the dungeon.
The standard number is 8. If you make this number very high. Like 30 it will really slow down your world generation.
The whole file should now look like this.
package Tutorial.common;
import net.minecraft.src.Block;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraftforge.common.DungeonHooks;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "YourName_ModName", name = "ModName", version = "Version number")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Tutorial
{
public static Block oreblock;
public static Item youritem;
@SidedProxy(clientSide = "Tutorial.client.ClientProxyTutorial", serverSide = "Tutorial.common.CommonProxyTutorial")
public static CommonProxyTutorial proxy;
@Init
public void load(FMLInitializationEvent event)
{
oreblock = new BlockOres(230, 0).setStepSound(Block.soundStoneFootstep).setHardness(3F).setResistance(1.0F).setBlockName("oreblock");
GameRegistry.registerBlock(oreblock);
LanguageRegistry.addName(oreblock, "Your Ore");
youritem = new ItemTutorial(550).setIconIndex(1).setItemName("youritem");
LanguageRegistry.addName(youritem, "Your Item");
proxy.registerRenderThings();
DungeonHooks.addDungeonLoot(new ItemStack(youritem), 10, 2, 5);
DungeonHooks.setDungeonLootTries(12);
}
}
When you are done you should go back to the tutorials list here.
The standard number is 8. If you make this number very high. Like 30 it will really slow down your world generation.
The whole file should now look like this.
package Tutorial.common;
import net.minecraft.src.Block;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraftforge.common.DungeonHooks;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "YourName_ModName", name = "ModName", version = "Version number")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Tutorial
{
public static Block oreblock;
public static Item youritem;
@SidedProxy(clientSide = "Tutorial.client.ClientProxyTutorial", serverSide = "Tutorial.common.CommonProxyTutorial")
public static CommonProxyTutorial proxy;
@Init
public void load(FMLInitializationEvent event)
{
oreblock = new BlockOres(230, 0).setStepSound(Block.soundStoneFootstep).setHardness(3F).setResistance(1.0F).setBlockName("oreblock");
GameRegistry.registerBlock(oreblock);
LanguageRegistry.addName(oreblock, "Your Ore");
youritem = new ItemTutorial(550).setIconIndex(1).setItemName("youritem");
LanguageRegistry.addName(youritem, "Your Item");
proxy.registerRenderThings();
DungeonHooks.addDungeonLoot(new ItemStack(youritem), 10, 2, 5);
DungeonHooks.setDungeonLootTries(12);
}
}
Geen opmerkingen:
Een reactie posten