This commit is contained in:
ZLOFENIX 2013-11-25 20:44:21 +04:00
parent 971514d597
commit 4b48c05059
2 changed files with 110 additions and 99 deletions

View file

@ -5,6 +5,7 @@ import java.util.HashMap;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraftforge.common.DimensionManager;
@ -66,7 +67,7 @@ public class SpaceEventHandler
if (airValue <= 0)
{
if (((EntityPlayerMP)entity).inventory.consumeInventoryItem(WarpDriveConfig.i.IC2_Air))
if (consumeO2(((EntityPlayerMP)entity).inventory.mainInventory))
{
setPlayerAirValue(entity, 300);
}
@ -122,10 +123,19 @@ public class SpaceEventHandler
int id2 = e.worldObj.getBlockId(x, y + 1, z);
if (id1 == WarpDriveConfig.i.airID || id2 == WarpDriveConfig.i.airID)
{
return false;
}
return true;
}
private boolean consumeO2(ItemStack[] i)
{
for (int j = 0; j < i.length; ++j)
if (i[j] != null && i[j].itemID == WarpDriveConfig.i.IC2_Air[0] && i[j].getItemDamage() == WarpDriveConfig.i.IC2_Air[1])
{
if (--i[j].stackSize <= 0)
i[j] = null;
return true;
}
return false;
}
}

View file

@ -22,7 +22,8 @@ public class WarpDriveConfig
//
public boolean isGregLoaded = false, isAELoaded = false, isAdvSolPanelLoaded = false, isASLoaded = false, isICBMLoaded = false, isMFFSLoaded = false, isGraviSuiteLoaded = false;
//
public int IC2_Air = 0, CC_Computer = 0, CC_peripheral = 0, CCT_Turtle = 0, CCT_Upgraded = 0, CCT_Advanced = 0, GT_Ores = 0, GT_Granite = 0, GT_Machine = 0, ASP = 0, AS_Turbine = 0, ICBM_Machine = 0, ICBM_Missile = 0, MFFS_Field = 0;
public int[] IC2_Air;
public int CC_Computer = 0, CC_peripheral = 0, CCT_Turtle = 0, CCT_Upgraded = 0, CCT_Advanced = 0, GT_Ores = 0, GT_Granite = 0, GT_Machine = 0, ASP = 0, AS_Turbine = 0, ICBM_Machine = 0, ICBM_Missile = 0, MFFS_Field = 0;
public Set<Integer> SpaceHelmets, Jetpacks, MinerOres;
private Class<?> AEBlocks;
private Class<?> AEMaterials;
@ -164,7 +165,7 @@ public class WarpDriveConfig
SpaceHelmets.add(Items.getItem("quantumHelmet").itemID);
Jetpacks.add(Items.getItem("jetpack").itemID);
Jetpacks.add(Items.getItem("electricJetpack").itemID);
IC2_Air = Items.getItem("airCell").itemID;
IC2_Air = new int[] {Items.getItem("airCell").itemID, Items.getItem("airCell").getItemDamage()};
CommonWorldGenOres.add(new int[] {Items.getItem("uraniumOre").itemID, Items.getItem("uraniumOre").getItemDamage()});
CommonWorldGenOres.add(new int[] {Items.getItem("copperOre").itemID, Items.getItem("uraniumOre").getItemDamage()});
CommonWorldGenOres.add(new int[] {Items.getItem("tinOre").itemID, Items.getItem("uraniumOre").getItemDamage()});