當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityPlayerSP類代碼示例

本文整理匯總了Java中net.minecraft.client.entity.EntityPlayerSP的典型用法代碼示例。如果您正苦於以下問題:Java EntityPlayerSP類的具體用法?Java EntityPlayerSP怎麽用?Java EntityPlayerSP使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EntityPlayerSP類屬於net.minecraft.client.entity包,在下文中一共展示了EntityPlayerSP類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onRenderWorld

import net.minecraft.client.entity.EntityPlayerSP; //導入依賴的package包/類
public static void onRenderWorld(RenderWorldLastEvent event) {
//        EntityPlayerSP player = Minecraft.getMinecraft().player;
//        if (player.getHeldItem(EnumHand.MAIN_HAND).isEmpty()) {
//            return;
//        }

//        if (player.getHeldItem(EnumHand.MAIN_HAND).getItem() != ModItems.radiationMonitorItem) {
//            return;
//        }


        if (cleanAir != null) {
            EntityPlayerSP p = Minecraft.getMinecraft().player;
            if (hasGlasses()) {
                int cnt = cleanAir.size();
                if (cnt != prevCnt) {
                    System.out.println("cleanAir = " + cnt);
                    prevCnt = cnt;
                }
                renderHighlightedBlocks(event, p, cleanAir);
            }
        }
    }
 
開發者ID:McJty,項目名稱:needtobreath,代碼行數:24,代碼來源:NTBOverlayRenderer.java

示例2: onUpdate

import net.minecraft.client.entity.EntityPlayerSP; //導入依賴的package包/類
@Override
public void onUpdate(EntityPlayerSP player) {
	if(isEnabled()) {
		currentMS = System.nanoTime() / 1000000;
		if(hasDelayRun((long)(1000 / crystalSpeed.getValue())))
		{
			for (Entity e : Wrapper.getWorld().loadedEntityList) {
				if (player.getDistanceToEntity(e) < crystalRange.getValue()) {
					if (e instanceof EntityEnderCrystal) {
						Wrapper.getMinecraft().playerController.attackEntity(player, e);
						player.swingArm(EnumHand.MAIN_HAND);
						lastMS = System.nanoTime() / 1000000;
						break;
					}
				}
			}
		}
	}
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:20,代碼來源:CrystalAura.java

示例3: sendChanges

import net.minecraft.client.entity.EntityPlayerSP; //導入依賴的package包/類
private void sendChanges()
{
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
    if (player == null)
        return;

    // Send any changes requested over the wire to the server:
    double x = this.setX ? this.x : 0;
    double y = this.setY ? this.y : 0;
    double z = this.setZ ? this.z : 0;
    float yaw = this.setYaw ? this.rotationYaw : 0;
    float pitch = this.setPitch ? this.rotationPitch : 0;

    if (this.setX || this.setY || this.setZ || this.setYaw || this.setPitch)
    {
        MalmoMod.network.sendToServer(new TeleportMessage(x, y, z, yaw, pitch, this.setX, this.setY, this.setZ, this.setYaw, this.setPitch));
        if (this.setYaw || this.setPitch)
        {
            // Send a message that the ContinuousMovementCommands can pick up on:
            Event event = new CommandForWheeledRobotNavigationImplementation.ResetPitchAndYawEvent(this.setYaw, this.rotationYaw, this.setPitch, this.rotationPitch);
            MinecraftForge.EVENT_BUS.post(event);
        }
        this.setX = this.setY = this.setZ = this.setYaw = this.setPitch = false;
    }
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:26,代碼來源:AbsoluteMovementCommandsImplementation.java

示例4: renderBlocks

import net.minecraft.client.entity.EntityPlayerSP; //導入依賴的package包/類
private static void renderBlocks(RenderWorldLastEvent evt, Set<BlockPos> blocks) {
    EntityPlayerSP player = MinecraftTools.getPlayer(Minecraft.getMinecraft());

    double doubleX = player.lastTickPosX + (player.posX - player.lastTickPosX) * evt.getPartialTicks();
    double doubleY = player.lastTickPosY + (player.posY - player.lastTickPosY) * evt.getPartialTicks();
    double doubleZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * evt.getPartialTicks();

    GlStateManager.pushMatrix();
    GlStateManager.translate(-doubleX, -doubleY, -doubleZ);

    GlStateManager.disableDepth();
    GlStateManager.enableTexture2D();

    for (BlockPos pos : blocks) {
        renderBoxOutline(pos);
    }

    GlStateManager.enableDepth();

    GlStateManager.popMatrix();
}
 
開發者ID:McJty,項目名稱:interactionwheel,代碼行數:22,代碼來源:RenderHandler.java

示例5: doRender

import net.minecraft.client.entity.EntityPlayerSP; //導入依賴的package包/類
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doe
 */
public void doRender(AbstractClientPlayer entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    if (!entity.isUser() || this.renderManager.livingPlayer == entity)
    {
        double d0 = y;

        if (entity.isSneaking() && !(entity instanceof EntityPlayerSP))
        {
            d0 = y - 0.125D;
        }

        this.setModelVisibilities(entity);
        super.doRender(entity, x, d0, z, entityYaw, partialTicks);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:22,代碼來源:RenderPlayer.java

示例6: call

import net.minecraft.client.entity.EntityPlayerSP; //導入依賴的package包/類
@Override
public void call(String[] args) throws CmdException
{
	if(args.length > 0)
		throw new CmdSyntaxError();
	
	// check for creative mode
	EntityPlayerSP player = WMinecraft.getPlayer();
	if(!player.capabilities.isCreativeMode)
		throw new CmdError("Creative mode only.");
	
	// validate item
	ItemStack item = player.inventory.getCurrentItem();
	if(item == null)
		throw new CmdError("You need an item in your hand.");
	if(!item.isItemStackDamageable())
		throw new CmdError("This item can't take damage.");
	if(!item.isItemDamaged())
		throw new CmdError("This item is not damaged.");
	
	// repair item
	item.setItemDamage(0);
	WConnection.sendPacket(new CPacketCreativeInventoryAction(
		36 + player.inventory.currentItem, item));
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:26,代碼來源:RepairCmd.java

示例7: drawBeacon

import net.minecraft.client.entity.EntityPlayerSP; //導入依賴的package包/類
public static void drawBeacon(BlockPos pos, int color, int colorIn, float partialTicks) {
    GlStateManager.pushMatrix();
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
    double x = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks;
    double y = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks;
    double z = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks;
    GL11.glLineWidth((float)1.0f);
    AxisAlignedBB var11 = new AxisAlignedBB((double)(pos.getX() + 1), (double)pos.getY(), (double)(pos.getZ() + 1), (double)pos.getX(), (double)(pos.getY() + 200), (double)pos.getZ());
    AxisAlignedBB var12 = new AxisAlignedBB(var11.minX - x, var11.minY - y, var11.minZ - z, var11.maxX - x, var11.maxY - y, var11.maxZ - z);
    if (color != 0) {
        GlStateManager.disableDepth();
        RenderUtils.filledBox(var12, colorIn, true);
        RenderUtils.disableLighting();
        drawOutlinedBoundingBox((AxisAlignedBB)var12, (int)color);
    }
    GlStateManager.popMatrix();
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:18,代碼來源:RenderUtils.java

示例8: onUpdate

import net.minecraft.client.entity.EntityPlayerSP; //導入依賴的package包/類
@Override
public void onUpdate(EntityPlayerSP player) {
       ItemStack curStack = player.inventory.getCurrentItem();
       
	if(isEnabled()) {
		
		if(!shouldEat()) {
			Wrapper.getMinecraft().gameSettings.keyBindUseItem.pressed = false;
			return;
		}
			
		FoodStats foodStats = player.getFoodStats();
           if (foodStats.getFoodLevel() <= hungerFactor.getValue() && shouldEat()) 
           {
           	eatFood();
           }
	}
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:19,代碼來源:AutoEat.java

示例9: drawBeacon

import net.minecraft.client.entity.EntityPlayerSP; //導入依賴的package包/類
public static void drawBeacon(BlockPos pos, int color, int colorIn, float partialTicks) {
    GlStateManager.pushMatrix();
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
    double x = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks;
    double y = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks;
    double z = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks;
    GL11.glLineWidth((float)1.0f);
    AxisAlignedBB var11 = new AxisAlignedBB((double)(pos.getX() + 1), (double)pos.getY(), (double)(pos.getZ() + 1), (double)pos.getX(), (double)(pos.getY() + 200), (double)pos.getZ());
    AxisAlignedBB var12 = new AxisAlignedBB(var11.minX - x, var11.minY - y, var11.minZ - z, var11.maxX - x, var11.maxY - y, var11.maxZ - z);
    if (color != 0) {
        GlStateManager.disableDepth();
        RenderUtils.filledBox(var12, colorIn);
        RenderUtils.disableLighting();
        drawOutlinedBoundingBox((AxisAlignedBB)var12, (int)color);
    }
    GlStateManager.popMatrix();
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:18,代碼來源:RenderUtils.java

示例10: onItemRightClick

import net.minecraft.client.entity.EntityPlayerSP; //導入依賴的package包/類
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
	ItemStack stack = player.getHeldItem(hand); //Not entirely convinced it works
	RayTraceResult result = world.isRemote ? RayTraceHelper.tracePlayerHighlight((EntityPlayerSP) player) : RayTraceHelper.tracePlayerHighlight((EntityPlayerMP) player);
	if(result.typeOfHit != RayTraceResult.Type.BLOCK) {
		if(!world.isRemote) {
			Vector3 vec = Vector3.create(player.posX, player.posY + player.getEyeHeight(), player.posZ);
			vec.add(Vector3.create(player.getLookVec()).multiply(2.5D));
			BlockPos pos = new BlockPos(vec.toVec3d());
			IBlockState replaced = world.getBlockState(pos);
			if(world.isAirBlock(pos) || replaced.getBlock().isReplaceable(world, pos)) {
				IBlockState state = ModBlocks.ANGSTROM.getDefaultState();
				SoundType type = ModBlocks.ANGSTROM.getSoundType(state, world, pos, player);
				world.setBlockState(pos, state);
				world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), type.getPlaceSound(), SoundCategory.BLOCKS, 0.75F, 0.8F);
			}
			if(!player.capabilities.isCreativeMode) {
				stack.shrink(1);
			}
		}
		return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
	}
	return ActionResult.newResult(EnumActionResult.PASS, stack);
}
 
開發者ID:ArekkuusuJerii,項目名稱:Solar,代碼行數:25,代碼來源:ItemAngstrom.java

示例11: getTouchingBlocks

import net.minecraft.client.entity.EntityPlayerSP; //導入依賴的package包/類
public static List<BlockPos> getTouchingBlocks(EntityPlayerSP player)
{
	// Determine which blocks we are touching.
	// This code is adapted from Entity, where it is used to fire the Block.onEntityCollidedWithBlock methods.
	BlockPos blockposmin = new BlockPos(player.getEntityBoundingBox().minX - 0.001D, player.getEntityBoundingBox().minY - 0.001D, player.getEntityBoundingBox().minZ - 0.001D);
    BlockPos blockposmax = new BlockPos(player.getEntityBoundingBox().maxX + 0.001D, player.getEntityBoundingBox().maxY + 0.001D, player.getEntityBoundingBox().maxZ + 0.001D);
    List<BlockPos> blocks = new ArrayList<BlockPos>();
    
    if (player.worldObj.isAreaLoaded(blockposmin, blockposmax))
    {
        for (int i = blockposmin.getX(); i <= blockposmax.getX(); ++i)
        {
            for (int j = blockposmin.getY(); j <= blockposmax.getY(); ++j)
            {
                for (int k = blockposmin.getZ(); k <= blockposmax.getZ(); ++k)
                {
                    blocks.add(new BlockPos(i, j, k));
                }
            }
        }
    }
    return blocks;
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:24,代碼來源:PositionHelper.java

示例12: install

import net.minecraft.client.entity.EntityPlayerSP; //導入依賴的package包/類
@Override
public void install(MissionInit missionInit)
{
    // Create our movement hook, which allows us to override the Minecraft movement.
    this.overrideMovement = new MovementHook(Minecraft.getMinecraft().gameSettings);
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
    if (player != null)
    {
        // Insert it into the player, keeping a record of the original movement object
        // so we can restore it later.
        this.originalMovement = player.movementInput;
        player.movementInput = this.overrideMovement;
    }
    
    FMLCommonHandler.instance().bus().register(this);
    MinecraftForge.EVENT_BUS.register(this);
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:18,代碼來源:CommandForWheeledRobotNavigationImplementation.java

示例13: calculateReward

import net.minecraft.client.entity.EntityPlayerSP; //導入依賴的package包/類
private void calculateReward(MultidimensionalReward reward)
{
    // Determine what blocks we are touching.
    // This code is largely cribbed from Entity, where it is used to fire the Block.onEntityCollidedWithBlock methods.
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;

    List<BlockPos> touchingBlocks = PositionHelper.getTouchingBlocks(player);
    for (BlockPos pos : touchingBlocks) {
        IBlockState iblockstate = player.worldObj.getBlockState(pos);
        for (BlockMatcher bm : this.matchers) {
            if (bm.applies(pos) && bm.matches(pos, iblockstate))
            {
                float reward_value = bm.reward();
                float adjusted_reward = adjustAndDistributeReward(reward_value, this.params.getDimension(), bm.spec.getDistribution());
                reward.add( this.params.getDimension(), adjusted_reward );
            }
        }
    }
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:20,代碼來源:RewardForTouchingBlockTypeImplementation.java

示例14: getInventoryJSON

import net.minecraft.client.entity.EntityPlayerSP; //導入依賴的package包/類
public static void getInventoryJSON(JsonObject json, String prefix, int maxSlot)
{
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
    int nSlots = Math.min(player.inventory.getSizeInventory(), maxSlot);
    for (int i = 0; i < nSlots; i++)
    {
        ItemStack is = player.inventory.getStackInSlot(i);
        if (is != null)
        {
            json.addProperty(prefix + i + "_size", is.stackSize);
            DrawItem di = MinecraftTypeHelper.getDrawItemFromItemStack(is);
            String name = di.getType();
            if (di.getColour() != null)
                json.addProperty(prefix + i + "_colour",  di.getColour().value());
            if (di.getVariant() != null)
                json.addProperty(prefix + i + "_variant", di.getVariant().getValue());
            json.addProperty(prefix + i + "_item", name);
        }
    }        
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:21,代碼來源:ObservationFromFullInventoryImplementation.java

示例15: onRender

import net.minecraft.client.entity.EntityPlayerSP; //導入依賴的package包/類
@Override
public void onRender() {
	if(isEnabled()) {
		for(Entity ep : Wrapper.getWorld().loadedEntityList) {
			if(ep instanceof EntityPlayerSP) continue;
			if(ep instanceof EntityPlayer) {
				double d = ep.lastTickPosX + (ep.posX - ep.lastTickPosX) * (double)Wrapper.getMinecraft().timer.renderPartialTicks;
				double d1 = ep.lastTickPosY + (ep.posY - ep.lastTickPosY) * (double)Wrapper.getMinecraft().timer.renderPartialTicks;
				double d2 = ep.lastTickPosZ + (ep.posZ - ep.lastTickPosZ) * (double)Wrapper.getMinecraft().timer.renderPartialTicks;
				if(Wrapper.getFriends().isFriend(((EntityPlayer)ep).getName())) {
					GL11.glColor4f(0.15F, 0.15F, 1.0F, 1.0F);
				} else {
					if(Wrapper.getPlayer().getDistanceToEntity(ep) >= 64) {
						GL11.glColor4f(0.0F, 1.0F, 0.0F, 1.0F);
					} else {
						GL11.glColor4f(1.0F, Wrapper.getPlayer().getDistanceToEntity(ep) / 150, 0.0F, 1.0F);
					}
				}
				RenderUtils.drawSphere(d, d1, d2, KillAura.auraRange.getValue(), 20, 15);
			}
		}
	}
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:24,代碼來源:HitSpheres.java


注:本文中的net.minecraft.client.entity.EntityPlayerSP類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。