clean things up, prepare for 7.0.9

This commit is contained in:
asiekierka 2015-06-11 09:26:14 +02:00
parent 821936c3cb
commit 085dff9876
9 changed files with 45 additions and 30 deletions

View file

@ -22,7 +22,7 @@ apply plugin: 'forge' // adds the forge dependency
apply plugin: 'maven' // for uploading to a maven repo
apply plugin: 'checkstyle'
version = "7.0.8"
version = "7.0.9"
group= "com.mod-buildcraft"
archivesBaseName = "buildcraft" // the name that all artifacts will use as a base. artifacts names follow this pattern: [baseName]-[appendix]-[version]-[classifier].[extension]

View file

@ -12,6 +12,9 @@ Improvements:
Bug fixes:
* [#2785] Water springs do not generate correctly (asie - thanks a lot SpwnX)
* [#2782] CME in EntityTracker (asie)
* [#2781] Crash with RailCraft rails and BC tanks (asie)
* [#2770] Mojang's ambient occlusion assumes full blocks (asie)
* [#2765] CME with PacketSender (asie)
* [#2743] DockingStationPipes kept track of invalid pipes (asie)

View file

@ -1,3 +1,3 @@
1.6.4:BuildCraft:4.2.2
1.7.2:BuildCraft:6.0.16
1.7.10:BuildCraft:7.0.8
1.7.10:BuildCraft:7.0.9

View file

@ -183,11 +183,14 @@ public class BuildCraftRobotics extends BuildCraftMod {
public static MapManager manager;
private static Thread managerThread;
private boolean noThreadedZoneMapGen;
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent evt) {
new BCCreativeTab("boards");
BuildCraftCore.mainConfigManager.register("general", "boards.blacklist", new String[]{}, "Blacklisted robots boards", ConfigManager.RestartRequirement.GAME);
BuildCraftCore.mainConfigManager.register("experimental", "disableThreadedZoneMapGen", false, "If you're getting frequent EntityTracker crashes, report and turn this on! The option will be removed when we're sure we resolved the bug.\nDO NOT turn this option on if you're not experiencing any issues as it WILL cause slower game performance.", ConfigManager.RestartRequirement.GAME);
reloadConfig(ConfigManager.RestartRequirement.GAME);
@ -386,9 +389,12 @@ public class BuildCraftRobotics extends BuildCraftMod {
@Mod.EventHandler
public void serverUnload(FMLServerStoppingEvent event) {
if (managerThread != null) {
if (manager != null) {
manager.stop();
manager.saveAllWorlds();
}
if (managerThread != null) {
managerThread.interrupt();
MinecraftForge.EVENT_BUS.unregister(manager);
@ -409,9 +415,11 @@ public class BuildCraftRobotics extends BuildCraftMod {
e.printStackTrace();
}
manager = new MapManager(f);
managerThread = new Thread(manager);
managerThread.start();
manager = new MapManager(f, !noThreadedZoneMapGen);
if (noThreadedZoneMapGen) {
managerThread = new Thread(manager);
managerThread.start();
}
MinecraftForge.EVENT_BUS.register(manager);
FMLCommonHandler.instance().bus().register(manager);
@ -424,6 +432,8 @@ public class BuildCraftRobotics extends BuildCraftMod {
public void reloadConfig(ConfigManager.RestartRequirement restartType) {
if (restartType == ConfigManager.RestartRequirement.GAME) {
noThreadedZoneMapGen = BuildCraftCore.mainConfigManager.get("experimental.disableThreadedZoneMapGen").getBoolean();
blacklistedRobots = new ArrayList<String>();
blacklistedRobots.addAll(Arrays.asList(BuildCraftCore.mainConfigManager.get("general",
"boards.blacklist").getStringList()));

View file

@ -41,7 +41,6 @@ public class SpringPopulate {
}
private void doPopulate(World world, Random random, int x, int z) {
// A spring will be generated every 40th chunk.
if (random.nextFloat() > 0.025f) {
return;

View file

@ -8,9 +8,6 @@
*/
package buildcraft.core.lib.network;
import gnu.trove.map.hash.TByteObjectHashMap;
import gnu.trove.map.hash.TObjectByteHashMap;
import java.lang.ref.WeakReference;
import java.util.List;
import org.apache.logging.log4j.Level;
@ -20,6 +17,9 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageCodec;
import io.netty.util.AttributeKey;
import gnu.trove.map.hash.TByteObjectHashMap;
import gnu.trove.map.hash.TObjectByteHashMap;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
@ -56,8 +56,7 @@ public final class ChannelHandler extends MessageToMessageCodec<FMLProxyPacket,
}
@Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception
{
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
super.handlerAdded(ctx);
ctx.attr(INBOUNDPACKETTRACKER).set(new ThreadLocal<WeakReference<FMLProxyPacket>>());
}
@ -69,7 +68,7 @@ public final class ChannelHandler extends MessageToMessageCodec<FMLProxyPacket,
}
@Override
protected final void encode(ChannelHandlerContext ctx, Packet msg, List<Object> out) throws Exception {
protected void encode(ChannelHandlerContext ctx, Packet msg, List<Object> out) throws Exception {
ByteBuf buffer = Unpooled.buffer();
Class<? extends Packet> clazz = msg.getClass();
byte discriminator = types.get(clazz);
@ -78,22 +77,19 @@ public final class ChannelHandler extends MessageToMessageCodec<FMLProxyPacket,
FMLProxyPacket proxy = new FMLProxyPacket(buffer.copy(), ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get());
WeakReference<FMLProxyPacket> ref = ctx.attr(INBOUNDPACKETTRACKER).get().get();
FMLProxyPacket old = ref == null ? null : ref.get();
if (old != null)
{
if (old != null) {
proxy.setDispatcher(old.getDispatcher());
}
out.add(proxy);
}
@Override
protected final void decode(ChannelHandlerContext ctx, FMLProxyPacket msg, List<Object> out) throws Exception
{
protected void decode(ChannelHandlerContext ctx, FMLProxyPacket msg, List<Object> out) throws Exception {
testMessageValidity(msg);
ByteBuf payload = msg.payload();
byte discriminator = payload.readByte();
Class<? extends Packet> clazz = discriminators.get(discriminator);
if(clazz == null)
{
if (clazz == null) {
throw new NullPointerException("Undefined message for discriminator " + discriminator + " in channel " + msg.channel());
}
Packet newMsg = clazz.newInstance();
@ -107,14 +103,12 @@ public final class ChannelHandler extends MessageToMessageCodec<FMLProxyPacket,
* say due to a weird protocol mismatch. Use with caution.
* @param msg
*/
protected void testMessageValidity(FMLProxyPacket msg)
{
protected void testMessageValidity(FMLProxyPacket msg) {
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
{
FMLLog.log(Level.ERROR, cause, "FMLIndexedMessageCodec exception caught");
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
FMLLog.log(Level.ERROR, cause, "BC ChannelHandler exception caught");
super.exceptionCaught(ctx, cause);
}

View file

@ -1099,7 +1099,7 @@ public class EntityRobot extends EntityRobotBase implements
return true;
} else if (wearables.size() < 8 && stack.getItem() instanceof ItemSkull) {
if (!worldObj.isRemote) {
ItemStack skullStack =stack.splitStack(1);
ItemStack skullStack = stack.splitStack(1);
initSkullItem(skullStack);
wearables.add(skullStack);
syncWearablesToClient();

View file

@ -2,8 +2,6 @@ package buildcraft.robotics.map;
import java.io.File;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import com.google.common.collect.HashBiMap;
@ -17,11 +15,13 @@ import net.minecraftforge.event.world.ChunkEvent;
public class MapManager implements Runnable {
private final HashBiMap<World, MapWorld> worldMap = HashBiMap.create();
private final File location;
private final boolean isThreaded;
private boolean stop = false;
private long lastSaveTime;
public MapManager(File location) {
public MapManager(File location, boolean isThreaded) {
this.location = location;
this.isThreaded = isThreaded;
}
public void stop() {
@ -41,6 +41,17 @@ public class MapManager implements Runnable {
return worldMap.get(world);
}
@SubscribeEvent
public void serverTick(TickEvent.ServerTickEvent event) {
if (!isThreaded && event.phase == TickEvent.Phase.END) {
synchronized (worldMap) {
for (MapWorld world : worldMap.values()) {
world.updateChunkInQueue();
}
}
}
}
@SubscribeEvent
public void chunkLoaded(ChunkEvent.Load event) {
MapWorld world = getWorld(event.getChunk().worldObj);

View file

@ -6,7 +6,6 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Comparator;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.PriorityQueue;
@ -18,7 +17,6 @@ import gnu.trove.map.hash.TLongObjectHashMap;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import buildcraft.BuildCraftRobotics;
import buildcraft.core.lib.utils.NBTUtils;
import buildcraft.core.lib.utils.ThreadSafeUtils;