本文整理汇总了Java中net.minecraft.world.storage.loot.LootContext.EntityTarget类的典型用法代码示例。如果您正苦于以下问题:Java EntityTarget类的具体用法?Java EntityTarget怎么用?Java EntityTarget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityTarget类属于net.minecraft.world.storage.loot.LootContext包,在下文中一共展示了EntityTarget类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import net.minecraft.world.storage.loot.LootContext.EntityTarget; //导入依赖的package包/类
@Override
public ItemStack apply(ItemStack stack, Random rand, LootContext context) {
Entity entity = context.getEntity(EntityTarget.THIS);
if (entity != null && entity instanceof EntityTF2Character)
stack.setItemDamage(18 + rand.nextInt(3) * 2 + ((EntityTF2Character) entity).getEntTeam());
return stack;
}
示例2: replaceCookedWithCharred
import net.minecraft.world.storage.loot.LootContext.EntityTarget; //导入依赖的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()));
}
示例3: removeSmeltFunction
import net.minecraft.world.storage.loot.LootContext.EntityTarget; //导入依赖的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()));
}
示例4: testCondition
import net.minecraft.world.storage.loot.LootContext.EntityTarget; //导入依赖的package包/类
@Override
public boolean testCondition(Random rand, LootContext context) {
Entity entity = context.getEntity(EntityTarget.THIS);
if(entity == null)return false;
World world = context.getWorld();
Biome biome = world.getBiomeForCoordsBody(new BlockPos(entity));
if(BiomeDictionary.hasType(biome, Type.COLD) || BiomeDictionary.hasType(biome, Type.SNOWY)){
return true;
}
return false;
}