Merge branch 'development' of https://github.com/aidancbrady/Mekanism into development

This commit is contained in:
Aidan C. Brady 2013-12-16 07:23:39 -05:00
commit c44b63fa3a
23 changed files with 82 additions and 29 deletions

View file

@ -397,6 +397,17 @@ public class ClientTickHandler implements ITickHandler
}
}
public static void killDeadNetworks()
{
for(Iterator<IClientTicker> iter = tickingSet.iterator(); iter.hasNext();)
{
if(!iter.next().needsTicks())
{
iter.remove();
}
}
}
public static boolean isJetpackOn(EntityPlayer player)
{
if(player != mc.thePlayer)

View file

@ -370,12 +370,12 @@ public class ItemRenderingHandler implements IItemRenderer
{
transmitterSmall.renderSide(ForgeDirection.UP, true);
transmitterSmall.renderSide(ForgeDirection.DOWN, true);
transmitterSmall.renderCenter(new boolean[]{true, true, false, false, false, false});
transmitterSmall.renderCenter(new boolean[] {true, true, false, false, false, false});
}
else {
transmitterLarge.renderSide(ForgeDirection.UP, true);
transmitterLarge.renderSide(ForgeDirection.DOWN, true);
transmitterLarge.renderCenter(new boolean[]{true, true, false, false, false, false});
transmitterLarge.renderCenter(new boolean[] {true, true, false, false, false, false});
}
GL11.glEnable(GL11.GL_CULL_FACE);

View file

@ -298,7 +298,7 @@ public class Mekanism
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(BasicBlock, 1, 3), new Object[] {
"***", "***", "***", Character.valueOf('*'), new ItemStack(Item.coal, 1, 1)
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(Item.coal, 1, 9), new Object[] {
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(Item.coal, 9, 1), new Object[] {
"*", Character.valueOf('*'), new ItemStack(BasicBlock, 1, 3)
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(BasicBlock, 1, 2), new Object[] {

View file

@ -139,6 +139,7 @@ public class TileComponentEjector implements ITileComponent, IEjector
}
tileEntity.inventory[slotID] = stack;
tileEntity.onInventoryChanged();
}
tickDelay = 20;

View file

@ -62,7 +62,7 @@ public class TileComponentUpgrade implements ITileComponent
tileEntity.inventory[upgradeSlot] = null;
}
MekanismUtils.saveChunk(tileEntity);
tileEntity.onInventoryChanged();
}
}
else if(tileEntity.inventory[upgradeSlot].isItemEqual(new ItemStack(Mekanism.SpeedUpgrade)) && speedMultiplier < 8)
@ -83,7 +83,7 @@ public class TileComponentUpgrade implements ITileComponent
tileEntity.inventory[upgradeSlot] = null;
}
MekanismUtils.saveChunk(tileEntity);
tileEntity.onInventoryChanged();
}
}
else {

View file

@ -778,6 +778,11 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getBlockTileEntity(x, y, z);
ItemStack itemStack = new ItemStack(blockID, 1, world.getBlockMetadata(x, y, z));
if(itemStack.stackTagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
if(((IUpgradeManagement)itemStack.getItem()).supportsUpgrades(itemStack))
{
IUpgradeManagement upgrade = (IUpgradeManagement)itemStack.getItem();
@ -789,11 +794,6 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
{
IInvConfiguration config = (IInvConfiguration)tileEntity;
if(itemStack.stackTagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
itemStack.stackTagCompound.setBoolean("hasSideData", true);
itemStack.stackTagCompound.setBoolean("ejecting", config.getEjector().isEjecting());

View file

@ -12,6 +12,7 @@ import mekanism.api.transmitters.ITransmitter;
import mekanism.api.transmitters.TransmissionType;
import mekanism.api.transmitters.TransmissionType.Size;
import mekanism.api.transmitters.TransmitterNetworkRegistry;
import mekanism.client.ClientTickHandler;
import mekanism.client.render.RenderPartTransmitter;
import mekanism.common.IConfigurable;
import mekanism.common.ITileNetwork;
@ -462,6 +463,11 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends TM
{
TransmitterNetworkRegistry.getInstance().pruneEmptyNetworks();
}
else {
try {
ClientTickHandler.killDeadNetworks();
} catch(Exception e) {}
}
}
@Override
@ -522,6 +528,11 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends TM
{
TransmitterNetworkRegistry.getInstance().pruneEmptyNetworks();
}
else {
try {
ClientTickHandler.killDeadNetworks();
} catch(Exception e) {}
}
}
super.preRemove();

View file

@ -14,6 +14,7 @@ import mekanism.api.Object3D;
import mekanism.api.energy.IStrictEnergyAcceptor;
import mekanism.api.energy.IStrictEnergyStorage;
import mekanism.common.IAdvancedBoundingBlock;
import mekanism.common.util.InventoryUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
@ -160,7 +161,7 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
{
if(getInv() == null)
{
return new int[0];
return InventoryUtils.EMPTY;
}
return getInv().getBoundSlots(Object3D.get(this), slotID);

View file

@ -9,6 +9,7 @@ import mekanism.common.SideData;
import mekanism.common.TileComponentEjector;
import mekanism.common.TileComponentUpgrade;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.InventoryUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -48,7 +49,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
{
super(soundPath, name, location, perTick, ticksRequired, maxEnergy);
sideOutputs.add(new SideData(EnumColor.GREY, new int[0]));
sideOutputs.add(new SideData(EnumColor.GREY, InventoryUtils.EMPTY));
sideOutputs.add(new SideData(EnumColor.DARK_RED, new int[] {0}));
sideOutputs.add(new SideData(EnumColor.PURPLE, new int[] {1}));
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, new int[] {2}));

View file

@ -5,6 +5,7 @@ import mekanism.common.SideData;
import mekanism.common.TileComponentEjector;
import mekanism.common.Tier.FactoryTier;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.util.InventoryUtils;
public class TileEntityAdvancedFactory extends TileEntityFactory
{
@ -12,7 +13,7 @@ public class TileEntityAdvancedFactory extends TileEntityFactory
{
super(FactoryTier.ADVANCED, MachineType.ADVANCED_FACTORY);
sideOutputs.add(new SideData(EnumColor.GREY, new int[0]));
sideOutputs.add(new SideData(EnumColor.GREY, InventoryUtils.EMPTY));
sideOutputs.add(new SideData(EnumColor.ORANGE, new int[] {0}));
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, new int[] {1}));
sideOutputs.add(new SideData(EnumColor.PURPLE, new int[] {4}));

View file

@ -455,7 +455,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento
return new int[] {0};
}
return new int[0];
return InventoryUtils.EMPTY;
}
@Override

View file

@ -19,6 +19,7 @@ import mekanism.common.RecipeHandler;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.InventoryUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -107,6 +108,15 @@ public class TileEntityChemicalFormulator extends TileEntityElectricBlock implem
gasTank.receive(stack, true);
operatingTicks = 0;
inventory[0].stackSize--;
if(inventory[0].stackSize <= 0)
{
inventory[0] = null;
}
onInventoryChanged();
}
}
else {
@ -178,7 +188,7 @@ public class TileEntityChemicalFormulator extends TileEntityElectricBlock implem
return new int[] {2};
}
return new int[0];
return InventoryUtils.EMPTY;
}
public int getScaledProgress(int i)

View file

@ -21,6 +21,7 @@ import mekanism.common.RecipeHandler;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.InventoryUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -463,6 +464,6 @@ public class TileEntityChemicalInfuser extends TileEntityElectricBlock implement
return new int[3];
}
return new int[0];
return InventoryUtils.EMPTY;
}
}

View file

@ -1,6 +1,7 @@
package mekanism.common.tileentity;
import mekanism.common.ISustainedInventory;
import mekanism.common.util.InventoryUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
@ -183,7 +184,7 @@ public abstract class TileEntityContainerBlock extends TileEntityBasicBlock impl
@Override
public int[] getAccessibleSlotsFromSide(int side)
{
return new int[0];
return InventoryUtils.EMPTY;
}
@Override

View file

@ -940,7 +940,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
@Override
public int[] getAccessibleSlotsFromSide(int side)
{
return new int[0];
return InventoryUtils.EMPTY;
}
public TileEntity getEjectTile()

View file

@ -233,6 +233,8 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock
structure.inventory[1].stackSize++;
}
onInventoryChanged();
structure.fluidStored.amount -= FluidContainerRegistry.getFluidForFilledItem(filled).amount;
if(structure.fluidStored.amount == 0)
@ -274,6 +276,7 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock
structure.inventory[1].stackSize++;
}
onInventoryChanged();
filled = true;
}
}

View file

@ -2,13 +2,11 @@ package mekanism.common.tileentity;
import java.util.ArrayList;
import mekanism.common.Mekanism;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.InventoryUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import com.google.common.io.ByteArrayDataInput;
@ -137,7 +135,7 @@ public class TileEntityElectricChest extends TileEntityElectricBlock
{
if(side == 0 || !canAccess())
{
return new int[0];
return InventoryUtils.EMPTY;
}
else {
int[] ret = new int[55];

View file

@ -7,6 +7,7 @@ import mekanism.common.SideData;
import mekanism.common.TileComponentEjector;
import mekanism.common.TileComponentUpgrade;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.InventoryUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@ -30,7 +31,7 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine
{
super(soundPath, name, location, perTick, ticksRequired, maxEnergy);
sideOutputs.add(new SideData(EnumColor.GREY, new int[0]));
sideOutputs.add(new SideData(EnumColor.GREY, InventoryUtils.EMPTY));
sideOutputs.add(new SideData(EnumColor.DARK_RED, new int[] {0}));
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, new int[] {1}));
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, new int[] {2}));

View file

@ -77,6 +77,8 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
{
inventory[0] = null;
}
onInventoryChanged();
}
else if(tempStack.isItemEqual(inventory[1]) && tempStack.getMaxStackSize() > inventory[1].stackSize)
{
@ -89,6 +91,8 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
{
inventory[0] = null;
}
onInventoryChanged();
}
}
}

View file

@ -5,6 +5,7 @@ import mekanism.common.SideData;
import mekanism.common.Tier.FactoryTier;
import mekanism.common.TileComponentEjector;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.util.InventoryUtils;
public class TileEntityEliteFactory extends TileEntityFactory
{
@ -12,7 +13,7 @@ public class TileEntityEliteFactory extends TileEntityFactory
{
super(FactoryTier.ELITE, MachineType.ELITE_FACTORY);
sideOutputs.add(new SideData(EnumColor.GREY, new int[0]));
sideOutputs.add(new SideData(EnumColor.GREY, InventoryUtils.EMPTY));
sideOutputs.add(new SideData(EnumColor.ORANGE, new int[] {0}));
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, new int[] {1}));
sideOutputs.add(new SideData(EnumColor.PURPLE, new int[] {4}));

View file

@ -29,6 +29,7 @@ import mekanism.common.TileComponentUpgrade;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.InventoryUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.StackUtils;
import net.minecraft.item.ItemStack;
@ -96,7 +97,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip
{
this(FactoryTier.BASIC, MachineType.BASIC_FACTORY);
sideOutputs.add(new SideData(EnumColor.GREY, new int[0]));
sideOutputs.add(new SideData(EnumColor.GREY, InventoryUtils.EMPTY));
sideOutputs.add(new SideData(EnumColor.ORANGE, new int[] {0}));
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, new int[] {1}));
sideOutputs.add(new SideData(EnumColor.PURPLE, new int[] {4}));
@ -288,7 +289,11 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip
break;
}
if(didOp) break;
if(didOp)
{
onInventoryChanged();
break;
}
}
}
}

View file

@ -11,21 +11,22 @@ import mekanism.api.infuse.InfusionInput;
import mekanism.api.infuse.InfusionOutput;
import mekanism.client.sound.IHasSound;
import mekanism.common.IActiveState;
import mekanism.common.IInvConfiguration;
import mekanism.common.IEjector;
import mekanism.common.IInvConfiguration;
import mekanism.common.IRedstoneControl;
import mekanism.common.IUpgradeTile;
import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.SideData;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.RecipeHandler;
import mekanism.common.RecipeHandler.Recipe;
import mekanism.common.SideData;
import mekanism.common.TileComponentEjector;
import mekanism.common.TileComponentUpgrade;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.InventoryUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -84,7 +85,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
{
super("MetallurgicInfuser", MachineType.METALLURGIC_INFUSER.baseEnergy);
sideOutputs.add(new SideData(EnumColor.GREY, new int[0]));
sideOutputs.add(new SideData(EnumColor.GREY, InventoryUtils.EMPTY));
sideOutputs.add(new SideData(EnumColor.ORANGE, new int[] {0}));
sideOutputs.add(new SideData(EnumColor.PURPLE, new int[] {1}));
sideOutputs.add(new SideData(EnumColor.DARK_RED, new int[] {2}));

View file

@ -15,6 +15,8 @@ import net.minecraftforge.common.ForgeDirection;
public final class InventoryUtils
{
public static final int[] EMPTY = new int[0];
public static IInventory checkChestInv(IInventory inv)
{
if(inv instanceof TileEntityChest)