本文整理汇总了Java中net.minecraftforge.common.ChestGenHooks.getItems方法的典型用法代码示例。如果您正苦于以下问题:Java ChestGenHooks.getItems方法的具体用法?Java ChestGenHooks.getItems怎么用?Java ChestGenHooks.getItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.ChestGenHooks
的用法示例。
在下文中一共展示了ChestGenHooks.getItems方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBonusChest
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
protected void createBonusChest()
{
WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(ChestGenHooks.getItems(BONUS_CHEST, rand), ChestGenHooks.getCount(BONUS_CHEST, rand));
for (int i = 0; i < 10; ++i)
{
int j = this.worldInfo.getSpawnX() + this.rand.nextInt(6) - this.rand.nextInt(6);
int k = this.worldInfo.getSpawnZ() + this.rand.nextInt(6) - this.rand.nextInt(6);
int l = this.getTopSolidOrLiquidBlock(j, k) + 1;
if (worldgeneratorbonuschest.generate(this, this.rand, j, l, k))
{
break;
}
}
}
示例2: createBonusChest
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
/**
* Creates the bonus chest in the world.
*/
protected void createBonusChest()
{
WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(ChestGenHooks.getItems(BONUS_CHEST, rand), ChestGenHooks.getCount(BONUS_CHEST, rand));
for (int i = 0; i < 10; ++i)
{
int j = this.worldInfo.getSpawnX() + this.rand.nextInt(6) - this.rand.nextInt(6);
int k = this.worldInfo.getSpawnZ() + this.rand.nextInt(6) - this.rand.nextInt(6);
int l = this.getTopSolidOrLiquidBlock(j, k) + 1;
if (worldgeneratorbonuschest.generate(this, this.rand, j, l, k))
{
break;
}
}
}
示例3: generateChestContents
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
protected void generateChestContents(final IInventory inventory, final String category, final int count) {
final List<WeightedRandomChestContent> contents = ChestGenHooks.getItems(category, rand);
if (contents == null || contents.size() == 0)
ModLog.warn("Unable to get chest contents: %s", category);
else
WeightedRandomChestContent.generateChestContents(rand, contents, inventory, count);
}
示例4: createBonusChest
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
/**
* Creates the bonus chest in the world.
*/
protected void createBonusChest() {
WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(
ChestGenHooks.getItems(BONUS_CHEST, rand), ChestGenHooks.getCount(BONUS_CHEST, rand));
for (int i = 0; i < 10; ++i) {
int j = this.worldInfo.getSpawnX() + this.rand.nextInt(6) - this.rand.nextInt(6);
int k = this.worldInfo.getSpawnZ() + this.rand.nextInt(6) - this.rand.nextInt(6);
int l = this.getTopSolidOrLiquidBlock(j, k) + 1;
if (worldgeneratorbonuschest.generate(this, this.rand, j, l, k)) {
break;
}
}
}
示例5: processCommand
import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
@Override
public void processCommand(ICommandSender commandSender, String[] args) {
if (args.length == 1) {
if (args[0].equalsIgnoreCase("reload")) {
ChestLootLoader.restoreCachedLootTable();
ChestLootLoader.loadFiles(TooMuchLoot.lootFolder);
} else if (args[0].equalsIgnoreCase("generate")) {
ChestLootLoader.generateFiles(TooMuchLoot.generatedFolder);
} else if (args[0].equalsIgnoreCase("reset")) {
ChestLootLoader.restoreCachedLootTable();
}
} else if (args.length == 2) {
if (args[0].equalsIgnoreCase("generate")) {
ChestLootLoader.generateFiles(TooMuchLoot.generatedFolder, args[1]);
}
} else if (args.length == 5) {
if (args[0].equalsIgnoreCase("spawnDebugChest")) {
String tag = args[1];
EntityPlayerMP entityPlayerMP = getCommandSenderAsPlayer(commandSender);
Random random = new Random();
WeightedRandomChestContent[] contents = ChestGenHooks.getItems(tag, random);
int count = ChestGenHooks.getCount(tag, random);
int x = (int)Math.floor(func_110666_a(commandSender, entityPlayerMP.posX, args[2]));
int y = (int)Math.floor(func_110665_a(commandSender, entityPlayerMP.posY, args[3], 0, 0));
int z = (int)Math.floor(func_110666_a(commandSender, entityPlayerMP.posZ, args[4]));
if (entityPlayerMP.worldObj.isAirBlock(x, y, z) && World.doesBlockHaveSolidTopSurface(entityPlayerMP.worldObj, x, y - 1, z)) {
entityPlayerMP.worldObj.setBlock(x, y, z, Blocks.chest, 0, 2);
TileEntityChest tileEntity = (TileEntityChest) entityPlayerMP.worldObj.getTileEntity(x, y, z);
if (tileEntity != null) {
WeightedRandomChestContent.generateChestContents(random, contents, tileEntity, count);
}
}
}
}
}