Fixed Gas Mask OP-ness, added config option to let creative mode override the Electric Chest, fixed Gas Generator crash
This commit is contained in:
parent
de1e264c68
commit
cfeb08a8ee
8 changed files with 44 additions and 9 deletions
|
@ -9,6 +9,7 @@ import java.util.Set;
|
|||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.IClientTicker;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.client.sound.GasMaskSound;
|
||||
import mekanism.client.sound.JetpackSound;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
|
@ -455,9 +456,20 @@ public class ClientTickHandler
|
|||
{
|
||||
ItemScubaTank tank = (ItemScubaTank)mc.thePlayer.getEquipmentInSlot(3).getItem();
|
||||
|
||||
final int max = 300;
|
||||
|
||||
tank.useGas(mc.thePlayer.getEquipmentInSlot(3));
|
||||
mc.thePlayer.setAir(300);
|
||||
mc.thePlayer.clearActivePotions();
|
||||
GasStack received = tank.removeGas(mc.thePlayer.getEquipmentInSlot(3), max-mc.thePlayer.getAir());
|
||||
|
||||
if(received != null)
|
||||
{
|
||||
mc.thePlayer.setAir(mc.thePlayer.getAir()+received.amount);
|
||||
|
||||
if(mc.thePlayer.getAir() == max)
|
||||
{
|
||||
mc.thePlayer.clearActivePotions();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package mekanism.common;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.common.item.ItemFreeRunners;
|
||||
import mekanism.common.item.ItemGasMask;
|
||||
import mekanism.common.item.ItemJetpack;
|
||||
|
@ -15,13 +16,14 @@ import net.minecraft.network.NetHandlerPlayServer;
|
|||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class CommonPlayerTickHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public void onTick(PlayerTickEvent event)
|
||||
{
|
||||
if(event.phase == Phase.END)
|
||||
if(event.phase == Phase.END && event.side == Side.SERVER)
|
||||
{
|
||||
tickEnd(event.player);
|
||||
}
|
||||
|
@ -29,7 +31,7 @@ public class CommonPlayerTickHandler
|
|||
|
||||
public void tickEnd(EntityPlayer player)
|
||||
{
|
||||
if(!player.worldObj.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemPortableTeleporter)
|
||||
if(player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemPortableTeleporter)
|
||||
{
|
||||
ItemPortableTeleporter item = (ItemPortableTeleporter)player.getCurrentEquippedItem().getItem();
|
||||
ItemStack itemstack = player.getCurrentEquippedItem();
|
||||
|
@ -141,9 +143,20 @@ public class CommonPlayerTickHandler
|
|||
{
|
||||
ItemScubaTank tank = (ItemScubaTank)player.getEquipmentInSlot(3).getItem();
|
||||
|
||||
final int max = 300;
|
||||
|
||||
tank.useGas(player.getEquipmentInSlot(3));
|
||||
player.setAir(300);
|
||||
player.clearActivePotions();
|
||||
GasStack received = tank.removeGas(player.getEquipmentInSlot(3), max-player.getAir());
|
||||
|
||||
if(received != null)
|
||||
{
|
||||
player.setAir(player.getAir()+received.amount);
|
||||
|
||||
if(player.getAir() == max)
|
||||
{
|
||||
player.clearActivePotions();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -189,6 +189,7 @@ public class CommonProxy
|
|||
Mekanism.voiceServerEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "VoiceServerEnabled", true).getBoolean(true);
|
||||
Mekanism.cardboardSpawners = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AllowSpawnerBoxPickup", true).getBoolean(true);
|
||||
Mekanism.enableWorldRegeneration = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnableWorldRegeneration", false).getBoolean(false);
|
||||
Mekanism.creativeOverrideElectricChest = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "CreativeOverrideElectricChest", true).getBoolean(true);
|
||||
Mekanism.obsidianTNTDelay = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ObsidianTNTDelay", 100).getInt();
|
||||
Mekanism.obsidianTNTBlastRadius = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ObsidianTNTBlastRadius", 12).getInt();
|
||||
Mekanism.UPDATE_DELAY = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ClientUpdateDelay", 10).getInt();
|
||||
|
|
|
@ -309,6 +309,7 @@ public class Mekanism
|
|||
public static boolean cardboardSpawners = true;
|
||||
public static boolean machineEffects = true;
|
||||
public static boolean enableWorldRegeneration = true;
|
||||
public static boolean creativeOverrideElectricChest = true;
|
||||
public static int obsidianTNTBlastRadius = 12;
|
||||
public static int osmiumPerChunk = 12;
|
||||
public static int copperPerChunk = 16;
|
||||
|
|
|
@ -68,12 +68,12 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
|
|
@ -71,7 +71,10 @@ public class InventoryElectricChest extends InventoryBasic
|
|||
}
|
||||
}
|
||||
|
||||
((ISustainedInventory)getStack().getItem()).setInventory(tagList, getStack());
|
||||
if(getStack() != null)
|
||||
{
|
||||
((ISustainedInventory)getStack().getItem()).setInventory(tagList, getStack());
|
||||
}
|
||||
}
|
||||
|
||||
public void read()
|
||||
|
|
|
@ -30,6 +30,7 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
|
|||
dataStream.writeBoolean(Mekanism.dynamicTankEasterEgg);
|
||||
dataStream.writeBoolean(Mekanism.voiceServerEnabled);
|
||||
dataStream.writeBoolean(Mekanism.cardboardSpawners);
|
||||
dataStream.writeBoolean(Mekanism.creativeOverrideElectricChest);
|
||||
dataStream.writeInt(Mekanism.obsidianTNTDelay);
|
||||
dataStream.writeInt(Mekanism.obsidianTNTBlastRadius);
|
||||
dataStream.writeInt(Mekanism.UPDATE_DELAY);
|
||||
|
@ -83,6 +84,7 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
|
|||
Mekanism.dynamicTankEasterEgg = dataStream.readBoolean();
|
||||
Mekanism.voiceServerEnabled = dataStream.readBoolean();
|
||||
Mekanism.cardboardSpawners = dataStream.readBoolean();
|
||||
Mekanism.creativeOverrideElectricChest = dataStream.readBoolean();
|
||||
Mekanism.obsidianTNTDelay = dataStream.readInt();
|
||||
Mekanism.obsidianTNTBlastRadius = dataStream.readInt();
|
||||
Mekanism.UPDATE_DELAY = dataStream.readInt();
|
||||
|
|
|
@ -62,7 +62,10 @@ public class TileEntityGasGenerator extends TileEntityGenerator implements IGasH
|
|||
}
|
||||
else if(inventory[0] != null && inventory[0].getItem() instanceof IGasItem)
|
||||
{
|
||||
gasType = ((IGasItem)inventory[0].getItem()).getGas(inventory[0]).getGas();
|
||||
if(((IGasItem)inventory[0].getItem()).getGas(inventory[0]) != null)
|
||||
{
|
||||
gasType = ((IGasItem)inventory[0].getItem()).getGas(inventory[0]).getGas();
|
||||
}
|
||||
}
|
||||
|
||||
if(gasType != null && FuelHandler.getFuel(gasType) != null)
|
||||
|
|
Loading…
Reference in a new issue