本文整理汇总了Java中net.minecraft.client.entity.EntityPlayerSP.isPotionActive方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayerSP.isPotionActive方法的具体用法?Java EntityPlayerSP.isPotionActive怎么用?Java EntityPlayerSP.isPotionActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.entity.EntityPlayerSP
的用法示例。
在下文中一共展示了EntityPlayerSP.isPotionActive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClientTick
import net.minecraft.client.entity.EntityPlayerSP; //导入方法依赖的package包/类
@SubscribeEvent
public void onClientTick(TickEvent.RenderTickEvent event) {
if (event.phase != TickEvent.Phase.START) return;
EntityPlayerSP player = Minecraft.getMinecraft().player;
if (player==null) return; //We're not in-game
if (event.phase == TickEvent.Phase.START) {
FX.update(Minecraft.getMinecraft().world);
if (player.isPotionActive(Thermionics.POTION_TIPSY)) {
swayTheta += swaySpeed * event.renderTickTime;
int magnitude = player.getActivePotionEffect(Thermionics.POTION_TIPSY).getAmplifier();
if (magnitude>10) {
//TODO: Extra-magnitude effects. My idea of inducing nausea was vetoed by people clearly unfamiliar with the effects of ten forties of vodka.
}
if (player.movementInput.forwardKeyDown) {
//Modulate the player direction
float swayBase = MathHelper.cos(swayTheta);
float sway = swayAmplitudePerTipsy * player.getActivePotionEffect(Thermionics.POTION_TIPSY).getAmplifier() * swayBase;
player.rotationYaw += sway;
//player.cameraYaw += sway;
}
}
}
}
示例2: onUpdate
import net.minecraft.client.entity.EntityPlayerSP; //导入方法依赖的package包/类
@Override
public void onUpdate(EntityPlayerSP player) {
if(isEnabled()) {
if(player != null && !player.isPotionActive(Potion.getPotionById(16))) {
PotionEffect nightVision = new PotionEffect(Potion.getPotionById(16), Integer.MAX_VALUE, 0);
nightVision.setPotionDurationMax(true);
player.addPotionEffect(nightVision);
}
}
}