本文整理汇总了Java中net.minecraft.entity.EntityLivingBase.isInWater方法的典型用法代码示例。如果您正苦于以下问题:Java EntityLivingBase.isInWater方法的具体用法?Java EntityLivingBase.isInWater怎么用?Java EntityLivingBase.isInWater使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.EntityLivingBase
的用法示例。
在下文中一共展示了EntityLivingBase.isInWater方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUpdate
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (entityIn instanceof EntityLivingBase) {
EntityLivingBase entity = (EntityLivingBase) entityIn;
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
if (entity.isInWater()) {
entity.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 20 , 5 , false, false));
entity.addPotionEffect(new PotionEffect(MobEffects.WATER_BREATHING, 20 , 5 , false, false));
player.capabilities.disableDamage = true;
} else {
player.capabilities.disableDamage = false;
}
}
}
}
示例2: apply
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) {
if (entity.moveForward > 0F && (!(entity instanceof EntityPlayer) || !((EntityPlayer) entity).capabilities.isFlying)) {
if (entity.isInWater()) {
if (BrewStorageHandler.isBrewActive(entity, ModBrews.PATH_OF_THE_DEEP)) {
entity.moveRelative(0F, 0.5F, 0.085F, 0.85F);
}
}
}
}
示例3: livingUpdate
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@SubscribeEvent
public void livingUpdate(LivingUpdateEvent event) {
EntityLivingBase living = event.getEntityLiving();
if(living.hasCapability(RIG.RIG_ITEM, null)) {
ItemStack rig = living.getCapability(RIG.RIG_ITEM, null).getStackInSlot(0);
if(rig.hasTagCompound() && living.isInWater()) {
int extraair = 100 + RIGUpgrade.upgradesMap.get("Air").getAttributeValue(rig) * 100;
if (living.getRNG().nextInt(300+extraair)>=300) {
living.setAir(living.getAir()+1);
}
}
}
}
示例4: apply
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) {
if (entity.isInWater() && entity.motionY > 0)
entity.motionY *= -10;
}