Merge branch '6.5.x' of github.com:BuildCraft/BuildCraft into 6.5.x

This commit is contained in:
Adrian 2015-05-07 19:15:59 +02:00
commit 44c9e6f56b
3 changed files with 45 additions and 7 deletions

View file

@ -96,6 +96,7 @@ import buildcraft.core.lib.engines.TileEngineBase;
import buildcraft.core.lib.network.ChannelHandler;
import buildcraft.core.lib.utils.ColorUtils;
import buildcraft.core.lib.utils.NBTUtils;
import buildcraft.core.lib.utils.Utils;
import buildcraft.core.lib.utils.XorShift128Random;
import buildcraft.core.network.PacketHandlerCore;
import buildcraft.core.properties.WorldPropertyIsDirt;
@ -447,6 +448,28 @@ public class BuildCraftCore extends BuildCraftMod {
@Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event) {
event.registerServerCommand(commandBuildcraft);
if (Utils.CAULDRON_DETECTED) {
BCLog.logger.warn("############################################");
BCLog.logger.warn("# #");
BCLog.logger.warn("# Cauldron has been detected! Please keep #");
BCLog.logger.warn("# in mind that BuildCraft does NOT support #");
BCLog.logger.warn("# Cauldron and we do not promise to fix #");
BCLog.logger.warn("# bugs caused by its modifications to the #");
BCLog.logger.warn("# Minecraft engine. Please reconsider. #");
BCLog.logger.warn("# #");
BCLog.logger.warn("# Any lag caused by BuildCraft on top of #");
BCLog.logger.warn("# Cauldron likely arises from our fixes to #");
BCLog.logger.warn("# their bugs, so please don't report that #");
BCLog.logger.warn("# either. Thanks for your attention! ~BC #");
BCLog.logger.warn("# #");
BCLog.logger.warn("############################################");
// To people reading that code and thinking we're lying:
// Cauldron does not invalidate tile entities properly, causing
// issues with our tile entity cache. That is the bug and that
// is also the reason for the extra lag caused when using Cauldron.
}
}
@Mod.EventHandler

View file

@ -14,6 +14,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.SafeTimeTracker;
import buildcraft.core.lib.utils.BlockUtils;
import buildcraft.core.lib.utils.Utils;
public final class TileBuffer {
@ -56,11 +57,14 @@ public final class TileBuffer {
tracker.markTime(world);
}
public Block getBlock() {
if ((tile != null && tile.isInvalid()) || (tile == null && tracker.markTimeIfDelay(world))) {
private void tryRefresh() {
if (Utils.CAULDRON_DETECTED || (tile != null && tile.isInvalid()) || (tile == null && tracker.markTimeIfDelay(world))) {
refresh();
}
}
public Block getBlock() {
tryRefresh();
return block;
}
@ -70,11 +74,11 @@ public final class TileBuffer {
}
public TileEntity getTile(boolean forceUpdate) {
if (tile != null && !tile.isInvalid()) {
if (!Utils.CAULDRON_DETECTED && tile != null && !tile.isInvalid()) {
return tile;
}
if ((forceUpdate && tile != null && tile.isInvalid()) || tracker.markTimeIfDelay(world)) {
if (Utils.CAULDRON_DETECTED || (forceUpdate && tile != null && tile.isInvalid()) || tracker.markTimeIfDelay(world)) {
refresh();
if (tile != null && !tile.isInvalid()) {
@ -86,7 +90,7 @@ public final class TileBuffer {
}
public boolean exists() {
if (tile != null && !tile.isInvalid()) {
if (tile != null && !Utils.CAULDRON_DETECTED && !tile.isInvalid()) {
return true;
}

View file

@ -49,10 +49,21 @@ import buildcraft.core.lib.network.Packet;
import buildcraft.core.proxy.CoreProxy;
public final class Utils {
public static final boolean CAULDRON_DETECTED;
public static final XorShift128Random RANDOM = new XorShift128Random();
private static final List<ForgeDirection> directions = new ArrayList<ForgeDirection>(Arrays.asList(ForgeDirection.VALID_DIRECTIONS));
static {
boolean cauldron = false;
try {
cauldron = Utils.class.getClassLoader().loadClass("org.spigotmc.SpigotConfig") != null;
} catch (ClassNotFoundException e) {
}
CAULDRON_DETECTED = cauldron;
}
/**
* Deactivate constructor
*/