Mekanism v6.0.5 - contains many major fixes, many of which were backported from the 1.7 branch

This commit is contained in:
Aidan C. Brady 2014-06-08 11:47:02 +02:00
parent 05995dbaaa
commit ba04ed146f
25 changed files with 200 additions and 77 deletions

View file

@ -25,7 +25,7 @@ dependencies {
compile ':forgemultipart:1.0.0.228' compile ':forgemultipart:1.0.0.228'
} }
version = "6.0.4." + "$System.env.BUILD_NUMBER" version = "6.0.5." + "$System.env.BUILD_NUMBER"
archivesBaseName = "MekanismAll" archivesBaseName = "MekanismAll"
libsDirName = "../output" libsDirName = "../output"
distsDirName = "../output" distsDirName = "../output"

View file

@ -3,4 +3,4 @@ dir.mcp=${dir.development}forge/mcp
version.minecraft=1.6.4 version.minecraft=1.6.4
version.mod.major=6 version.mod.major=6
version.mod.minor=0 version.mod.minor=0
version.mod.revis=3 version.mod.revis=5

View file

@ -14,6 +14,7 @@ import mekanism.api.Coord4D;
import mekanism.api.IClientTicker; import mekanism.api.IClientTicker;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
@ -28,6 +29,8 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
public HashMap<A, ForgeDirection> acceptorDirections = new HashMap<A, ForgeDirection>(); public HashMap<A, ForgeDirection> acceptorDirections = new HashMap<A, ForgeDirection>();
private List<DelayQueue> updateQueue = new ArrayList<DelayQueue>(); private List<DelayQueue> updateQueue = new ArrayList<DelayQueue>();
protected AxisAlignedBB packetRange = null;
protected int ticksSinceCreate = 0; protected int ticksSinceCreate = 0;
@ -50,6 +53,65 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
{ {
return transmitters.iterator().next().equals(transmitter); return transmitters.iterator().next().equals(transmitter);
} }
public AxisAlignedBB getPacketRange()
{
if(packetRange == null)
{
return genPacketRange();
}
return packetRange;
}
public int getDimension()
{
if(getSize() == 0)
{
return 0;
}
return transmitters.iterator().next().getLocation().dimensionId;
}
protected AxisAlignedBB genPacketRange()
{
if(getSize() == 0)
{
deregister();
return null;
}
Coord4D initCoord = transmitters.iterator().next().getLocation();
int minX = initCoord.xCoord;
int minY = initCoord.yCoord;
int minZ = initCoord.zCoord;
int maxX = initCoord.xCoord;
int maxY = initCoord.yCoord;
int maxZ = initCoord.zCoord;
for(IGridTransmitter transmitter : transmitters)
{
Coord4D coord = transmitter.getLocation();
if(coord.xCoord < minX) minX = coord.xCoord;
if(coord.yCoord < minY) minY = coord.yCoord;
if(coord.zCoord < minZ) minZ = coord.zCoord;
if(coord.xCoord > maxX) maxX = coord.xCoord;
if(coord.yCoord > maxY) maxY = coord.yCoord;
if(coord.zCoord > maxZ) maxZ = coord.zCoord;
}
minX -= 40;
minY -= 40;
minZ -= 40;
maxX += 40;
maxY += 40;
maxZ += 40;
return AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
}
@Override @Override
public void removeTransmitter(IGridTransmitter<N> transmitter) public void removeTransmitter(IGridTransmitter<N> transmitter)

View file

@ -1,5 +1,6 @@
package mekanism.api.transmitters; package mekanism.api.transmitters;
import mekanism.api.Coord4D;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
@ -60,4 +61,6 @@ public interface IGridTransmitter<N extends DynamicNetwork<?, N>> extends ITrans
public String getTransmitterNetworkFlow(); public String getTransmitterNetworkFlow();
public int getCapacity(); public int getCapacity();
public Coord4D getLocation();
} }

View file

@ -49,7 +49,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
bindTexture(MekanismRenderer.getBlocksTexture()); bindTexture(MekanismRenderer.getBlocksTexture());
if(data.location != null && data.height > 0 && tileEntity.structure.fluidStored.getFluid() != null) if(data.location != null && data.height >= 3 && tileEntity.structure.fluidStored.getFluid() != null)
{ {
push(); push();

View file

@ -18,6 +18,7 @@ import mekanism.api.transmitters.TransmissionType;
import mekanism.common.util.CableUtils; import mekanism.common.util.CableUtils;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event; import net.minecraftforge.event.Event;
@ -315,6 +316,7 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
possibleAcceptors.clear(); possibleAcceptors.clear();
acceptorDirections.clear(); acceptorDirections.clear();
packetRange = null;
while(it.hasNext()) while(it.hasNext())
{ {

View file

@ -159,7 +159,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
* @author AidanBrady * @author AidanBrady
* *
*/ */
@Mod(modid = "Mekanism", name = "Mekanism", version = "6.0.4") @Mod(modid = "Mekanism", name = "Mekanism", version = "6.0.5")
@NetworkMod(channels = {"MEK"}, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class) @NetworkMod(channels = {"MEK"}, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
public class Mekanism public class Mekanism
{ {
@ -184,7 +184,7 @@ public class Mekanism
public static Configuration configuration; public static Configuration configuration;
/** Mekanism version number */ /** Mekanism version number */
public static Version versionNumber = new Version(6, 0, 4); public static Version versionNumber = new Version(6, 0, 5);
/** Map of Teleporters */ /** Map of Teleporters */
public static Map<Teleporter.Code, ArrayList<Coord4D>> teleporters = new HashMap<Teleporter.Code, ArrayList<Coord4D>>(); public static Map<Teleporter.Code, ArrayList<Coord4D>> teleporters = new HashMap<Teleporter.Code, ArrayList<Coord4D>>();
@ -670,6 +670,7 @@ public class Mekanism
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.stoneBrick, 1, 2), new ItemStack(Block.stoneBrick, 1, 0)); RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.stoneBrick, 1, 2), new ItemStack(Block.stoneBrick, 1, 0));
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.stoneBrick, 1, 0), new ItemStack(Block.stoneBrick, 1, 3)); RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.stoneBrick, 1, 0), new ItemStack(Block.stoneBrick, 1, 3));
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.stoneBrick, 1, 1), new ItemStack(Block.stoneBrick, 1, 0)); RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.stoneBrick, 1, 1), new ItemStack(Block.stoneBrick, 1, 0));
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.oreNetherQuartz), new ItemStack(Item.netherQuartz, 2));
//Combiner recipes //Combiner recipes
RecipeHandler.addCombinerRecipe(new ItemStack(Item.redstone, 16), new ItemStack(Block.oreRedstone)); RecipeHandler.addCombinerRecipe(new ItemStack(Item.redstone, 16), new ItemStack(Block.oreRedstone));
@ -737,7 +738,7 @@ public class Mekanism
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("water", 2), new ChemicalPair(new GasStack(GasRegistry.getGas("hydrogen"), 2), new GasStack(GasRegistry.getGas("oxygen"), 1))); RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("water", 2), new ChemicalPair(new GasStack(GasRegistry.getGas("hydrogen"), 2), new GasStack(GasRegistry.getGas("oxygen"), 1)));
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("brine", 10), new ChemicalPair(new GasStack(GasRegistry.getGas("hydrogen"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1))); RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("brine", 10), new ChemicalPair(new GasStack(GasRegistry.getGas("hydrogen"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1)));
//Chemical Washer Recipes //T4 Processing Recipes
for(Gas gas : GasRegistry.getRegisteredGasses()) for(Gas gas : GasRegistry.getRegisteredGasses())
{ {
if(gas instanceof OreGas && !((OreGas)gas).isClean()) if(gas instanceof OreGas && !((OreGas)gas).isClean())
@ -748,6 +749,9 @@ public class Mekanism
RecipeHandler.addChemicalCrystalizerRecipe(new GasStack(oreGas.getCleanGas(), 200), new ItemStack(Crystal, 1, Resource.getFromName(oreGas.getName()).ordinal())); RecipeHandler.addChemicalCrystalizerRecipe(new GasStack(oreGas.getCleanGas(), 200), new ItemStack(Crystal, 1, Resource.getFromName(oreGas.getName()).ordinal()));
} }
} }
//Chemical Dissolution Chamber Recipes
RecipeHandler.addChemicalDissolutionChamberRecipe(new ItemStack(Block.obsidian), new GasStack(GasRegistry.getGas("obsidian"), 1000));
//Infuse objects //Infuse objects
InfuseRegistry.registerInfuseObject(new ItemStack(Item.coal, 1, 0), new InfuseObject(InfuseRegistry.get("CARBON"), 10)); InfuseRegistry.registerInfuseObject(new ItemStack(Item.coal, 1, 0), new InfuseObject(InfuseRegistry.get("CARBON"), 10));
@ -1245,7 +1249,7 @@ public class Mekanism
public void onEnergyTransferred(EnergyTransferEvent event) public void onEnergyTransferred(EnergyTransferEvent event)
{ {
try { try {
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTransmitterUpdate().setParams(PacketType.ENERGY, event.energyNetwork.transmitters.iterator().next(), event.power)); PacketHandler.sendPacket(Transmission.CLIENTS_CUBOID, new PacketTransmitterUpdate().setParams(PacketType.ENERGY, event.energyNetwork.transmitters.iterator().next(), event.power), event.energyNetwork.getPacketRange(), event.energyNetwork.getDimension());
} catch(Exception e) {} } catch(Exception e) {}
} }
@ -1253,7 +1257,7 @@ public class Mekanism
public void onGasTransferred(GasTransferEvent event) public void onGasTransferred(GasTransferEvent event)
{ {
try { try {
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTransmitterUpdate().setParams(PacketType.GAS, event.gasNetwork.transmitters.iterator().next(), event.transferType, event.didTransfer)); PacketHandler.sendPacket(Transmission.CLIENTS_CUBOID, new PacketTransmitterUpdate().setParams(PacketType.GAS, event.gasNetwork.transmitters.iterator().next(), event.transferType, event.didTransfer), event.gasNetwork.getPacketRange(), event.gasNetwork.getDimension());
} catch(Exception e) {} } catch(Exception e) {}
} }
@ -1261,7 +1265,7 @@ public class Mekanism
public void onLiquidTransferred(FluidTransferEvent event) public void onLiquidTransferred(FluidTransferEvent event)
{ {
try { try {
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTransmitterUpdate().setParams(PacketType.FLUID, event.fluidNetwork.transmitters.iterator().next(), event.fluidType, event.didTransfer)); PacketHandler.sendPacket(Transmission.CLIENTS_CUBOID, new PacketTransmitterUpdate().setParams(PacketType.FLUID, event.fluidNetwork.transmitters.iterator().next(), event.fluidType, event.didTransfer), event.fluidNetwork.getPacketRange(), event.fluidNetwork.getDimension());
} catch(Exception e) {} } catch(Exception e) {}
} }

View file

@ -10,7 +10,10 @@ import mekanism.common.network.IMekanismPacket;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.INetworkManager; import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet250CustomPayload; import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
@ -187,6 +190,9 @@ public class PacketHandler implements IPacketHandler
Coord4D obj = (Coord4D)transParams[0]; Coord4D obj = (Coord4D)transParams[0];
PacketDispatcher.sendPacketToAllAround(obj.xCoord, obj.yCoord, obj.zCoord, (Double)transParams[1], obj.dimensionId, packet); PacketDispatcher.sendPacketToAllAround(obj.xCoord, obj.yCoord, obj.zCoord, (Double)transParams[1], obj.dimensionId, packet);
break; break;
case CLIENTS_CUBOID:
sendToCuboid(packet, (AxisAlignedBB)transParams[0], (Integer)transParams[1]);
break;
case CLIENTS_DIM: case CLIENTS_DIM:
PacketDispatcher.sendPacketToAllInDimension(packet, (Integer)transParams[0]); PacketDispatcher.sendPacketToAllInDimension(packet, (Integer)transParams[0]);
break; break;
@ -197,6 +203,22 @@ public class PacketHandler implements IPacketHandler
log(trans, packetType, transParams); log(trans, packetType, transParams);
} }
private static void sendToCuboid(Packet packet, AxisAlignedBB cuboid, int dimId)
{
MinecraftServer server = MinecraftServer.getServer();
if(server != null && cuboid != null)
{
for(EntityPlayerMP player : (List<EntityPlayerMP>)server.getConfigurationManager().playerEntityList)
{
if(cuboid.isVecInside(player.getPosition(1.0F)))
{
player.playerNetServerHandler.sendPacketToPlayer(packet);
}
}
}
}
/** /**
* Writes a log to the console with information about a packet recently sent. * Writes a log to the console with information about a packet recently sent.
@ -219,6 +241,9 @@ public class PacketHandler implements IPacketHandler
case CLIENTS_RANGE: case CLIENTS_RANGE:
System.out.println("[Mekanism] Sent '" + packetType.getName() + "' packet to clients in a " + (Double)transParams[1] + " block range."); System.out.println("[Mekanism] Sent '" + packetType.getName() + "' packet to clients in a " + (Double)transParams[1] + " block range.");
break; break;
case CLIENTS_CUBOID:
System.out.println("[Mekanism] Sent '" + packetType.getName() + "' packet to clients within the cuboid " + ((AxisAlignedBB)transParams[0]).toString());
break;
case CLIENTS_DIM: case CLIENTS_DIM:
System.out.println("[Mekanism] Sent '" + packetType.getName() + "' packet to clients in dimension ID " + (Integer)transParams[0] + "."); System.out.println("[Mekanism] Sent '" + packetType.getName() + "' packet to clients in dimension ID " + (Integer)transParams[0] + ".");
break; break;
@ -239,6 +264,9 @@ public class PacketHandler implements IPacketHandler
/** 2 parameters - Object3D representing the location of the transmission, and a double of the distance this packet can be sent in. */ /** 2 parameters - Object3D representing the location of the transmission, and a double of the distance this packet can be sent in. */
CLIENTS_RANGE(2), CLIENTS_RANGE(2),
/** 2 parameter - AxisAlignedBB representing the area where the packet will be sent, and an int of the dimensionId the cuboid is in. */
CLIENTS_CUBOID(2),
/** 1 parameter - int representing the dimension ID to send this packet to. */ /** 1 parameter - int representing the dimension ID to send this packet to. */
CLIENTS_DIM(1), CLIENTS_DIM(1),

View file

@ -160,7 +160,7 @@ public class PartMechanicalPipe extends PartTransmitter<FluidNetwork> implements
{ {
super.save(nbtTags); super.save(nbtTags);
if(getTransmitterNetwork().fluidStored != null) if(getTransmitterNetwork(false) != null && getTransmitterNetwork(false).getSize() > 0 && getTransmitterNetwork(false).fluidStored != null)
{ {
int remain = getTransmitterNetwork().fluidStored.amount%getTransmitterNetwork().transmitters.size(); int remain = getTransmitterNetwork().fluidStored.amount%getTransmitterNetwork().transmitters.size();
int toSave = getTransmitterNetwork().fluidStored.amount/getTransmitterNetwork().transmitters.size(); int toSave = getTransmitterNetwork().fluidStored.amount/getTransmitterNetwork().transmitters.size();

View file

@ -149,7 +149,7 @@ public class PartPressurizedTube extends PartTransmitter<GasNetwork>
{ {
super.save(nbtTags); super.save(nbtTags);
if(getTransmitterNetwork().gasStored != null) if(getTransmitterNetwork(false) != null && getTransmitterNetwork(false).getSize() > 0 && getTransmitterNetwork(false).gasStored != null)
{ {
int remain = getTransmitterNetwork().gasStored.amount%getTransmitterNetwork().transmitters.size(); int remain = getTransmitterNetwork().gasStored.amount%getTransmitterNetwork().transmitters.size();
int toSave = getTransmitterNetwork().gasStored.amount/getTransmitterNetwork().transmitters.size(); int toSave = getTransmitterNetwork().gasStored.amount/getTransmitterNetwork().transmitters.size();

View file

@ -217,6 +217,12 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa
PacketHandler.sendPacket(Transmission.CLIENTS_DIM, new PacketTransmitterUpdate().setParams(PacketType.UPDATE, tile()), world().provider.dimensionId); PacketHandler.sendPacket(Transmission.CLIENTS_DIM, new PacketTransmitterUpdate().setParams(PacketType.UPDATE, tile()), world().provider.dimensionId);
} }
} }
@Override
public Coord4D getLocation()
{
return Coord4D.get(tile());
}
@Override @Override
public void chunkLoad() {} public void chunkLoad() {}

View file

@ -54,6 +54,11 @@ public class PacketPortableTeleport implements IMekanismPacket
teleporter.teleDelay = 5; teleporter.teleDelay = 5;
item.setEnergy(itemstack, item.getEnergy(itemstack) - item.calculateEnergyCost(player, coords)); item.setEnergy(itemstack, item.getEnergy(itemstack) - item.calculateEnergyCost(player, coords));
if(player instanceof EntityPlayerMP)
{
((EntityPlayerMP)player).playerNetServerHandler.ticksForFloatKick = 0;
}
if(world.provider.dimensionId != coords.dimensionId) if(world.provider.dimensionId != coords.dimensionId)
{ {

View file

@ -73,14 +73,14 @@ public class PacketTransmitterUpdate implements IMekanismPacket
if(transmitterType == 0) if(transmitterType == 0)
{ {
IGridTransmitter transmitter = (IGridTransmitter)world.getBlockTileEntity(x, y, z); TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if(transmitter != null) if(tileEntity instanceof IGridTransmitter)
{ {
transmitter.refreshTransmitterNetwork(); ((IGridTransmitter)tileEntity).refreshTransmitterNetwork();
} }
} }
if(transmitterType == 1) else if(transmitterType == 1)
{ {
double powerLevel = dataStream.readDouble(); double powerLevel = dataStream.readDouble();

View file

@ -54,7 +54,7 @@ public class TileEntityChargepad extends TileEntityElectricBlock implements IAct
{ {
isActive = false; isActive = false;
List<EntityLiving> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+0.2, zCoord+1)); List<EntityLivingBase> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+0.2, zCoord+1));
for(EntityLivingBase entity : entities) for(EntityLivingBase entity : entities)
{ {

View file

@ -85,7 +85,7 @@ public class TileEntityChemicalCrystalizer extends TileEntityElectricBlock imple
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, new int[] {2})); sideOutputs.add(new SideData(EnumColor.DARK_GREEN, new int[] {2}));
inventory = new ItemStack[3]; inventory = new ItemStack[3];
ejectorComponent = new TileComponentEjector(this, sideOutputs.get(1)); ejectorComponent = new TileComponentEjector(this, sideOutputs.get(2));
} }
@Override @Override

View file

@ -84,7 +84,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
{ {
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(inventory[0]); FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(inventory[0]);
if(fluidTank.getFluid() == null || fluid.isFluidEqual(fluidTank.getFluid()) && fluidTank.getFluid().amount+fluid.amount <= fluidTank.getCapacity()) if(fluid != null && fluidTank.getFluid() == null || fluid.isFluidEqual(fluidTank.getFluid()) && fluidTank.getFluid().amount+fluid.amount <= fluidTank.getCapacity())
{ {
fluidTank.fill(fluid, true); fluidTank.fill(fluid, true);

View file

@ -239,7 +239,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IPe
if(!worldObj.isRemote) if(!worldObj.isRemote)
{ {
int newScale = getScaledEnergyLevel(100); int newScale = getScaledEnergyLevel(20);
if(newScale != prevScale) if(newScale != prevScale)
{ {

View file

@ -85,9 +85,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
{ {
IInventory inventory = (IInventory)back; IInventory inventory = (IInventory)back;
InvStack inInventory = null; boolean sentItems = false;
boolean hasFilter = false;
EnumColor filterColor = color;
int min = 0; int min = 0;
for(TransporterFilter filter : filters) for(TransporterFilter filter : filters)
@ -98,10 +96,6 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
{ {
if(filter.canFilter(invStack.getStack())) if(filter.canFilter(invStack.getStack()))
{ {
filterColor = filter.color;
hasFilter = true;
inInventory = invStack;
if(filter instanceof TItemStackFilter) if(filter instanceof TItemStackFilter)
{ {
TItemStackFilter itemFilter = (TItemStackFilter)filter; TItemStackFilter itemFilter = (TItemStackFilter)filter;
@ -112,57 +106,35 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
} }
} }
ItemStack used = emitItemToTransporter(front, invStack, filter.color, min);
if(used != null)
{
invStack.use(used.stackSize);
inventory.onInventoryChanged();
setActive(true);
sentItems = true;
}
break; break;
} }
} }
} }
if(!hasFilter && autoEject) if(!sentItems && autoEject)
{ {
inInventory = InventoryUtils.takeTopStack(inventory, ForgeDirection.getOrientation(facing).getOpposite().ordinal(), new FirstFinder()); InvStack invStack = InventoryUtils.takeTopStack(inventory, ForgeDirection.getOrientation(facing).getOpposite().ordinal(), new FirstFinder());
}
if(inInventory != null && inInventory.getStack() != null) if(invStack != null && invStack.getStack() != null)
{
ItemStack used = null;
if(front instanceof ILogisticalTransporter)
{ {
ILogisticalTransporter transporter = (ILogisticalTransporter)front; ItemStack used = emitItemToTransporter(front, invStack, null, 0);
if(!roundRobin) if(used != null)
{ {
ItemStack rejects = TransporterUtils.insert(this, transporter, inInventory.getStack(), filterColor, true, min); invStack.use(used.stackSize);
inventory.onInventoryChanged();
if(TransporterManager.didEmit(inInventory.getStack(), rejects)) setActive(true);
{
used = TransporterManager.getToUse(inInventory.getStack(), rejects);
}
} }
else {
ItemStack rejects = TransporterUtils.insertRR(this, transporter, inInventory.getStack(), filterColor, true, min);
if(TransporterManager.didEmit(inInventory.getStack(), rejects))
{
used = TransporterManager.getToUse(inInventory.getStack(), rejects);
}
}
}
else if(front instanceof IInventory)
{
ItemStack rejects = InventoryUtils.putStackInInventory((IInventory)front, inInventory.getStack(), facing, false);
if(TransporterManager.didEmit(inInventory.getStack(), rejects))
{
used = TransporterManager.getToUse(inInventory.getStack(), rejects);
}
}
if(used != null)
{
inInventory.use(used.stackSize);
inventory.onInventoryChanged();
setActive(true);
} }
} }
@ -180,6 +152,48 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
} }
} }
/*
* Returns used
*/
public ItemStack emitItemToTransporter(TileEntity front, InvStack inInventory, EnumColor filterColor, int min)
{
ItemStack used = null;
if(front instanceof ILogisticalTransporter)
{
ILogisticalTransporter transporter = (ILogisticalTransporter)front;
if(!roundRobin)
{
ItemStack rejects = TransporterUtils.insert(this, transporter, inInventory.getStack(), filterColor, true, min);
if(TransporterManager.didEmit(inInventory.getStack(), rejects))
{
used = TransporterManager.getToUse(inInventory.getStack(), rejects);
}
}
else {
ItemStack rejects = TransporterUtils.insertRR(this, transporter, inInventory.getStack(), filterColor, true, min);
if(TransporterManager.didEmit(inInventory.getStack(), rejects))
{
used = TransporterManager.getToUse(inInventory.getStack(), rejects);
}
}
}
else if(front instanceof IInventory)
{
ItemStack rejects = InventoryUtils.putStackInInventory((IInventory)front, inInventory.getStack(), facing, false);
if(TransporterManager.didEmit(inInventory.getStack(), rejects))
{
used = TransporterManager.getToUse(inInventory.getStack(), rejects);
}
}
return used;
}
@Override @Override
public void writeToNBT(NBTTagCompound nbtTags) public void writeToNBT(NBTTagCompound nbtTags)
{ {
@ -540,4 +554,4 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
{ {
return true; return true;
} }
} }

View file

@ -35,7 +35,7 @@ import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "6.0.4", dependencies = "required-after:Mekanism") @Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "6.0.5", dependencies = "required-after:Mekanism")
@NetworkMod(clientSideRequired = true, serverSideRequired = false) @NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class MekanismGenerators implements IModule public class MekanismGenerators implements IModule
{ {
@ -46,7 +46,7 @@ public class MekanismGenerators implements IModule
public static MekanismGenerators instance; public static MekanismGenerators instance;
/** MekanismGenerators version number */ /** MekanismGenerators version number */
public static Version versionNumber = new Version(6, 0, 4); public static Version versionNumber = new Version(6, 0, 5);
//Items //Items
public static Item BioFuel; public static Item BioFuel;

View file

@ -13,7 +13,7 @@ public class TileEntityAdvancedSolarGenerator extends TileEntitySolarGenerator i
{ {
public TileEntityAdvancedSolarGenerator() public TileEntityAdvancedSolarGenerator()
{ {
super("AdvancedSolarGenerator", 200000, 360, MekanismGenerators.advancedSolarGeneration*2); super("AdvancedSolarGenerator", 200000, MekanismGenerators.advancedSolarGeneration*2);
GENERATION_RATE = MekanismGenerators.advancedSolarGeneration; GENERATION_RATE = MekanismGenerators.advancedSolarGeneration;
} }

View file

@ -34,10 +34,9 @@ public class TileEntitySolarGenerator extends TileEntityGenerator
inventory = new ItemStack[1]; inventory = new ItemStack[1];
} }
public TileEntitySolarGenerator(String name, double maxEnergy, double output, double generation) public TileEntitySolarGenerator(String name, double maxEnergy, double output)
{ {
super(name, maxEnergy, output); super(name, maxEnergy, output);
GENERATION_RATE = generation;
inventory = new ItemStack[1]; inventory = new ItemStack[1];
} }

View file

@ -35,7 +35,7 @@ import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "MekanismTools", name = "MekanismTools", version = "6.0.4", dependencies = "required-after:Mekanism") @Mod(modid = "MekanismTools", name = "MekanismTools", version = "6.0.5", dependencies = "required-after:Mekanism")
@NetworkMod(clientSideRequired = true, serverSideRequired = false) @NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class MekanismTools implements IModule public class MekanismTools implements IModule
{ {
@ -43,7 +43,7 @@ public class MekanismTools implements IModule
public static MekanismTools instance; public static MekanismTools instance;
/** MekanismTools version number */ /** MekanismTools version number */
public static Version versionNumber = new Version(6, 0, 4); public static Version versionNumber = new Version(6, 0, 5);
//Enums: Tools //Enums: Tools
public static EnumToolMaterial toolOBSIDIAN; public static EnumToolMaterial toolOBSIDIAN;

View file

@ -3,7 +3,7 @@
"modid": "Mekanism", "modid": "Mekanism",
"name": "Mekanism", "name": "Mekanism",
"description": "Energy, Armor, Tools, Weapons, Machines, Magic.", "description": "Energy, Armor, Tools, Weapons, Machines, Magic.",
"version": "6.0.4", "version": "6.0.5",
"mcversion": "1.6.4", "mcversion": "1.6.4",
"updateUrl": "", "updateUrl": "",
"authors": [ "authors": [

View file

@ -3,7 +3,7 @@
"modid": "MekanismGenerators", "modid": "MekanismGenerators",
"name": "MekanismGenerators", "name": "MekanismGenerators",
"description": "Generators module of Mekanism.", "description": "Generators module of Mekanism.",
"version": "6.0.4", "version": "6.0.5",
"mcversion": "1.6.4", "mcversion": "1.6.4",
"updateUrl": "", "updateUrl": "",
"authors": [ "authors": [

View file

@ -3,7 +3,7 @@
"modid": "MekanismTools", "modid": "MekanismTools",
"name": "MekanismTools", "name": "MekanismTools",
"description": "Tools module for Mekanism.", "description": "Tools module for Mekanism.",
"version": "6.0.4", "version": "6.0.5",
"mcversion": "1.6.4", "mcversion": "1.6.4",
"updateUrl": "", "updateUrl": "",
"authors": [ "authors": [