當前位置: 首頁>>代碼示例>>Java>>正文


Java TileEntityChest.setLootTable方法代碼示例

本文整理匯總了Java中net.minecraft.tileentity.TileEntityChest.setLootTable方法的典型用法代碼示例。如果您正苦於以下問題:Java TileEntityChest.setLootTable方法的具體用法?Java TileEntityChest.setLootTable怎麽用?Java TileEntityChest.setLootTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.tileentity.TileEntityChest的用法示例。


在下文中一共展示了TileEntityChest.setLootTable方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setLootTable

import net.minecraft.tileentity.TileEntityChest; //導入方法依賴的package包/類
private static void setLootTable(TileEntityChest chestEntity, World world, int multiplier)
{
	double common = 75 / multiplier;
	double uncommon = 15;
	double rare = 6;
	double legendary = 3;
	double exotic = 1;
	
	RandomCollection<ResourceLocation> loottables = new RandomCollection<ResourceLocation>();
	
	loottables.add(common, ModLootTables.common_chest);
	loottables.add(uncommon, ModLootTables.uncommon_chest);
	loottables.add(rare, ModLootTables.rare_chest);
	loottables.add(legendary, ModLootTables.legendary_chest);
	loottables.add(exotic, ModLootTables.exotic_chest);
	
	ResourceLocation table = loottables.next(world.rand);
	chestEntity.setLootTable(table, world.rand.nextLong());
	
	if (table == ModLootTables.common_chest) chestEntity.setCustomName("Common Chest");
	else if (table == ModLootTables.uncommon_chest) chestEntity.setCustomName("Uncommon Chest");
	else if (table == ModLootTables.rare_chest) chestEntity.setCustomName("Rare Chest");
	else if (table == ModLootTables.legendary_chest) chestEntity.setCustomName("Legendary Chest");
	else if (table == ModLootTables.exotic_chest) chestEntity.setCustomName("Exotic Chest");
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:26,代碼來源:DungeonHelper.java

示例2: generateChestContents

import net.minecraft.tileentity.TileEntityChest; //導入方法依賴的package包/類
/**
 * Generate trapped chests with items.
 */
public static void generateChestContents(ComponentGraveStone component, World world, Random random, int xCoord, int yCoord, int zCoord, EnumFacing facing, ResourceLocation loot, boolean trapped) {
    int x = component.getXWithOffset(xCoord, zCoord);
    int y = component.getYWithOffset(yCoord);
    int z = component.getZWithOffset(xCoord, zCoord);

    BlockPos pos = new BlockPos(x, y, z);
    IBlockState chest;
    if (trapped) {
        chest = StateHelper.getChest(StateHelper.TRAPPED_CHEST, facing);
    } else {
        chest = StateHelper.getChest(StateHelper.CHEST, facing);
    }
    world.setBlockState(pos, chest, 2);
    TileEntityChest tileentity = (TileEntityChest) world.getTileEntity(pos);

    if (tileentity != null) {
        tileentity.setLootTable(loot, random.nextLong());
    }
}
 
開發者ID:NightKosh,項目名稱:Gravestone-mod-Extended,代碼行數:23,代碼來源:ObjectsGenerationHelper.java


注:本文中的net.minecraft.tileentity.TileEntityChest.setLootTable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。