Several fixes

This commit is contained in:
Aidan C. Brady 2014-03-07 22:00:35 -05:00
parent ac16039ecf
commit 1c42aebfec
5 changed files with 22 additions and 17 deletions

View file

@ -21,15 +21,15 @@ public class ContainerGasTank extends Container
int slotX; int slotX;
for(slotX = 0; slotX < 3; ++slotX) for(slotX = 0; slotX < 3; slotX++)
{ {
for(int slotY = 0; slotY < 9; ++slotY) for(int slotY = 0; slotY < 9; slotY++)
{ {
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18)); addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18));
} }
} }
for(slotX = 0; slotX < 9; ++slotX) for(slotX = 0; slotX < 9; slotX++)
{ {
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142)); addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
} }

View file

@ -160,7 +160,7 @@ public class ItemJetpack extends ItemArmor implements IGasItem, ISpecialArmor
@Override @Override
public boolean canProvideGas(ItemStack itemstack, Gas type) public boolean canProvideGas(ItemStack itemstack, Gas type)
{ {
return getGas(itemstack) != null && (type == null || getGas(itemstack).getGas() == type); return false;
} }
@Override @Override

View file

@ -164,7 +164,7 @@ public class ItemScubaTank extends ItemArmor implements IGasItem
@Override @Override
public boolean canProvideGas(ItemStack itemstack, Gas type) public boolean canProvideGas(ItemStack itemstack, Gas type)
{ {
return getGas(itemstack) != null && (type == null || getGas(itemstack).getGas() == type); return false;
} }
@Override @Override

View file

@ -69,6 +69,18 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
} }
} }
public void deregister()
{
if(!worldObj.isRemote)
{
if(Mekanism.ic2Registered.contains(Coord4D.get(this)))
{
Mekanism.ic2Registered.remove(Coord4D.get(this));
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
}
}
}
@Override @Override
public void onUpdate() public void onUpdate()
{ {
@ -129,11 +141,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
@Override @Override
public void onChunkUnload() public void onChunkUnload()
{ {
if(!worldObj.isRemote) deregister();
{
Mekanism.ic2Registered.remove(Coord4D.get(this));
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
}
super.onChunkUnload(); super.onChunkUnload();
} }
@ -143,11 +151,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
{ {
super.invalidate(); super.invalidate();
if(!worldObj.isRemote) deregister();
{
Mekanism.ic2Registered.remove(Coord4D.get(this));
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
}
} }
@Override @Override

View file

@ -21,6 +21,7 @@ import mekanism.common.network.PacketTileEntity;
import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler;
import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.util.ChargeUtils; import mekanism.common.util.ChargeUtils;
import mekanism.common.util.InventoryUtils;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -306,7 +307,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
return new int[] {1, 2}; return new int[] {1, 2};
} }
return new int[] {0}; return InventoryUtils.EMPTY;
} }
/** /**