本文整理汇总了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();
}
}
示例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();
}