当前位置: 首页>>代码示例>>Java>>正文


Java EntityTarget类代码示例

本文整理汇总了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;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:8,代码来源:EntityBuildingFunction.java

示例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()));
   }
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:16,代码来源:BBEventHandler.java

示例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()));
   }
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:10,代码来源:BBEventHandler.java

示例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;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:12,代码来源:EventHandler.java


注:本文中的net.minecraft.world.storage.loot.LootContext.EntityTarget类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。