Skip to content

Instantly share code, notes, and snippets.

@akkez
Created March 28, 2014 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akkez/9843305 to your computer and use it in GitHub Desktop.
Save akkez/9843305 to your computer and use it in GitHub Desktop.
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