當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。