本文整理汇总了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;
}
示例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;
}
});
}
示例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);
}
示例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;
}
});
}
示例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();
}
});
}
示例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;
}
});
}
示例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;
}
});
}
示例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;
}
});
}
示例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;
}
});
}
示例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;
}
});
}
示例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;
}
});
}
示例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;
}
});
}
示例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);
}
});
}
示例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;
}
});
}
示例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);
}
});
}