当前位置: 首页>>代码示例>>Java>>正文


Java EntityPlayerSP.isPotionActive方法代码示例

本文整理汇总了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;
			}
		}
	}
}
 
开发者ID:elytra,项目名称:Thermionics,代码行数:31,代码来源:ClientProxy.java

示例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);
		}
	}
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:11,代码来源:Fullbright.java


注:本文中的net.minecraft.client.entity.EntityPlayerSP.isPotionActive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。