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