本文整理汇总了Java中net.minecraftforge.common.ChestGenHooks.addItem方法的典型用法代码示例。如果您正苦于以下问题:Java ChestGenHooks.addItem方法的具体用法?Java ChestGenHooks.addItem怎么用?Java ChestGenHooks.addItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.ChestGenHooks
的用法示例。
在下文中一共展示了ChestGenHooks.addItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BeetrootSeeds
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
public BeetrootSeeds() {
super(ModBlocks.beetroot, Blocks.farmland);
setTextureName("beetroot_seeds");
setUnlocalizedName(Utils.getUnlocalisedName("beetroot_seeds"));
setCreativeTab(EtFuturum.enableBeetroot ? EtFuturum.creativeTab : null);
if (EtFuturum.enableBeetroot) {
ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
}
}
示例2: register
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
public void register() {
ChestGenHooks cat = ChestGenHooks.getInfo(category);
cat.setMin(minItems);
cat.setMax(maxItems);
if(entries != null) {
for(LootEntry entry : entries) {
if(entry != null) {
WeightedRandomChestContent content = entry.createContent();
if(content != null) {
cat.addItem(content);
}
}
}
}
}
示例3: registerWorldGen
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
private void registerWorldGen()
{
if ( config.get( "world", "genPersistium", true ).getBoolean( true ) )
{
GameRegistry.registerWorldGenerator( persistiumOreGen = new PersistiumOreGenerator(), 10 );
}
if ( config.get( "world", "modifierEssenceLoot", true ).getBoolean( true ) )
{
ItemStack modStack = new ItemStack( items.modifierEssence );
WeightedRandomChestContent wrcc = new WeightedRandomChestContent( modStack, 1, 1, 1 );
ChestGenHooks.addItem( ChestGenHooks.MINESHAFT_CORRIDOR, wrcc );
ChestGenHooks.addItem( ChestGenHooks.VILLAGE_BLACKSMITH, wrcc );
ChestGenHooks.addItem( ChestGenHooks.PYRAMID_DESERT_CHEST, wrcc );
ChestGenHooks.addItem( ChestGenHooks.PYRAMID_JUNGLE_CHEST, wrcc );
ChestGenHooks.addItem( ChestGenHooks.STRONGHOLD_CORRIDOR, wrcc );
ChestGenHooks.addItem( ChestGenHooks.STRONGHOLD_LIBRARY, wrcc );
ChestGenHooks.addItem( ChestGenHooks.STRONGHOLD_CROSSING, wrcc );
ChestGenHooks.addItem( ChestGenHooks.DUNGEON_CHEST, wrcc );
}
}
示例4: registerChestStuff
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
private void registerChestStuff()
{
if ( config.get( "general", "bonusChestAdditions", true ).getBoolean( true ) )
{
ChestGenHooks bonusChest = ChestGenHooks.getInfo( ChestGenHooks.BONUS_CHEST );
bonusChest.addItem( new WeightedRandomChestContent( items.domesticEgg.getPetEgg( "dog" ), 1, 1, 3 ) ); // Wolf
bonusChest.addItem( new WeightedRandomChestContent( items.domesticEgg.getPetEgg( "cat" ), 1, 1, 3 ) ); // Ocelot
}
if ( config.get( "general", "dungeonChestAdditions", true ).getBoolean( true ) )
{
ChestGenHooks dungeonChest = ChestGenHooks.getInfo( ChestGenHooks.DUNGEON_CHEST );
dungeonChest.addItem( new WeightedRandomChestContent( new ItemStack( items.goldClaws ), 1, 1, 6 ) );
dungeonChest.addItem( new WeightedRandomChestContent( new ItemStack( items.ironClaws ), 1, 1, 4 ) );
dungeonChest.addItem( new WeightedRandomChestContent( new ItemStack( items.diamondClaws ), 1, 1, 2 ) );
}
if ( config.get( "general", "startWithWand", true ).getBoolean( true ) )
{
StarterItemEventHandler.addStarterItem( "PetWand", new ItemStack( items.wand ) );
}
}
示例5: registerChestItems
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
public void registerChestItems() {
ChestGenHooks chestGenHooksDungeon = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST);
chestGenHooksDungeon.addItem(new WeightedRandomChestContent(new ItemStack(ModItems.nileEssence), 1, 1, 30));
// chance < saddle (1/16, ca. 6%, in max 8 slots -> 40% at least 1 egg, 0.48 eggs per chest): I think that's okay
ChestGenHooks chestGenHooksMineshaft = ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR);
chestGenHooksMineshaft.addItem(new WeightedRandomChestContent(new ItemStack(ModItems.nileEssence), 1, 1, 5));
// chance == gold ingot (1/18, ca. 6%, in 3-6 slots -> 23% at least 1 egg, 0.27 eggs per chest):
// exploring a random mine shaft in creative mode yielded 2 eggs out of about 10 chests in 1 hour
ChestGenHooks chestGenHooksJungleChest = ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST);
chestGenHooksJungleChest.addItem(new WeightedRandomChestContent(new ItemStack(ModItems.nileEssence), 1, 1, 15));
// chance == gold ingot (15/81, ca. 18%, in 2-5 slots -> 51% at least 1 egg, 0.65 eggs per chest, 1.3 eggs per temple):
// jungle temples are so rare, it should be rewarded
ChestGenHooks chestGenHooksDesertChest = ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST);
chestGenHooksDesertChest.addItem(new WeightedRandomChestContent(new ItemStack(ModItems.nileEssence), 1, 1, 10));
// chance == iron ingot (10/76, ca. 13%, in 2-5 slots -> 39% at least 1 egg, 0.46 eggs per chest, 1.8 eggs per temple):
// desert temples are so rare, it should be rewarded
}
示例6: registerChestItems
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
public void registerChestItems() {
ChestGenHooks chestGenHooksDungeon = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST);
chestGenHooksDungeon.addItem(new WeightedRandomChestContent(new ItemStack(ModItems.nileEssence), 1, 1, 70));
// chance < saddle (1/16, ca. 6%, in max 8 slots -> 40% at least 1 egg, 0.48 eggs per chest): I think that's okay
ChestGenHooks chestGenHooksMineshaft = ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR);
chestGenHooksMineshaft.addItem(new WeightedRandomChestContent(new ItemStack(ModItems.nileEssence), 1, 1, 5));
// chance == gold ingot (1/18, ca. 6%, in 3-6 slots -> 23% at least 1 egg, 0.27 eggs per chest):
// exploring a random mine shaft in creative mode yielded 2 eggs out of about 10 chests in 1 hour
ChestGenHooks chestGenHooksJungleChest = ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST);
chestGenHooksJungleChest.addItem(new WeightedRandomChestContent(new ItemStack(ModItems.nileEssence), 1, 1, 15));
// chance == gold ingot (15/81, ca. 18%, in 2-5 slots -> 51% at least 1 egg, 0.65 eggs per chest, 1.3 eggs per temple):
// jungle temples are so rare, it should be rewarded
ChestGenHooks chestGenHooksDesertChest = ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST);
chestGenHooksDesertChest.addItem(new WeightedRandomChestContent(new ItemStack(ModItems.nileEssence), 1, 1, 10));
// chance == iron ingot (10/76, ca. 13%, in 2-5 slots -> 39% at least 1 egg, 0.46 eggs per chest, 1.8 eggs per temple):
// desert temples are so rare, it should be rewarded
}
示例7: addToAllChests
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
private static void addToAllChests(ItemStack[] items,int min,int max,int weight)
{
for(int i = 0; i < items.length; i++)
{
max = items[i].stackSize;//will this upp the obsidian size to 1?
//args are item, min, max, ?odds
ChestGenHooks.addItem(PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(items[i], min, max, weight));
ChestGenHooks.addItem(PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(items[i], min, max, weight));
ChestGenHooks.addItem(VILLAGE_BLACKSMITH, new WeightedRandomChestContent( items[i], min, max, weight));
ChestGenHooks.addItem(DUNGEON_CHEST, new WeightedRandomChestContent( items[i], min, max, weight));
ChestGenHooks.addItem(MINESHAFT_CORRIDOR, new WeightedRandomChestContent( items[i], min, max, weight));
ChestGenHooks.addItem(STRONGHOLD_CORRIDOR, new WeightedRandomChestContent( items[i], min, max, weight));
ChestGenHooks.addItem(STRONGHOLD_CROSSING, new WeightedRandomChestContent (items[i], min, max, weight));
ChestGenHooks.addItem(STRONGHOLD_LIBRARY, new WeightedRandomChestContent( items[i], min, max, weight));
ChestGenHooks.addItem(NETHER_FORTRESS, new WeightedRandomChestContent( items[i], min, max, weight));
//brainstorm what would make sense, be Fun, and Not overpowered in bonus chests
// if food then not too much
//stack of fun potions
//
//this was for testing. on a new world we got 4 records right away
//weight=9;
//ChestGenHooks.addItem(BONUS_CHEST, new WeightedRandomChestContent(items[i], min, max, weight));
}
}
示例8: init
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
public static void init() {
for (int i = 0; i < UtilityCheck.getListOfMaterials().size(); i++) {
if(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getDimension() == MaterialDimension.OVERWORLD) {
if(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.INGOT || ((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.GEM || ((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.NUGGET ||((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.ALLOY || ((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.PUREGEM) {
ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent((ItemMaterial) UtilityCheck.getListOfMaterials().get(i), 0, 1, 3, MiscUtility.clamp(UtilityCheck.getBaseRarity(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)))/5, 1, Int.MaxValue())));
ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent((ItemMaterial) UtilityCheck.getListOfMaterials().get(i), 0, 1, 2, MiscUtility.clamp(UtilityCheck.getBaseRarity(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)))/10, 1, Int.MaxValue())));
ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent((ItemMaterial) UtilityCheck.getListOfMaterials().get(i), 0, 1, 3, MiscUtility.clamp(UtilityCheck.getBaseRarity(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)))/7, 1, Int.MaxValue())));
ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent((ItemMaterial) UtilityCheck.getListOfMaterials().get(i), 0, 1, 5, MiscUtility.clamp(UtilityCheck.getBaseRarity(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)))/3, 1, Int.MaxValue())));
ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent((ItemMaterial) UtilityCheck.getListOfMaterials().get(i), 0, 1, 7, MiscUtility.clamp(UtilityCheck.getBaseRarity(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)))/2, 1, Int.MaxValue())));
}
if(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.INGOT || ((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.ALLOY || ((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.PLATE || ((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.NUGGET) {
ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, new WeightedRandomChestContent((ItemMaterial) UtilityCheck.getListOfMaterials().get(i), 0, 1, 3, MiscUtility.clamp(UtilityCheck.getBaseRarity(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)))/20, 1, Int.MaxValue())));
}
if(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.GEM || ((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.PUREGEM || ((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.SHARD) {
ModMisc.houseChest.addItem(new WeightedRandomChestContent((ItemMaterial) UtilityCheck.getListOfMaterials().get(i), 0, 1, 5, MiscUtility.clamp(UtilityCheck.getBaseRarity(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)))/2, 1, Int.MaxValue())));
}
} else if(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getDimension() == MaterialDimension.END) {
ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent((ItemMaterial) UtilityCheck.getListOfMaterials().get(i), 0, 1, 7, MiscUtility.clamp(UtilityCheck.getBaseRarity((ItemMaterial) UtilityCheck.getListOfMaterials().get(i))/2, 1, Int.MaxValue())));
}
}
ModMisc.houseChest.addItem(new WeightedRandomChestContent(Items.diamond, 0, 1, 5, 7));
ModMisc.houseChest.addItem(new WeightedRandomChestContent(Items.emerald, 0, 1, 5, 10));
ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, new WeightedRandomChestContent(Items.gold_nugget, 0, 1, 3, MiscUtility.clamp(UtilityCheck.getBaseRarity((ModItems.nuggetSilver))/20, 1, Int.MaxValue())));
}
示例9: load
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
@Mod.EventHandler
public void load (FMLInitializationEvent event) {
proxy.registerRenderers();
MinecraftForge.EVENT_BUS.register(this);
FMLCommonHandler.instance().bus().register(this);
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
for (int i = 1; i < 256; i++) {
if (!config.hasPattern(i))
continue;
PatternConfig pattern = config.getPattern(i);
for (int j = 0; j < pattern.getLocationCount(); j++)
ChestGenHooks.addItem(pattern.getGenLocation(j), new WeightedRandomChestContent(items.potteryPattern, i, 1, 1, pattern.getGenRarity(j)));
}
VillagerTradeHandler.instance().load();
integration.init();
}
示例10: bindHooks
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
private static void bindHooks() {
ChestGenHooks hooks = ChestGenHooks.getInfo("Placemod");
for (ResourceLocation itemName : GameData.getItemRegistry().getKeys()) {
Item item = Item.itemRegistry.getObject(itemName);
int maxDmg = item.getMaxDamage();
for (int meta = 0; meta <= maxDmg; ++meta) {
hooks.addItem(new WeightedRandomChestContent(new ItemStack(item, 1, meta), 1, maxChestStackSize, 256 / (1 + maxDmg)));
}
}
hooks.setMin(minChestItems);
hooks.setMax(maxChestItems);
}
示例11: bindHooks
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
private static void bindHooks() {
ChestGenHooks hooks = ChestGenHooks.getInfo("Placemod");
for (Object itemName : GameData.getItemRegistry().getKeys()) {
Item item = (Item) Item.itemRegistry.getObject(itemName);
int maxMeta = item.getMaxDamage();
for (int meta = 0; meta <= maxMeta; ++meta) {
hooks.addItem(new WeightedRandomChestContent(new ItemStack(item, 1, meta), 1, maxChestStackSize, 256 / (maxMeta + 1)));
}
}
hooks.setMin(minChestItems);
hooks.setMax(maxChestItems);
}
示例12: setupFrames
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
private void setupFrames() {
hiveFrameMagic = new ItemMagicHiveFrame(HiveFrameType.MAGIC);
hiveFrameResilient = new ItemMagicHiveFrame(HiveFrameType.RESILIENT);
hiveFrameGentle = new ItemMagicHiveFrame(HiveFrameType.GENTLE);
hiveFrameMetabolic = new ItemMagicHiveFrame(HiveFrameType.METABOLIC);
hiveFrameNecrotic = new ItemMagicHiveFrame(HiveFrameType.NECROTIC);
hiveFrameTemporal = new ItemMagicHiveFrame(HiveFrameType.TEMPORAL);
hiveFrameOblivion = new ItemMagicHiveFrame(HiveFrameType.OBLIVION);
ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new ItemStack(hiveFrameOblivion), 1, 1, 18));
ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new ItemStack(hiveFrameOblivion), 1, 3, 23));
}
示例13: register
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
@Override
protected void register(WeightedRandomChestContent value, RegChestContent anno, String field)
throws Exception {
for(int i : anno.value()) {
ChestGenHooks.addItem(type(i), value);
}
}
示例14: registerGuardTowerChest
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
public static void registerGuardTowerChest(){
ChestGenHooks.getInfo(TOWER_CHEST);
for(int i = 0; i < towerChestContents.length; i++){
ChestGenHooks.addItem(TOWER_CHEST, towerChestContents[i]);
}
ChestGenHooks.getInfo(TOWER_CHEST).setMin(3);
ChestGenHooks.getInfo(TOWER_CHEST).setMax(7);
}
示例15: registerTavernChest
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
public static void registerTavernChest(){
ChestGenHooks.getInfo(TAVERN_CHEST);
for(int i = 0; i < tavernChestContents.length; i++){
ChestGenHooks.addItem(TAVERN_CHEST, tavernChestContents[i]);
}
// ChestGenHooks.getInfo(TAVERN_CHEST).setMax(3); // Min?
ChestGenHooks.getInfo(TAVERN_CHEST).setMin(3);
ChestGenHooks.getInfo(TAVERN_CHEST).setMax(7);
}