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


Java EntityPlayer.isInvisible方法代码示例

本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.isInvisible方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.isInvisible方法的具体用法?Java EntityPlayer.isInvisible怎么用?Java EntityPlayer.isInvisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.player.EntityPlayer的用法示例。


在下文中一共展示了EntityPlayer.isInvisible方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isValidTarget

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean isValidTarget(EntityPlayer p) {
    return (p.ticksExisted > 20)
            && (p.isEntityAlive())
            && (canPlayerSee(predict(p).up(p.getEyeHeight())))
            && (!p.isInvisible())
            && (isOnEnemyTeam(p))
            && (!Serenity.getInstance().getFriendManager().isFriend(p.getCommandSenderName()));
}
 
开发者ID:SerenityEnterprises,项目名称:SerenityCE,代码行数:9,代码来源:CopsVsCrims.java

示例2: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer living, EnumHand hand) {
	ItemStack stack=living.getHeldItem(hand);
	if (living.isInvisible() || (!isFeignDeath(stack, living) && stack.getItemDamage() < 528)) {
		this.setCloak(!WeaponsCapability.get(living).isInvisible(), stack, living, world);
		return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
	}
	else if(!living.isInvisible() && this.isFeignDeath(stack, living) && stack.getItemDamage() == 0) {
		WeaponsCapability.get(living).setFeign(!WeaponsCapability.get(living).isFeign());
		if(WeaponsCapability.get(living).isFeign())
			living.playSound(getSound(stack, PropertyType.CHARGE_SOUND), 1.0f, 1.0f);
		return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
	}
	return new ActionResult<ItemStack>(EnumActionResult.PASS, stack);
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:16,代码来源:ItemCloak.java

示例3: onRender

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void onRender(float partialTicks)
{
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	
	GL11.glPushMatrix();
	GL11.glTranslated(-mc.getRenderManager().renderPosX,
		-mc.getRenderManager().renderPosY,
		-mc.getRenderManager().renderPosZ);
	
	// set start position
	Vec3d start = RotationUtils.getClientLookVec()
		.addVector(0, WMinecraft.getPlayer().getEyeHeight(), 0)
		.addVector(mc.getRenderManager().renderPosX,
			mc.getRenderManager().renderPosY,
			mc.getRenderManager().renderPosZ);
	
	GL11.glBegin(GL11.GL_LINES);
	for(EntityPlayer entity : WMinecraft.getWorld().playerEntities)
	{
		if(entity == WMinecraft.getPlayer()
			|| entity instanceof EntityFakePlayer)
			continue;
		
		// fake entities with crazy vertical position
		if(Math.abs(entity.posY - WMinecraft.getPlayer().posY) > 1e6)
			continue;
		
		if(!wurst.special.targetSpf.sleepingPlayers.isChecked()
			&& entity.isPlayerSleeping())
			continue;
		
		if(!wurst.special.targetSpf.invisiblePlayers.isChecked()
			&& entity.isInvisible())
			continue;
		
		// set end position
		Vec3d end = entity.boundingBox.getCenter()
			.subtract(new Vec3d(entity.posX, entity.posY, entity.posZ)
				.subtract(entity.prevPosX, entity.prevPosY, entity.prevPosZ)
				.scale(1 - partialTicks));
		
		// set color
		if(wurst.friends.contains(entity.getName()))
			GL11.glColor4f(0, 0, 1, 0.5F);
		else
		{
			float factor =
				WMinecraft.getPlayer().getDistanceToEntity(entity) / 40F;
			if(factor > 1)
				factor = 1;
			
			GL11.glColor4f(2 - factor * 2F, factor * 2F, 0, 0.5F);
		}
		
		// draw line
		GL11.glVertex3d(start.xCoord, start.yCoord, start.zCoord);
		GL11.glVertex3d(end.xCoord, end.yCoord, end.zCoord);
	}
	GL11.glEnd();
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:77,代码来源:TracersMod.java

示例4: onRender

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void onRender(float partialTicks)
{
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	
	GL11.glPushMatrix();
	GL11.glTranslated(-mc.getRenderManager().renderPosX,
		-mc.getRenderManager().renderPosY,
		-mc.getRenderManager().renderPosZ);
	
	// draw boxes
	for(EntityPlayer entity : WMinecraft.getWorld().playerEntities)
	{
		if(entity == WMinecraft.getPlayer()
			|| entity instanceof EntityFakePlayer)
			continue;
		
		if(!wurst.special.targetSpf.sleepingPlayers.isChecked()
			&& entity.isPlayerSleeping())
			continue;
		
		if(!wurst.special.targetSpf.invisiblePlayers.isChecked()
			&& entity.isInvisible())
			continue;
		
		// set color
		if(wurst.friends.contains(entity.getName()))
			GL11.glColor4f(0, 0, 1, 0.5F);
		else
		{
			float factor =
				WMinecraft.getPlayer().getDistanceToEntity(entity) / 20F;
			if(factor > 2)
				factor = 2;
			GL11.glColor4f(2 - factor, factor, 0, 0.5F);
		}
		
		// set position
		GL11.glPushMatrix();
		GL11.glTranslated(
			entity.prevPosX
				+ (entity.posX - entity.prevPosX) * partialTicks,
			entity.prevPosY
				+ (entity.posY - entity.prevPosY) * partialTicks,
			entity.prevPosZ
				+ (entity.posZ - entity.prevPosZ) * partialTicks);
		
		// draw box
		RenderUtils.drawOutlinedBox(PLAYER_BOX);
		
		GL11.glPopMatrix();
	}
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:68,代码来源:PlayerEspMod.java

示例5: doRenderLayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
//func_177093_a(entity, f8, f7, partialTicks, f5, f4, f9, 0.0625F);
public void doRenderLayer(EntityPlayer player, float f, float f1, float renderTick, float f2, float f3, float f4, float f5)
{
    if(iChunUtil.hasMorphMod() && MorphApi.getApiImpl().hasMorph(player.getName(), Side.CLIENT) && (MorphApi.getApiImpl().morphProgress(player.getName(), Side.CLIENT) < 1.0F || !(MorphApi.getApiImpl().getMorphEntity(player.getEntityWorld(), player.getName(), Side.CLIENT) instanceof EntityPlayer)))
    {
        return;
    }
    if(!(player.isWearing(EnumPlayerModelParts.CAPE) && ((AbstractClientPlayer)player).getLocationCape() != null) && !player.isInvisible() && !player.isPlayerSleeping())
    {
        ItemStack is = BackTools.eventHandlerClient.playerTool.get(player.getName());

        ItemStack heldItem = player.getHeldItem(EnumHand.MAIN_HAND);
        if(!heldItem.isEmpty())
        {
            ItemStack is1 = heldItem.copy();
            is1.setItemDamage(0);
            heldItem = is1;
        }

        if(is != null && !is.isEmpty() && !ItemStack.areItemStacksEqual(is, heldItem))
        {
            GlStateManager.pushMatrix();

            GlStateManager.translate(0.0f, 0.35F, 0.16F);

            if(!player.inventory.armorItemInSlot(2).isEmpty())
            {
                GlStateManager.translate(0.0F, player.isSneaking() ? -0.1F : 0.0F, player.isSneaking() ? 0.025F : 0.06F);
            }
            if(player.isSneaking())
            {
                GlStateManager.translate(0F, 0.08F, 0.13F);
                GlStateManager.rotate(28.8F, 1.0F, 0.0F, 0.0F);
            }

            GlStateManager.rotate((float)(BackTools.getOrientation(is.getItem().getClass()) - 1) * -90F, 0.0F, 0.0F, 1.0F);

            GlStateManager.rotate(180F, 0.0F, 1.0F, 0.0F);

            GlStateManager.enableBlend();
            GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

            IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(is);
            RendererHelper.renderBakedModel(model, -1, is);

            GlStateManager.disableBlend();
            GlStateManager.enableLighting();
            GlStateManager.enableAlpha();

            GlStateManager.popMatrix();
        }
    }
}
 
开发者ID:iChun,项目名称:BackTools,代码行数:55,代码来源:LayerBackTool.java

示例6: getNearestAttackablePlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Nullable
public EntityPlayer getNearestAttackablePlayer(double posX, double posY, double posZ, double maxXZDistance, double maxYDistance, @Nullable Function<EntityPlayer, Double> playerToDouble, @Nullable Predicate<EntityPlayer> p_184150_12_)
{
    double d0 = -1.0D;
    EntityPlayer entityplayer = null;

    for (int i = 0; i < this.playerEntities.size(); ++i)
    {
        EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i);

        if (!entityplayer1.capabilities.disableDamage && entityplayer1.isEntityAlive() && !entityplayer1.isSpectator() && (p_184150_12_ == null || p_184150_12_.apply(entityplayer1)))
        {
            double d1 = entityplayer1.getDistanceSq(posX, entityplayer1.posY, posZ);
            double d2 = maxXZDistance;

            if (entityplayer1.isSneaking())
            {
                d2 = maxXZDistance * 0.800000011920929D;
            }

            if (entityplayer1.isInvisible())
            {
                float f = entityplayer1.getArmorVisibility();

                if (f < 0.1F)
                {
                    f = 0.1F;
                }

                d2 *= (double)(0.7F * f);
            }

            if (playerToDouble != null)
            {
                d2 *= ((Double)Objects.firstNonNull(playerToDouble.apply(entityplayer1), Double.valueOf(1.0D))).doubleValue();
            }

            if ((maxYDistance < 0.0D || Math.abs(entityplayer1.posY - posY) < maxYDistance * maxYDistance) && (maxXZDistance < 0.0D || d1 < d2 * d2) && (d0 == -1.0D || d1 < d0))
            {
                d0 = d1;
                entityplayer = entityplayer1;
            }
        }
    }

    return entityplayer;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:48,代码来源:World.java

示例7: getNearestAttackablePlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Nullable
public EntityPlayer getNearestAttackablePlayer(double posX, double posY, double posZ, double maxXZDistance, double maxYDistance, @Nullable Function<EntityPlayer, Double> playerToDouble, @Nullable Predicate<EntityPlayer> p_184150_12_)
{
    double d0 = -1.0D;
    EntityPlayer entityplayer = null;

    for (int i = 0; i < this.playerEntities.size(); ++i)
    {
        EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i);

        if (!entityplayer1.capabilities.disableDamage && entityplayer1.isEntityAlive() && !entityplayer1.isSpectator() && (p_184150_12_ == null || p_184150_12_.apply(entityplayer1)))
        {
            double d1 = entityplayer1.getDistanceSq(posX, entityplayer1.posY, posZ);
            double d2 = maxXZDistance;

            if (entityplayer1.isSneaking())
            {
                d2 = maxXZDistance * 0.800000011920929D;
            }

            if (entityplayer1.isInvisible())
            {
                float f = entityplayer1.getArmorVisibility();

                if (f < 0.1F)
                {
                    f = 0.1F;
                }

                d2 *= (double)(0.7F * f);
            }

            if (playerToDouble != null)
            {
                d2 *= ((Double)Objects.firstNonNull(playerToDouble.apply(entityplayer1), Double.valueOf(1.0D))).doubleValue();
            }
            d2 = net.minecraftforge.common.ForgeHooks.getPlayerVisibilityDistance(entityplayer1, d2, maxXZDistance);
            if ((maxYDistance < 0.0D || Math.abs(entityplayer1.posY - posY) < maxYDistance * maxYDistance) && (maxXZDistance < 0.0D || d1 < d2 * d2) && (d0 == -1.0D || d1 < d0))
            {
                d0 = d1;
                entityplayer = entityplayer1;
            }
        }
    }

    return entityplayer;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:48,代码来源:World.java


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