Fixed breathing with IC2 helmet

This commit is contained in:
LemADEC 2015-09-03 23:35:11 +02:00
parent 7916ff2670
commit 682a462b4f
2 changed files with 13 additions and 13 deletions

View file

@ -59,8 +59,8 @@ public class WarpDriveConfig {
public static Method forgeMultipart_helper_sendDescPacket = null;
public static Method forgeMultipart_tileMultipart_onChunkLoad = null;
public static ItemStack IC2_air;
public static ItemStack IC2_empty;
public static ItemStack IC2_compressedAir;
public static ItemStack IC2_emptyCell;
public static Block IC2_rubberWood;
public static ItemStack IC2_Resin;
public static Block CC_Computer, CC_peripheral, CCT_Turtle, CCT_Expanded, CCT_Advanced;
@ -590,6 +590,7 @@ public class WarpDriveConfig {
config.get("item_tags", "GraviSuite:advNanoChestPlate" , "FlyInSpace NoFallDamage" ).getString();
config.get("item_tags", "GraviSuite:graviChestPlate" , "FlyInSpace NoFallDamage" ).getString();
config.get("item_tags", "IC2:itemArmorRubBoots" , "NoFallDamage" ).getString();
config.get("item_tags", "IC2:itemArmorQuantumBoots" , "NoFallDamage" ).getString();
taggedItemsName = categoryItemTags.getValues().keySet().toArray(new String[0]);
}
@ -835,12 +836,12 @@ public class WarpDriveConfig {
FillerManager.loadOres(configDirectory);
StructureManager.loadStructures(configDirectory);
loadBlockDictionnary();
loadDictionnary();
FillerManager.finishLoading();
}
private static void loadBlockDictionnary() {
private static void loadDictionnary() {
// get default settings from parsing ore dictionary
BLOCKS_ORES = new HashSet<Block>();
BLOCKS_LOGS = new HashSet<Block>();
@ -947,7 +948,7 @@ public class WarpDriveConfig {
for (Entry<String, String> taggedItem : taggedItems.entrySet()) {
String itemId = taggedItem.getKey();
Item item = GameData.getItemRegistry().getObject(itemId);
if (item != null) {
if (item == null) {
WarpDrive.logger.info("Ignoring missing item " + itemId);
continue;
}
@ -1010,8 +1011,8 @@ public class WarpDriveConfig {
private static void loadIC2() {
try {
IC2_empty = getModItemStack("IC2", "itemCellEmpty", -1);
IC2_air = getModItemStack("IC2", "itemCellEmpty", 5);
IC2_emptyCell = getModItemStack("IC2", "itemCellEmpty", -1);
IC2_compressedAir = getModItemStack("IC2", "itemCellEmpty", 5);
IC2_rubberWood = getModBlock("IC2", "blockRubWood");
IC2_Resin = getModItemStack("IC2", "itemHarz", -1);

View file

@ -143,7 +143,7 @@ public class LivingHandler {
if (air == null) {// new player in space => grace period
player_airTank.put(playerName, AIR_TANK_TICKS);
} else if (air <= 1) {
if (consumeO2(player.inventory.mainInventory, player)) {
if (consumeCompressedAir(player.inventory.mainInventory, player)) {
player_airTank.put(playerName, AIR_TANK_TICKS);
} else {
player_airTank.put(playerName, AIR_DROWN_TICKS);
@ -204,17 +204,16 @@ public class LivingHandler {
}
}
private static boolean consumeO2(ItemStack[] inventory, EntityPlayerMP entityPlayer) {
private static boolean consumeCompressedAir(ItemStack[] inventory, EntityPlayerMP entityPlayer) {
for (int j = 0; j < inventory.length; ++j) {
if (inventory[j] != null && inventory[j] == WarpDriveConfig.IC2_air) {
if (inventory[j] != null && inventory[j].isItemEqual(WarpDriveConfig.IC2_compressedAir)) {
inventory[j].stackSize--;
if (inventory[j].stackSize <= 0) {
inventory[j] = null;
}
if (WarpDriveConfig.IC2_empty != null) {
// WarpDrive.debugPrint("giveEmptyCell");
ItemStack emptyCell = new ItemStack(WarpDriveConfig.IC2_empty.getItem(), 1, 0);
if (WarpDriveConfig.IC2_emptyCell != null) {
ItemStack emptyCell = new ItemStack(WarpDriveConfig.IC2_emptyCell.getItem(), 1, 0);
if (!entityPlayer.inventory.addItemStackToInventory(emptyCell)) {
World world = entityPlayer.worldObj;
EntityItem itemEnt = new EntityItem(world, entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, emptyCell);