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


Java EntityPlayer.getAir方法代码示例

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


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

示例1: onArmorTick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Optional.Method(modid = Compats.IC2)
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack)
{
	boolean shouldUpdate = false;
	
	// If we wear some air mask on head.
	if (this.isAirMask && this.armorType == EntityEquipmentSlot.HEAD)
	{
		// Default max value is 300
		
		if ((player.getAir() <= minAirToStartRefil) && (player.inventory.hasItemStack(ItemsCG.ic2AirCell)))
		{
			consumeItemFromInventory(player, ItemsCG.ic2AirCell);
	        player.inventory.addItemStackToInventory(new ItemStack(ItemsCG.ic2EmptyCell.getItem()));
	        player.setAir(300);
	        shouldUpdate = true;
		}
	}
	
	// If we have changed inventory contents then we should sync it on client.
	if (shouldUpdate) {
		player.inventoryContainer.detectAndSendChanges();
	}
}
 
开发者ID:TwilightWingsStudio,项目名称:CompositeGear,代码行数:26,代码来源:ItemCGArmor.java

示例2: renderAir

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
protected void renderAir(int width, int height)
{
    if (pre(AIR)) return;
    mc.mcProfiler.startSection("air");
    EntityPlayer player = (EntityPlayer)this.mc.getRenderViewEntity();
    GlStateManager.enableBlend();
    int left = width / 2 + 91;
    int top = height - right_height;

    if (player.isInsideOfMaterial(Material.WATER))
    {
        int air = player.getAir();
        int full = MathHelper.ceiling_double_int((double)(air - 2) * 10.0D / 300.0D);
        int partial = MathHelper.ceiling_double_int((double)air * 10.0D / 300.0D) - full;

        for (int i = 0; i < full + partial; ++i)
        {
            drawTexturedModalRect(left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9);
        }
        right_height += 10;
    }

    GlStateManager.disableBlend();
    mc.mcProfiler.endSection();
    post(AIR);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:27,代码来源:GuiIngameForge.java

示例3: update

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void update() {
    if (!getWorld().isRemote && updateNeighbours) {
        updateNeighbours = false;
        updateNeighbours();
    }
    if (!getWorld().isRemote) {
        if (getPressure() > PneumaticValues.MIN_PRESSURE_AERIAL_INTERFACE && isConnectedToPlayer) {
            if (energyRF != null) tickRF();
            addAir(-PneumaticValues.USAGE_AERIAL_INTERFACE);
            // bitwise check much faster than mod (%)
            if ((getWorld().getTotalWorldTime() & 0xf) == 0) {
                EntityPlayer player = getPlayer();
                if (player != null && player.getAir() <= 280) {
                    player.setAir(player.getAir() + 16);
                    addAir(-3200);
                }
            }
        }
        if ((getWorld().getTotalWorldTime() & 0xf) == 0 && !getWorld().isRemote && !playerUUID.isEmpty()) {
            setPlayer(PneumaticCraftUtils.getPlayerFromId(playerUUID));
        }
    }

    if (oldRedstoneStatus != shouldEmitRedstone()) {
        oldRedstoneStatus = shouldEmitRedstone();
        updateNeighbours = true;
    }

    super.update();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:32,代码来源:TileEntityAerialInterface.java


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