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


Java IItemPropertyGetter类代码示例

本文整理汇总了Java中net.minecraft.item.IItemPropertyGetter的典型用法代码示例。如果您正苦于以下问题:Java IItemPropertyGetter类的具体用法?Java IItemPropertyGetter怎么用?Java IItemPropertyGetter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IItemPropertyGetter类属于net.minecraft.item包,在下文中一共展示了IItemPropertyGetter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: matchesItemStack

import net.minecraft.item.IItemPropertyGetter; //导入依赖的package包/类
boolean matchesItemStack(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase livingEntity)
{
    Item item = stack.getItem();

    for (Entry<ResourceLocation, Float> entry : this.mapResourceValues.entrySet())
    {
        IItemPropertyGetter iitempropertygetter = item.getPropertyGetter((ResourceLocation)entry.getKey());

        if (iitempropertygetter == null || iitempropertygetter.apply(stack, worldIn, livingEntity) < ((Float)entry.getValue()).floatValue())
        {
            return false;
        }
    }

    return true;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:ItemOverride.java

示例2: ItemKnife

import net.minecraft.item.IItemPropertyGetter; //导入依赖的package包/类
public ItemKnife() {
	super();
	this.addPropertyOverride(new ResourceLocation("backstab"), new IItemPropertyGetter() {
		@Override
		@SideOnly(Side.CLIENT)
		public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
			if (entityIn == Minecraft.getMinecraft().player && Minecraft.getMinecraft().objectMouseOver != null
					&& Minecraft.getMinecraft().objectMouseOver.entityHit != null
					&& Minecraft.getMinecraft().objectMouseOver.entityHit
							.getDistanceSqToEntity(entityIn) <= getMaxRange(stack) * getMaxRange(stack)
					&& isBackstab(entityIn, Minecraft.getMinecraft().objectMouseOver.entityHit))
				return 1;
			return 0;
		}
	});
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:17,代码来源:ItemKnife.java

示例3: ItemBowAdvanced

import net.minecraft.item.IItemPropertyGetter; //导入依赖的package包/类
public ItemBowAdvanced() {
	super();
	this.setMaxDamage(1536);
	this.addPropertyOverride(new ResourceLocation("pull"), new IItemPropertyGetter() {
		@SideOnly(Side.CLIENT)
		public float apply(ItemStack s, World world, EntityLivingBase e) {
			if (e == null) {
				return 0.0F;
			} else {
				ItemStack stack = e.getActiveItemStack();
				return stack != null && stack.getItem() == ItemBowAdvanced.this ? (float)(s.getMaxItemUseDuration() - e.getItemInUseCount()) / 10.0F : 0.0F;
			}
		}
	});
	this.setCreativeTab(ACCreativeTabs.main);
}
 
开发者ID:sblectric,项目名称:AdvancedCombat,代码行数:17,代码来源:ItemBowAdvanced.java

示例4: AnimalPackageItem

import net.minecraft.item.IItemPropertyGetter; //导入依赖的package包/类
public AnimalPackageItem() {
    super("animal_package");

    this.addPropertyOverride(new ResourceLocation("hasAnimal"), new IItemPropertyGetter()
    {
        @SideOnly(Side.CLIENT)
        public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
        {
            NBTTagCompound nbt = ItemStackUtil.isEmpty(stack) ? null : stack.getTagCompound();
            if ((nbt != null) && (nbt.getInteger("hasAnimal") == 1)) {
                return 1;
            }
            return 0;
        }
    });
}
 
开发者ID:faceofcat,项目名称:Mekfarm,代码行数:17,代码来源:AnimalPackageItem.java

示例5: ItemHotSword

import net.minecraft.item.IItemPropertyGetter; //导入依赖的package包/类
public ItemHotSword(String name) {
    super(ToolMaterial.IRON);
    this.name = name;
    setUnlocalizedName(name);
    setRegistryName(name);
    setMaxDamage(3);

    RTK.proxy.registerItemRenderer(this, 0, name);

    addPropertyOverride(new ResourceLocation("heat"), new IItemPropertyGetter() {
        @Override
        @SideOnly(Side.CLIENT)
        public float apply(ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity) {
            return stack.getMetadata();
        }
    });
}
 
开发者ID:KodyJKing,项目名称:RandomToolKit,代码行数:18,代码来源:ItemHotSword.java

示例6: ItemMug

import net.minecraft.item.IItemPropertyGetter; //导入依赖的package包/类
public ItemMug()
{
    super(CAPACITY);
    this.setHasSubtypes(true);
    this.setMaxStackSize(MAX_STACK_SIZE);
    this.addPropertyOverride(new ResourceLocation("fillmodel"),new IItemPropertyGetter(){
        @Override
        public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
            CaskLiquid liquid = getCaskLiquid(stack);
            if (liquid != null) return liquid.model;

            return 0;
        }
    });
}
 
开发者ID:DaedalusGame,项目名称:Soot,代码行数:16,代码来源:ItemMug.java

示例7: ItemThirstQuencher

import net.minecraft.item.IItemPropertyGetter; //导入依赖的package包/类
public ItemThirstQuencher() {
	super(Options.THIRST_QUENCHER_RF_CAPACITY, Options.THIRST_QUENCHER_RF_CAPACITY, 40, NAME);
	setCreativeTab(ModCreativeTab.TAB);
	FLUID_CAPACITY = (Options.THIRST_QUENCHER_WATER_CAPACITY < 8 ? 8 : Options.THIRST_QUENCHER_WATER_CAPACITY) * 1000;
	addPropertyOverride(new ResourceLocation("filllevel"), new IItemPropertyGetter() {
		@Override
		public float apply(ItemStack stack, World world, EntityLivingBase entity) {
			return (getFluidStored(stack) / 1000) / 2;
		}
	});
}
 
开发者ID:p455w0rd,项目名称:ToughExpansion,代码行数:12,代码来源:ItemThirstQuencher.java

示例8: PatternItem

import net.minecraft.item.IItemPropertyGetter; //导入依赖的package包/类
public PatternItem() {
	super("pattern");
	setMaxStackSize(1);
	this.addPropertyOverride(new ResourceLocation("defieritem"), new IItemPropertyGetter()
       {
           @SideOnly(Side.CLIENT)
           public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
           {
               if(!stack.hasTagCompound() || !stack.getTagCompound().hasKey("defieritem"))return 0f;
               return 1f;
           }
       });
}
 
开发者ID:tiffit,项目名称:Defier,代码行数:14,代码来源:PatternItem.java

示例9: ItemWeapon

import net.minecraft.item.IItemPropertyGetter; //导入依赖的package包/类
public ItemWeapon() {
	super();
	this.addPropertyOverride(new ResourceLocation("inhand"), new IItemPropertyGetter() {
		@Override
		@SideOnly(Side.CLIENT)
		public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
			if (entityIn != null && inHand)
				return 1;
			return 0;
		}
	});
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:13,代码来源:ItemWeapon.java

示例10: ItemCloak

import net.minecraft.item.IItemPropertyGetter; //导入依赖的package包/类
public ItemCloak() {
	super();
	this.addPropertyOverride(new ResourceLocation("active"), new IItemPropertyGetter() {
		@Override
		@SideOnly(Side.CLIENT)
		public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
			if (entityIn != null && isFeignDeath(stack, entityIn) && WeaponsCapability.get(entityIn).isFeign())
				return 1;
			return 0;
		}
	});
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:13,代码来源:ItemCloak.java

示例11: ItemJar

import net.minecraft.item.IItemPropertyGetter; //导入依赖的package包/类
public ItemJar() {
	super();
	this.setMaxStackSize(64);
	this.addPropertyOverride(new ResourceLocation("empty"), new IItemPropertyGetter() {
		@Override
		@SideOnly(Side.CLIENT)
		public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
			if (stack.getTagCompound().getBoolean("IsEmpty"))
				return 1;
			return 0;
		}
	});
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:14,代码来源:ItemJar.java

示例12: ItemMinigun

import net.minecraft.item.IItemPropertyGetter; //导入依赖的package包/类
public ItemMinigun() {
	super();
	this.addPropertyOverride(new ResourceLocation("spin"), new IItemPropertyGetter() {
		@Override
		@SideOnly(Side.CLIENT)
		public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
			if (entityIn != null && entityIn.hasCapability(TF2weapons.WEAPONS_CAP, null) && entityIn.getCapability(TF2weapons.WEAPONS_CAP, null).chargeTicks > 0)
				return 1;
			return 0;
		}
	});
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:13,代码来源:ItemMinigun.java

示例13: ItemUHCCompass

import net.minecraft.item.IItemPropertyGetter; //导入依赖的package包/类
public ItemUHCCompass()
{
    this.addPropertyOverride(new ResourceLocation("angle"), new IItemPropertyGetter()
    {
        @SideOnly(Side.CLIENT)
        double rotation;
        @SideOnly(Side.CLIENT)
        double rota;
        @SideOnly(Side.CLIENT)
        long lastUpdateTick;
        @SideOnly(Side.CLIENT)
        @Override
        public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
        {
            Entity entity = Minecraft.getMinecraft().player;

            if (worldIn == null)
                worldIn = entity.world;

            double d0;

            double d1 = (double)entity.rotationYaw;
            d1 = d1 % 360.0D;
            double d2 = this.getSpawnToAngle(worldIn, entity);
            d0 = Math.PI - ((d1 - 90.0D) * 0.01745329238474369D - d2);

            float f = (float)(d0 / (Math.PI * 2D));
            return MathHelper.positiveModulo(f, 1.0F);
        }
        @SideOnly(Side.CLIENT)
        private double getSpawnToAngle(World p_185092_1_, Entity p_185092_2_)
        {
            BlockPos blockpos = new BlockPos(ConfigValues.TARGETX, 1, ConfigValues.TARGETZ);
            return Math.atan2((double)blockpos.getZ() - p_185092_2_.posZ, (double)blockpos.getX() - p_185092_2_.posX);
        }
    });
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:UHC-Compass,代码行数:38,代码来源:ItemUHCCompass.java

示例14: ItemMonument

import net.minecraft.item.IItemPropertyGetter; //导入依赖的package包/类
public ItemMonument() {
    super();

    this.addPropertyOverride(new ResourceLocation("minecraft:blocking"), new IItemPropertyGetter(){

        @SideOnly(value= Side.CLIENT)
        @Override
        public float apply(ItemStack itemStack, @Nullable World world, @Nullable EntityLivingBase entityLivingBase) {
            return entityLivingBase != null && entityLivingBase.isHandActive() && entityLivingBase.getActiveItemStack() == itemStack ? 1.0f : 0.0f;
        }
    });
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:13,代码来源:ItemMonument.java

示例15: ItemBaseSword

import net.minecraft.item.IItemPropertyGetter; //导入依赖的package包/类
public ItemBaseSword(ToolMaterial material, String regName)
{
	super(material);
	this.setRegistryName(regName);
	this.setUnlocalizedName(this.getRegistryName().toString());
	this.setCreativeTab(FyrestoneCreativeTabs.tabFyrestone);
	this.addPropertyOverride(new ResourceLocation("sword"), new IItemPropertyGetter()
	{
	    @SideOnly(Side.CLIENT)
	    public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
	    {
	        return ItemNBTHelper.getInt(stack, "sword_type", 0);
	    }
	});
}
 
开发者ID:gunnerwolf,项目名称:Fyrestone,代码行数:16,代码来源:ItemBaseSword.java


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