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'
}
version = "6.0.4." + "$System.env.BUILD_NUMBER"
version = "6.0.5." + "$System.env.BUILD_NUMBER"
archivesBaseName = "MekanismAll"
libsDirName = "../output"
distsDirName = "../output"

View file

@ -3,4 +3,4 @@ dir.mcp=${dir.development}forge/mcp
version.minecraft=1.6.4
version.mod.major=6
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 net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge;
@ -29,6 +30,8 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
private List<DelayQueue> updateQueue = new ArrayList<DelayQueue>();
protected AxisAlignedBB packetRange = null;
protected int ticksSinceCreate = 0;
protected boolean fixed = false;
@ -51,6 +54,65 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
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
public void removeTransmitter(IGridTransmitter<N> transmitter)
{

View file

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

View file

@ -49,7 +49,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
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();

View file

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

View file

@ -159,7 +159,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
* @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)
public class Mekanism
{
@ -184,7 +184,7 @@ public class Mekanism
public static Configuration configuration;
/** Mekanism version number */
public static Version versionNumber = new Version(6, 0, 4);
public static Version versionNumber = new Version(6, 0, 5);
/** Map of Teleporters */
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, 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.oreNetherQuartz), new ItemStack(Item.netherQuartz, 2));
//Combiner recipes
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("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())
{
if(gas instanceof OreGas && !((OreGas)gas).isClean())
@ -749,6 +750,9 @@ public class Mekanism
}
}
//Chemical Dissolution Chamber Recipes
RecipeHandler.addChemicalDissolutionChamberRecipe(new ItemStack(Block.obsidian), new GasStack(GasRegistry.getGas("obsidian"), 1000));
//Infuse objects
InfuseRegistry.registerInfuseObject(new ItemStack(Item.coal, 1, 0), new InfuseObject(InfuseRegistry.get("CARBON"), 10));
InfuseRegistry.registerInfuseObject(new ItemStack(Item.coal, 1, 1), new InfuseObject(InfuseRegistry.get("CARBON"), 20));
@ -1245,7 +1249,7 @@ public class Mekanism
public void onEnergyTransferred(EnergyTransferEvent event)
{
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) {}
}
@ -1253,7 +1257,7 @@ public class Mekanism
public void onGasTransferred(GasTransferEvent event)
{
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) {}
}
@ -1261,7 +1265,7 @@ public class Mekanism
public void onLiquidTransferred(FluidTransferEvent event)
{
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) {}
}

View file

@ -10,7 +10,10 @@ import mekanism.common.network.IMekanismPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
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.ByteStreams;
@ -187,6 +190,9 @@ public class PacketHandler implements IPacketHandler
Coord4D obj = (Coord4D)transParams[0];
PacketDispatcher.sendPacketToAllAround(obj.xCoord, obj.yCoord, obj.zCoord, (Double)transParams[1], obj.dimensionId, packet);
break;
case CLIENTS_CUBOID:
sendToCuboid(packet, (AxisAlignedBB)transParams[0], (Integer)transParams[1]);
break;
case CLIENTS_DIM:
PacketDispatcher.sendPacketToAllInDimension(packet, (Integer)transParams[0]);
break;
@ -198,6 +204,22 @@ public class PacketHandler implements IPacketHandler
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.
* @param trans - transmission type this packet used when it was sent
@ -219,6 +241,9 @@ public class PacketHandler implements IPacketHandler
case CLIENTS_RANGE:
System.out.println("[Mekanism] Sent '" + packetType.getName() + "' packet to clients in a " + (Double)transParams[1] + " block range.");
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:
System.out.println("[Mekanism] Sent '" + packetType.getName() + "' packet to clients in dimension ID " + (Integer)transParams[0] + ".");
break;
@ -240,6 +265,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. */
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. */
CLIENTS_DIM(1),

View file

@ -160,7 +160,7 @@ public class PartMechanicalPipe extends PartTransmitter<FluidNetwork> implements
{
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 toSave = getTransmitterNetwork().fluidStored.amount/getTransmitterNetwork().transmitters.size();

View file

@ -149,7 +149,7 @@ public class PartPressurizedTube extends PartTransmitter<GasNetwork>
{
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 toSave = getTransmitterNetwork().gasStored.amount/getTransmitterNetwork().transmitters.size();

View file

@ -218,6 +218,12 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa
}
}
@Override
public Coord4D getLocation()
{
return Coord4D.get(tile());
}
@Override
public void chunkLoad() {}
}

View file

@ -55,6 +55,11 @@ public class PacketPortableTeleport implements IMekanismPacket
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)
{
((EntityPlayerMP)player).travelToDimension(coords.dimensionId);

View file

@ -73,14 +73,14 @@ public class PacketTransmitterUpdate implements IMekanismPacket
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();

View file

@ -54,7 +54,7 @@ public class TileEntityChargepad extends TileEntityElectricBlock implements IAct
{
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)
{

View file

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

View file

@ -84,7 +84,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
{
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);

View file

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

View file

@ -85,9 +85,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
{
IInventory inventory = (IInventory)back;
InvStack inInventory = null;
boolean hasFilter = false;
EnumColor filterColor = color;
boolean sentItems = false;
int min = 0;
for(TransporterFilter filter : filters)
@ -98,10 +96,6 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
{
if(filter.canFilter(invStack.getStack()))
{
filterColor = filter.color;
hasFilter = true;
inInventory = invStack;
if(filter instanceof TItemStackFilter)
{
TItemStackFilter itemFilter = (TItemStackFilter)filter;
@ -112,17 +106,56 @@ 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;
}
}
}
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(invStack != null && invStack.getStack() != null)
{
ItemStack used = emitItemToTransporter(front, invStack, null, 0);
if(used != null)
{
invStack.use(used.stackSize);
inventory.onInventoryChanged();
setActive(true);
}
}
}
if(inInventory != null && inInventory.getStack() != null)
delayTicks = 10;
}
}
if(playersUsing.size() > 0)
{
for(EntityPlayer player : playersUsing)
{
PacketHandler.sendPacket(Transmission.SINGLE_CLIENT, new PacketTileEntity().setParams(Coord4D.get(this), getGenericPacket(new ArrayList())), player);
}
}
}
}
/*
* Returns used
*/
public ItemStack emitItemToTransporter(TileEntity front, InvStack inInventory, EnumColor filterColor, int min)
{
ItemStack used = null;
@ -158,26 +191,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
}
}
if(used != null)
{
inInventory.use(used.stackSize);
inventory.onInventoryChanged();
setActive(true);
}
}
delayTicks = 10;
}
}
if(playersUsing.size() > 0)
{
for(EntityPlayer player : playersUsing)
{
PacketHandler.sendPacket(Transmission.SINGLE_CLIENT, new PacketTileEntity().setParams(Coord4D.get(this), getGenericPacket(new ArrayList())), player);
}
}
}
return used;
}
@Override

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.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)
public class MekanismGenerators implements IModule
{
@ -46,7 +46,7 @@ public class MekanismGenerators implements IModule
public static MekanismGenerators instance;
/** MekanismGenerators version number */
public static Version versionNumber = new Version(6, 0, 4);
public static Version versionNumber = new Version(6, 0, 5);
//Items
public static Item BioFuel;

View file

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

View file

@ -34,10 +34,9 @@ public class TileEntitySolarGenerator extends TileEntityGenerator
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);
GENERATION_RATE = generation;
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.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)
public class MekanismTools implements IModule
{
@ -43,7 +43,7 @@ public class MekanismTools implements IModule
public static MekanismTools instance;
/** MekanismTools version number */
public static Version versionNumber = new Version(6, 0, 4);
public static Version versionNumber = new Version(6, 0, 5);
//Enums: Tools
public static EnumToolMaterial toolOBSIDIAN;

View file

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

View file

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

View file

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