本文整理匯總了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;
}