本文整理汇总了Java中net.minecraft.world.storage.loot.LootPool类的典型用法代码示例。如果您正苦于以下问题:Java LootPool类的具体用法?Java LootPool怎么用?Java LootPool使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LootPool类属于net.minecraft.world.storage.loot包,在下文中一共展示了LootPool类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onLootTableLoad
import net.minecraft.world.storage.loot.LootPool; //导入依赖的package包/类
@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent event) {
if (ConfigHandler.general.enableDungeonLoot) {
String prefix = "minecraft:chests/";
String name = event.getName().toString();
if (name.startsWith(prefix)) {
String file = name.substring(name.indexOf(prefix) + prefix.length());
switch (file) {
case "abandoned_mineshaft":
case "desert_pyramid":
case "jungle_temple":
case "simple_dungeon":
case "spawn_bonus_chest":
case "stronghold_corridor":
case "village_blacksmith":
LootEntry entry = new LootEntryTable(RL("inject/simple_dungeon_loot"), 1, 0, new LootCondition[0], "pneumaticcraft_inject_entry");
LootPool pool = new LootPool(new LootEntry[]{entry}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "pneumaticcraft_inject_pool");
event.getTable().addPool(pool);
break;
default:
break;
}
}
}
}
示例2: onLootTableLoad
import net.minecraft.world.storage.loot.LootPool; //导入依赖的package包/类
@SubscribeEvent
public static void onLootTableLoad(LootTableLoadEvent event) {
ResourceLocation tableName = event.getName();
LootPool pool = null;
int bandage = 0, plaster = 0, morphine = 0;
if (tableName.equals(LootTableList.CHESTS_SPAWN_BONUS_CHEST)) {
pool = event.getTable().getPool("main");
bandage = 8;
plaster = 16;
morphine = 4;
} else if (tableName.equals(LootTableList.CHESTS_STRONGHOLD_CORRIDOR) || tableName.equals(LootTableList.CHESTS_STRONGHOLD_CROSSING) || tableName.equals(LootTableList.CHESTS_ABANDONED_MINESHAFT)) {
pool = event.getTable().getPool("main");
bandage = 20;
plaster = 24;
morphine = 8;
}
if (pool != null) {
pool.addEntry(new LootEntryItem(FirstAidItems.BANDAGE, bandage, 0, new SetCount[]{new SetCount(new LootCondition[0], new RandomValueRange(1, 3))}, new LootCondition[0], FirstAid.MODID + "bandage"));
pool.addEntry(new LootEntryItem(FirstAidItems.PLASTER, plaster, 0, new SetCount[]{new SetCount(new LootCondition[0], new RandomValueRange(1, 5))}, new LootCondition[0], FirstAid.MODID + "plaster"));
pool.addEntry(new LootEntryItem(FirstAidItems.MORPHINE, morphine, 0, new SetCount[]{new SetCount(new LootCondition[0], new RandomValueRange(1, 2))}, new LootCondition[0], FirstAid.MODID + "morphine"));
}
}
示例3: onLootLoad
import net.minecraft.world.storage.loot.LootPool; //导入依赖的package包/类
@SubscribeEvent
public void onLootLoad(LootTableLoadEvent event) {
if (Config.enhancementBookLootLocationList.contains(event.getName())) {
String lootPoolId = LootHelper.VANILLA_LOOT_POOL_ID;
LootHelper.createPoolIfNotExists(event.getTable(), lootPoolId);
final LootPool lootPool = event.getTable().getPool(lootPoolId);
lootPool.addEntry(customLootEnhancementBook);
}
//TODO Rework this to only be caught in cold biomes
/*if(event.getName() == LootTableList.GAMEPLAY_FISHING_FISH){
String lootPoolId = LootHelper.VANILLA_LOOT_POOL_ID;
LootHelper.createPoolIfNotExists(event.getTable(), lootPoolId);
final LootPool lootPool = event.getTable().getPool(lootPoolId);
lootPool.addEntry(customLootWhiteFish);
}*/
}
示例4: onLootTableLoad
import net.minecraft.world.storage.loot.LootPool; //导入依赖的package包/类
@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent event) {
LootPool main = event.getTable().getPool(LOOTPOOLNAME);
if (main == null) {
//create my own. EX: mobs that have no drops (bats) also have empty loot table, so i have to inject an entry in the table before I fill it
event.getTable().addPool(new LootPool(new LootEntry[0], new LootCondition[0], new RandomValueRange(1F, 2F), new RandomValueRange(1F, 1F), LOOTPOOLNAME));
main = event.getTable().getPool(LOOTPOOLNAME);
if (main == null) {
ModCyclic.logger.error("could not insert Loot Pool for table :" + event.getName().toString());
return;
}
}
if (enableChestLoot) {
onLootChestTableLoad(main, event);
}
}
示例5: onLootTableLoad
import net.minecraft.world.storage.loot.LootPool; //导入依赖的package包/类
@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent event)
{
if (event.getName() == ModLootTables.common_chest)
{
event.setTable(new CustomLootTable(new LootPool[] { event.getTable().getPool("main") }));
}
if (event.getName() == ModLootTables.uncommon_chest)
{
event.setTable(new CustomLootTable(new LootPool[] { event.getTable().getPool("main") }));
}
if (event.getName() == ModLootTables.rare_chest)
{
event.setTable(new CustomLootTable(new LootPool[] { event.getTable().getPool("main") }));
}
if (event.getName() == ModLootTables.legendary_chest)
{
event.setTable(new CustomLootTable(new LootPool[] { event.getTable().getPool("main") }));
}
if (event.getName() == ModLootTables.exotic_chest)
{
event.setTable(new CustomLootTable(new LootPool[] { event.getTable().getPool("main") }));
}
changeVanillaTables(event);
}
示例6: addPool
import net.minecraft.world.storage.loot.LootPool; //导入依赖的package包/类
private static void addPool(LootTable table)
{
LootEntry common = new LootEntryTable(new ResourceLocation("lootslashconquer:chests/common_chest"), 60, 1, new LootCondition[0], "common");
LootEntry uncommon = new LootEntryTable(new ResourceLocation("lootslashconquer:chests/uncommon_chest"), 25, 1, new LootCondition[0], "uncommon");
LootEntry rare = new LootEntryTable(new ResourceLocation("lootslashconquer:chests/rare_chest"), 10, 1, new LootCondition[0], "rare");
LootEntry legendary = new LootEntryTable(new ResourceLocation("lootslashconquer:chests/legendary_chest"), 5, 1, new LootCondition[0], "legendary");
LootEntry exotic = new LootEntryTable(new ResourceLocation("lootslashconquer:chests/exotic_chest"), 2, 1, new LootCondition[0], "exotic");
LootPool pool = new LootPool(new LootEntry[] { common, uncommon, rare, legendary, exotic }, new LootCondition[0], new RandomValueRange(0, 1), new RandomValueRange(0), "loot");
table.addPool(pool);
}
示例7: lootLoaded
import net.minecraft.world.storage.loot.LootPool; //导入依赖的package包/类
@SubscribeEvent
public static void lootLoaded(LootTableLoadEvent event)
{
if (event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON))
{
LootTable customTable = event.getLootTableManager().getLootTableFromLocation(new ResourceLocation(BetterThanWeagles.MODID, "custom/simple_dungeon_chest"));
LootPool customPool = customTable.getPool("weagles");
event.getTable().addPool(customPool);
}
}
示例8: addTables
import net.minecraft.world.storage.loot.LootPool; //导入依赖的package包/类
@SubscribeEvent
public void addTables(LootTableLoadEvent event){
String name = event.getName().toString();
if(Randores.getConfigObj().getModules().isDungeonLoot()) {
if (is(name, chests)) {
event.getTable().addPool(new LootPool(new LootEntry[] {new RandoresLootEntry(1, 2, true, 10, 20, new LootCondition[0], "randores_flexible_loot_entry")}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "randores_flexible_pool"));
} else if (name.contains("end_city_treasure")) {
event.getTable().addPool(new LootPool(new LootEntry[] {new RandoresLootEntry(1, 5, true, 20, 50, new LootCondition[0], "randores_flexible_loot_entry")}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "randores_flexible_pool"));
} else if (name.contains("spawn_bonus_chest")) {
event.getTable().addPool(new LootPool(new LootEntry[] {new RandoresLootEntry(1, 1, false, 0, 0, new LootCondition[0], "randores_flexible_loot_entry")}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "randores_flexible_pool"));
}
}
}
示例9: onLootTablesLoaded
import net.minecraft.world.storage.loot.LootPool; //导入依赖的package包/类
@SubscribeEvent
public void onLootTablesLoaded(LootTableLoadEvent event) {
if ((event.getName().equals(LootTableList.CHESTS_ABANDONED_MINESHAFT)) || (event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) || (event.getName().equals(LootTableList.CHESTS_DESERT_PYRAMID)) || (event.getName().equals(LootTableList.CHESTS_NETHER_BRIDGE)) || (event.getName().equals(LootTableList.CHESTS_STRONGHOLD_LIBRARY)) || (event.getName().equals(LootTableList.CHESTS_END_CITY_TREASURE))) {
LootPool mainPool = event.getTable().getPool("main");
if (mainPool != null) {
if (event.getName().equals(LootTableList.CHESTS_ABANDONED_MINESHAFT) || event.getName().equals(LootTableList.CHESTS_NETHER_BRIDGE) || event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) {
mainPool.addEntry(new LootEntryItem(ModItems.FRIENDER_PEARL, 10, 0, new LootFunction[] {}, new LootCondition[0], ModGlobals.MODID + ":friender_pearl_loot"));
}
}
}
}
示例10: replaceCookedWithCharred
import net.minecraft.world.storage.loot.LootPool; //导入依赖的package包/类
private static void replaceCookedWithCharred(LootPool targetPool, Item targetItem, ItemStack replacementStack, int minCount, int maxCount)
{
List<LootFunction> charredFunctions = Lists.newArrayList();
if(replacementStack.getItemDamage() != 0) charredFunctions.add(LootUtil.createSetMetadata(replacementStack.getItemDamage()));
if(replacementStack.getTagCompound() != null) charredFunctions.add(LootUtil.createSetNBT(replacementStack.getTagCompound()));
charredFunctions.add(LootUtil.createCountFunction(minCount, maxCount));
charredFunctions.add(LootUtil.createLootingFunc(0, 1));
LootCondition notOnFire = new EntityHasProperty(new EntityProperty[] {new EntityOnFire(false)}, EntityTarget.THIS);
LootCondition onFire = new EntityHasProperty(new EntityProperty[] {new EntityOnFire(true)}, EntityTarget.THIS);
targetPool.removeEntry(targetItem.getRegistryName().toString());
targetPool.addEntry(new LootEntryItem(targetItem, 1, 1, new LootFunction[] {LootUtil.createCountFunction(1, 3), LootUtil.createLootingFunc(0, 1)}, new LootCondition[] {notOnFire}, targetItem.getRegistryName().toString()));
targetPool.addEntry(new LootEntryItem(replacementStack.getItem(), 1, 1, charredFunctions.toArray(new LootFunction[charredFunctions.size()]), new LootCondition[] {onFire}, ModMain.MODID + ":charred_+" + targetItem.getRegistryName().getResourcePath().toString()));
}
示例11: removeSmeltFunction
import net.minecraft.world.storage.loot.LootPool; //导入依赖的package包/类
private void removeSmeltFunction(LootPool pool, Item targetItem, Item replacement, int minCount, int maxCount)
{
LootCondition notOnFire = new EntityHasProperty(new EntityProperty[] {new EntityOnFire(false)}, EntityTarget.THIS);
LootCondition onFire = new EntityHasProperty(new EntityProperty[] {new EntityOnFire(true)}, EntityTarget.THIS);
pool.removeEntry(targetItem.getRegistryName().toString());
pool.addEntry(new LootEntryItem(targetItem, 1, 1, new LootFunction[] {LootUtil.createCountFunction(1, 3), LootUtil.createLootingFunc(0, 1)}, new LootCondition[] {notOnFire}, targetItem.getRegistryName().toString()));
pool.addEntry(new LootEntryItem(replacement, 1, 1, new LootFunction[] {LootUtil.createCountFunction(1, 3), LootUtil.createLootingFunc(0, 1)}, new LootCondition[] {onFire}, replacement.getRegistryName().toString()));
}
示例12: lootTableLoad
import net.minecraft.world.storage.loot.LootPool; //导入依赖的package包/类
@SubscribeEvent
public void lootTableLoad(final LootTableLoadEvent event) {
if (NemesisConfig.DISCOVERY_ENABLED && isLootTarget(event)) {
// TODO improve roll settings
String name = LOOT_TABLE.toString();
LootEntry entry = new LootEntryTable(LOOT_TABLE, 1, 0, new LootCondition[0], name);
RandomValueRange rolls = new RandomValueRange(0, 1);
LootPool pool = new LootPool(new LootEntry[] { entry }, new LootCondition[0], rolls, rolls, name);
event.getTable().addPool(pool);
}
}
示例13: tableToItemStacks
import net.minecraft.world.storage.loot.LootPool; //导入依赖的package包/类
/**
* Converts a LootTable to a list of possible drops, only looks for Item and metadata.
* @param table the loot table to get items from
* @return a LinkedList of the stacks in the loot table
*/
public static List<ItemStack> tableToItemStacks(LootTable table){
List<ItemStack> stacks = new LinkedList<>();
for(LootPool p:getPools(table)){
for(LootEntry entry:getEntries(p)){
if(entry instanceof LootEntryItem){
LootEntryItem ei = (LootEntryItem)entry;
Item item = getItem(ei);
LootFunction[] functs = getFunctions(ei);
boolean metaSet = false;
for(LootFunction func:functs){
if(func instanceof SetMetadata){
metaSet=true;
RandomValueRange range = (RandomValueRange)ReflectionHelper.getPrivateValue(SetMetadata.class, (SetMetadata)func, "metaRange","field_186573_b");
int meta = MathHelper.floor(range.getMin());
stacks.add(new ItemStack(item,1,meta));
}
}
if(!metaSet)stacks.add(new ItemStack(item));
}
/* won't bother with this case for now
else if(entry instanceof LootEntryTable){
//restart with that table
ResourceLocation location = (ResourceLocation) ReflectionHelper.getPrivateValue(LootEntryTable.class, (LootEntryTable)entry, "table","field_186371_a");
}
*/
}
}
return stacks;
}
示例14: addLoot
import net.minecraft.world.storage.loot.LootPool; //导入依赖的package包/类
@SubscribeEvent
public static void addLoot(LootTableLoadEvent event)
{
if(event.getName().equals(LootTableList.GAMEPLAY_FISHING_FISH))
{
//Add fishable fish
LootPool pool = event.getTable().getPool("main");
for(Map.Entry<Item, Integer> entry : MHItems.FISHABLE.entrySet())
addLoot(pool, entry.getKey(), entry.getValue());
}
}
示例15: onLootTableLoad
import net.minecraft.world.storage.loot.LootPool; //导入依赖的package包/类
@SubscribeEvent
public static void onLootTableLoad(LootTableLoadEvent e) {
final ResourceLocation rl = e.getName();
if (rl.equals(LootTableList.CHESTS_VILLAGE_BLACKSMITH) || rl.equals(LootTableList.CHESTS_ABANDONED_MINESHAFT) || rl.equals(LootTableList.CHESTS_JUNGLE_TEMPLE)) {
final LootTable lt = e.getTable();
LootPool lp = lt.getPool("pool0");
if (lp == null)
lp = lt.getPool("main");
if (lp != null) {
lp.addEntry(new LootEntryItem(MCFluxResources.UPCHIP, 20, 0, new LootFunction[0], new LootCondition[0], "mcflux:loot/upchip"));
}
}
}