Merge branch 'master' into mc179
This commit is contained in:
commit
06f91d8936
8 changed files with 106 additions and 3 deletions
|
@ -0,0 +1,10 @@
|
|||
--- ../src-base/minecraft/net/minecraft/util/AxisAlignedBB.java
|
||||
+++ ../src-work/minecraft/net/minecraft/util/AxisAlignedBB.java
|
||||
@@ -23,6 +23,7 @@
|
||||
return new AxisAlignedBB(p_72330_0_, p_72330_2_, p_72330_4_, p_72330_6_, p_72330_8_, p_72330_10_);
|
||||
}
|
||||
|
||||
+ @Deprecated /* This method has been deprecated as it no longer exists in 1.7.10. Use getBoundingBox directly. */
|
||||
public static AABBPool func_72332_a()
|
||||
{
|
||||
return (AABBPool)field_72335_g.get();
|
|
@ -0,0 +1,10 @@
|
|||
--- ../src-base/minecraft/net/minecraft/world/ChunkCache.java
|
||||
+++ ../src-work/minecraft/net/minecraft/world/ChunkCache.java
|
||||
@@ -133,6 +133,7 @@
|
||||
return this.field_72815_e.func_72807_a(p_72807_1_, p_72807_2_);
|
||||
}
|
||||
|
||||
+ @Deprecated /* gone in 1.7.10, use direct access to Vec3.createVectorHelper instead */
|
||||
public Vec3Pool func_82732_R()
|
||||
{
|
||||
return this.field_72815_e.func_82732_R();
|
|
@ -0,0 +1,10 @@
|
|||
--- ../src-base/minecraft/net/minecraft/world/IBlockAccess.java
|
||||
+++ ../src-work/minecraft/net/minecraft/world/IBlockAccess.java
|
||||
@@ -30,6 +30,7 @@
|
||||
@SideOnly(Side.CLIENT)
|
||||
boolean func_72806_N();
|
||||
|
||||
+ @Deprecated /* gone in 1.7.10, use direct access to Vec3.createVectorHelper instead */
|
||||
Vec3Pool func_82732_R();
|
||||
|
||||
int func_72879_k(int var1, int var2, int var3, int var4);
|
|
@ -26,3 +26,11 @@
|
|||
}
|
||||
|
||||
public CrashReportCategory func_72914_a(CrashReport p_72914_1_)
|
||||
@@ -3615,6 +3615,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ @Deprecated /* gone in 1.7.10, use direct access to Vec3.createVectorHelper instead */
|
||||
public Vec3Pool func_82732_R()
|
||||
{
|
||||
return this.field_82741_K;
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.google.common.collect.Lists;
|
|||
import com.google.common.collect.Maps;
|
||||
|
||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
import cpw.mods.fml.relauncher.FMLSecurityManager;
|
||||
|
||||
public class FMLTweaker implements ITweaker {
|
||||
private File gameDir;
|
||||
|
@ -26,6 +27,17 @@ public class FMLTweaker implements ITweaker {
|
|||
private List<String> standaloneArgs;
|
||||
private static URI jarLocation;
|
||||
|
||||
public FMLTweaker()
|
||||
{
|
||||
try
|
||||
{
|
||||
System.setSecurityManager(new FMLSecurityManager());
|
||||
}
|
||||
catch (SecurityException se)
|
||||
{
|
||||
throw new RuntimeException("FML was unable to install the security manager. The game will not start", se);
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile)
|
||||
|
|
|
@ -11,8 +11,12 @@ import net.minecraft.network.PacketBuffer;
|
|||
import net.minecraft.network.play.client.C17PacketCustomPayload;
|
||||
import net.minecraft.network.play.server.S3FPacketCustomPayload;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.core.helpers.Integers;
|
||||
import com.google.common.collect.ConcurrentHashMultiset;
|
||||
import com.google.common.collect.Multiset;
|
||||
import com.google.common.collect.Multiset.Entry;
|
||||
import com.google.common.collect.Multisets;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.FMLNetworkException;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.handshake.NetworkDispatcher;
|
||||
|
@ -24,7 +28,8 @@ public class FMLProxyPacket extends Packet {
|
|||
private final ByteBuf payload;
|
||||
private INetHandler netHandler;
|
||||
private NetworkDispatcher dispatcher;
|
||||
|
||||
private static Multiset<String> badPackets = ConcurrentHashMultiset.create();
|
||||
private static int packetCountWarning = Integers.parseInt(System.getProperty("fml.badPacketCounter", "100"), 100);
|
||||
private FMLProxyPacket(byte[] payload, String channel)
|
||||
{
|
||||
this(Unpooled.wrappedBuffer(payload), channel);
|
||||
|
@ -71,7 +76,17 @@ public class FMLProxyPacket extends Packet {
|
|||
{
|
||||
if (internalChannel.writeInbound(this))
|
||||
{
|
||||
FMLLog.severe("Messages for channel %s for side %s were not processed by the embedded channel %s.\n They have been dropped.\n%s", this.channel, this.target, internalChannel.inboundMessages(), ByteBufUtils.getContentDump(this.payload));
|
||||
badPackets.add(this.channel);
|
||||
if (badPackets.size() % packetCountWarning == 0)
|
||||
{
|
||||
FMLLog.severe("Detected ongoing potential memory leak. %d packets have leaked. Top offenders", badPackets.size());
|
||||
int i = 0;
|
||||
for (Entry<String> s : Multisets.copyHighestCountFirst(badPackets).entrySet())
|
||||
{
|
||||
if (i++ > 10) break;
|
||||
FMLLog.severe("\t %s : %d", s.getElement(), s.getCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
internalChannel.inboundMessages().clear();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import org.apache.logging.log4j.Level;
|
|||
import net.minecraft.network.INetHandler;
|
||||
import com.google.common.base.Throwables;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.network.FMLOutboundHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
|
@ -33,6 +34,7 @@ public class SimpleChannelHandlerWrapper<REQ extends IMessage, REPLY extends IMe
|
|||
REPLY result = messageHandler.onMessage(msg, context);
|
||||
if (result != null)
|
||||
{
|
||||
ctx.channel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.REPLY);
|
||||
ctx.writeAndFlush(result).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package cpw.mods.fml.relauncher;
|
||||
|
||||
import java.security.Permission;
|
||||
|
||||
/**
|
||||
* A custom security manager stopping certain events from happening
|
||||
* unexpectedly.
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public class FMLSecurityManager extends SecurityManager {
|
||||
@Override
|
||||
public void checkPermission(Permission perm)
|
||||
{
|
||||
String permName = perm.getName() != null ? perm.getName() : "missing";
|
||||
if (permName.startsWith("exitVM"))
|
||||
{
|
||||
String callingClass = getClassContext()[4].getName();
|
||||
// FML is allowed to call system exit
|
||||
if (!callingClass.startsWith("cpw.mods.fml."))
|
||||
{
|
||||
throw new ExitTrappedException();
|
||||
}
|
||||
}
|
||||
else if ("setSecurityManager".equals(permName))
|
||||
{
|
||||
throw new SecurityException("Cannot replace the FML security manager");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static class ExitTrappedException extends SecurityException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue