本文整理汇总了Java中net.minecraftforge.common.ChestGenHooks.getInfo方法的典型用法代码示例。如果您正苦于以下问题:Java ChestGenHooks.getInfo方法的具体用法?Java ChestGenHooks.getInfo怎么用?Java ChestGenHooks.getInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.ChestGenHooks
的用法示例。
在下文中一共展示了ChestGenHooks.getInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例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: 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;
}
示例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: generateBossChestContents
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
/**
* Generates a random number of items plus special boss chest loot
*/
public static void generateBossChestContents(World world, Random rand, IInventory chest, RoomBoss room) {
generateChestContents(world, rand, chest, room, true);
ChestGenHooks info = ChestGenHooks.getInfo(BOSS_LOOT);
WeightedRandomChestContent.generateChestContents(rand, info.getItems(rand), chest, info.getCount(rand));
WorldUtils.addItemToInventoryAtRandom(rand, new ItemStack(ZSSItems.heartPiece), chest, 3);
// special items that always generate, i.e. the Pendants of Virtue
ItemStack stack = room.getBossType().getSpecialItem();
if (stack != null) {
WorldUtils.addItemToInventoryAtRandom(rand, stack, chest, 3);
}
// possibly select a random special item from the boss type's list
stack = room.getBossType().getRandomSpecialItem(rand);
if (stack != null && rand.nextFloat() < 0.2F) {
WorldUtils.addItemToInventoryAtRandom(rand, stack, chest, 3);
} else {
WorldUtils.generateRandomChestContents(rand, skillOrbLootList, chest, 1, false);
}
}
示例8: fromChestGenHooks
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
public static ChestLootCategory fromChestGenHooks(String category) {
ChestGenHooks chestGenHooks = ChestGenHooks.getInfo(category);
ChestLootCategory lootCategory = new ChestLootCategory();
lootCategory.category = category;
lootCategory.count_min = chestGenHooks.getMin();
lootCategory.count_max = chestGenHooks.getMax();
List<ChestLootItem> lootList = Lists.newArrayList();
try {
for (WeightedRandomChestContent item : (List<WeightedRandomChestContent>)TooMuchLoot.contents.get(chestGenHooks)) {
lootList.add(ChestLootItem.fromChestContent(item));
}
} catch (Exception ex) {
ex.printStackTrace();
}
lootCategory.loot = lootList.toArray(new ChestLootItem[lootList.size()]);
return lootCategory;
}
示例9: handleTileEntities
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
@Override
protected void handleTileEntities(Random rand)
{
for (final ChunkCoordinates chestCoords : this.chests)
{
final TileEntity chest = this.worldObj.getBlockTileEntity(chestCoords.posX, chestCoords.posY, chestCoords.posZ);
if (chest != null && chest instanceof GCCoreTileEntityTreasureChest)
{
ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST);
WeightedRandomChestContent.generateChestContents(rand, info.getItems(rand), (GCCoreTileEntityTreasureChest) chest, info.getCount(rand));
((GCCoreTileEntityTreasureChest) chest).setInventorySlotContents(rand.nextInt(((GCCoreTileEntityTreasureChest) chest).getSizeInventory()), this.getGuaranteedLoot(rand));
}
}
}
示例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: 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);
}
示例13: 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);
}
示例14: deregister
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
public void deregister() {
if(entries != null) {
ChestGenHooks cat = ChestGenHooks.getInfo(category);
for(LootEntry entry : entries) {
if(entry != null) {
WeightedRandomChestContent content = entry.createContent();
if(content != null) {
cat.removeItem(content.theItemId);
}
}
}
}
}
示例15: apply
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
@Override
public void apply(final ItemStack scrap, final World world, final EntityPlayer player) {
final ChestGenHooks hooks = ChestGenHooks.getInfo(this.category);
if (hooks != null) {
final ItemStack stack = ItemStackHelper.getPreferredStack(hooks.getOneItem(this.rnd)).get();
if (stack != null)
EntityHelper.spawnIntoWorld(stack, world, player);
}
}