Java Code Examples for net.minecraft.entity.player.EntityPlayer.setAir()
The following are Jave code examples for showing how to use
setAir() of the
net.minecraft.entity.player.EntityPlayer
class.
You can vote up the examples you like. Your votes will be used in our system to get
more good examples.
+ Save this method
Example 1
Project: CompositeGear File: ItemCGArmor.java View Source Code | 6 votes |
@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(); } }
Example 2
Project: pnc-repressurized File: TileEntityAerialInterface.java View Source Code | 5 votes |
@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(); }