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


Java EntityPlayer.setAir方法代码示例

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


在下文中一共展示了EntityPlayer.setAir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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.setAir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。