本文整理匯總了Java中net.minecraftforge.common.ChestGenHooks類的典型用法代碼示例。如果您正苦於以下問題:Java ChestGenHooks類的具體用法?Java ChestGenHooks怎麽用?Java ChestGenHooks使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ChestGenHooks類屬於net.minecraftforge.common包,在下文中一共展示了ChestGenHooks類的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: addToChests
import net.minecraftforge.common.ChestGenHooks; //導入依賴的package包/類
public static void addToChests() {
int numHammers = 94;
for (int i = 0; i < numHammers ; i++) {
if(HammerMod.DEBUG_MODE == true) {
System.out.println("DEBUG: Injected Hammer with ID " + i + " into the Minecraft LootChests.");
}
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CORRIDOR).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_LIBRARY).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CROSSING).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
ChestGenHooks.getInfo(ChestGenHooks.BONUS_CHEST).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
}
}
示例3: registerInit
import net.minecraftforge.common.ChestGenHooks; //導入依賴的package包/類
static void registerInit(@SuppressWarnings("UnusedParameters") FMLInitializationEvent event) {
//TileEntityの登録 =============================================================================================
GameRegistry.registerTileEntity(TileEntityClayCrucible.class, "tileClayCrucible");
GameRegistry.registerTileEntity(TileEntityClayCrucibleHeater.class, "tileClayCrucibleHeater");
//WorldGeneratorの登録 =========================================================================================
GameRegistry.registerWorldGenerator(new OreGenerator(), 2);
//チャンク生成イベントのフック
MinecraftForge.EVENT_BUS.register(new AMMStructureEventHandler());
MapGenStructureIO.registerStructure(StructureTestStart.class, "Test");
MapGenStructureIO.func_143031_a(StructureTestStart.ComponentTest1.class, "Test1");
MapGenStructureIO.func_143031_a(StructureTestStart.ComponentTest2.class, "Test2");
MapGenStructureIO.func_143031_a(StructureTestStart.ComponentTest3.class, "Test3");
MapGenStructureIO.func_143031_a(StructureTestStart.ComponentTest4.class, "Test4");
MapGenStructureIO.registerStructure(StructureTiamatStart.class, "TiamatComet");
MapGenStructureIO.func_143031_a(ComponentTiamatCenter.class, "TiamaitCometCenter");
MapGenStructureIO.func_143031_a(ComponentTiamatCenterLine.class, "TiamatCometCenterLine");
EntityRegistry.registerModEntity(EntityHoeHoeMan.class, "HoeHoeMan", 0, AntiMatterModCore.MOD_ID, 250, 1, false);//中ボスの追加
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
RenderingRegistry.registerEntityRenderingHandler(EntityHoeHoeMan.class, new RenderHoeHoeMan());
}
//村のチェストの中身============================================================================================
//ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, new WeightedRandomChestContent(ingot_01,1,1,5,5));
//ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, new WeightedRandomChestContent(ingot_01,2,1,5,5));
ChestGenHooks village =ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH);
village.setMax(village.getMax()+10);
village.setMin(village.getMin()+10);
}
示例4: getChestGenerationHooks
import net.minecraftforge.common.ChestGenHooks; //導入依賴的package包/類
private static List<ChestGenHooks> getChestGenerationHooks() {
if (chestHooks != null)
return chestHooks;
chestHooks = new ArrayList<ChestGenHooks>();
final ConfigCategory c = chests.getCategory(ConfigProcessor.CONFIG_CHESTS);
for (final ConfigCategory p : c.getChildren()) {
if(!isContainerNode(p)) {
processEntry(null, p, chestHooks);
} else {
for (final ConfigCategory cc : p.getChildren())
processEntry(p, cc, chestHooks);
}
}
return chestHooks;
}
示例5: 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);
}
}
}
}
}
示例6: populate
import net.minecraftforge.common.ChestGenHooks; //導入依賴的package包/類
@Override
public boolean populate(World world) {
// world.setBlock(x, y, z, chestBlock.getBlock(), chestBlock.getMetadata(), 2);
IInventory chest = (IInventory) world.getTileEntity(x, y, z);
if (chest != null)
{
// this clears the chest
for (int i = 0; i < chest.getSizeInventory(); i++)
{
chest.setInventorySlotContents(i, null);
}
// hmm that is an interesting concept
ChestGenHooks info = ChestGenHooks.getInfo(chestGenName);
WeightedRandomChestContent.generateChestContents(world.rand, info.getItems(world.rand), chest, info.getCount(world.rand));
return true;
}
return false;
}
示例7: 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 );
}
}
示例8: getChestGenBase
import net.minecraftforge.common.ChestGenHooks; //導入依賴的package包/類
@Override
public WeightedRandomChestContent getChestGenBase( ChestGenHooks chest, Random rnd, WeightedRandomChestContent original )
{
Modifier mod = Modifier.getModifier( Modifier.getTypes()[ rnd.nextInt( Modifier.getTypes().length ) ] );
int level = 1 + rnd.nextInt( mod.getMaxLevel() );
NBTTagCompound tag = new NBTTagCompound();
tag.setString( "Modifier", mod.type );
tag.setInteger( "Level", level );
ItemStack loot = new ItemStack( this );
loot.setTagCompound( tag );
original.theItemId = loot;
//System.out.println( "Did generation " + chest.category + " " + mod.type + " " + level );
return original;
}
示例9: addWorldgen
import net.minecraftforge.common.ChestGenHooks; //導入依賴的package包/類
public static void addWorldgen()
{
if(BBConfig.spawnMarshmallows){
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(
RegisterItems.marshmallow), 1, 5, 100));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST)
.addItem(new WeightedRandomChestContent(new ItemStack(RegisterItems.marshmallow), 1, 10, 200));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(
RegisterItems.marshmallow), 1, 10, 200));
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CROSSING)
.addItem(new WeightedRandomChestContent(new ItemStack(RegisterItems.marshmallow), 1, 12, 150));
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CORRIDOR)
.addItem(new WeightedRandomChestContent(new ItemStack(RegisterItems.marshmallow), 1, 12, 150));
ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR)
.addItem(new WeightedRandomChestContent(new ItemStack(RegisterItems.marshmallow), 1, 12, 150));
}
}
示例10: 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 ) );
}
}
示例11: dump
import net.minecraftforge.common.ChestGenHooks; //導入依賴的package包/類
@Override
public Iterable<String[]> dump(int mode) {
List<String[]> list = new LinkedList<String[]>();
Map<String, ChestGenHooks> lootTables = ReflectionHelper.getPrivateValue(ChestGenHooks.class, null, "chestInfo");
List<String> names = new ArrayList<String>();
names.addAll(lootTables.keySet());
Collections.sort(names);
for (String name : names) {
List<WeightedRandomChestContent> contents = ReflectionHelper.getPrivateValue(ChestGenHooks.class, lootTables.get(name), "contents");
for (WeightedRandomChestContent w : contents) {
String displayName;
try {
displayName = w.theItemId.getDisplayName();
} catch (Exception ex) {
displayName = "-";
}
list.add(new String[] { name, w.theItemId.toString(), displayName, Item.itemRegistry.getNameForObject(w.theItemId.getItem()), String.valueOf(w.itemWeight) });
}
}
return list;
}
示例12: 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
}
示例13: 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
}
示例14: init
import net.minecraftforge.common.ChestGenHooks; //導入依賴的package包/類
public static void init(){
for (int i = 0; i < 11; i++)
{
// Grimoire Page
WeightedRandomChestContent grimoirePages = new WeightedRandomChestContent(FCraftItems.grimoirePage.itemID, i, 1, 1, 1);
// Put in corresponding chest
ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).addItem(grimoirePages);
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).addItem(grimoirePages);
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST).addItem(grimoirePages);
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_DISPENSER).addItem(grimoirePages);
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CORRIDOR).addItem(grimoirePages);
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_LIBRARY).addItem(grimoirePages);
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CROSSING).addItem(grimoirePages);
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(grimoirePages);
ChestGenHooks.getInfo(ChestGenHooks.BONUS_CHEST).addItem(grimoirePages);
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(grimoirePages);
}
}
示例15: addChestLoot
import net.minecraftforge.common.ChestGenHooks; //導入依賴的package包/類
public static void addChestLoot() {
for (int i = 0; i < Rings.proxy.spellRegistry.getSpellList().size(); i++) {
ISpellEntry entry = Rings.proxy.spellRegistry.getSpellList().get(i);
if (entry != null && entry.getSpell() != null) {
ItemStack stack = new ItemStack(ModItems.spellParchment);
if (!stack.hasTagCompound())
stack.stackTagCompound = new NBTTagCompound();
stack.getTagCompound().setString(ModLibs.SPELL_ID, entry.getSpellID());
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(stack, 0, 1, 2));
ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).addItem(new WeightedRandomChestContent(stack, 0, 1, 2));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).addItem(new WeightedRandomChestContent(stack, 0, 1, 2));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST).addItem(new WeightedRandomChestContent(stack, 0, 1, 2));
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_LIBRARY).addItem(new WeightedRandomChestContent(stack, 0, 1, 2));
}
}
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.food), 1, 5, 100));
}