Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
IC2.platform.profilerStartSection("QuantumHelmet");
int air = player.func_70086_ai();
if ((ElectricItem.manager.canUse(itemStack, 1000)) && (air < 100)) {
player.func_70050_g(air + 200);
ElectricItem.manager.use(itemStack, 1000, null);
ret = true;
} else if (air <= 0) {
IC2.achievements.issueAchievement(player, "starveWithQHelmet");
}
if ((ElectricItem.manager.canUse(itemStack, 1000)) && (player.getFoodStats().needFood())) {
int slot = -1;
for (int i = 0; i < player.inventory.mainInventory.length; i++) {
if ((player.inventory.mainInventory[i] != null) && (player.inventory.mainInventory[i].itemID == Ic2Items.filledTinCan.itemID)) {
slot = i;
break;
}
}
if (slot > -1) {
ItemTinCan can = (ItemTinCan)player.inventory.mainInventory[slot].getItem();
player.getFoodStats().addStats(can.getHealAmount(), can.getSaturationModifier());
can.onFoodEaten(player.inventory.mainInventory[slot], player.field_70170_p, player);
can.onEaten(player);
if (--player.inventory.mainInventory[slot].stackSize <= 0) player.inventory.mainInventory[slot] = null;
ElectricItem.manager.use(itemStack, 1000, null);
ret = true;
}
} else if (player.getFoodStats().getFoodLevel() <= 0) {
IC2.achievements.issueAchievement(player, "starveWithQHelmet");
}
for (PotionEffect effect : new LinkedList(player.func_70651_bq())) {
int cost = potionRemovalCost[effect.getPotionID()];
if (cost > 0) {
cost *= (effect.getAmplifier() + 1);
if (ElectricItem.manager.canUse(itemStack, cost)) {
ElectricItem.manager.use(itemStack, cost, null);
IC2.platform.removePotion(player, effect.getPotionID());
}
}
}
IC2.platform.profilerEndSection();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment