Compare commits

...
11 Commits
15 changed files with 233 additions and 68 deletions

No files matched your search

@@ -1,11 +1,12 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java
@@ -113,11 +113,14 @@
@@ -112,12 +112,15 @@
{
if (p_180546_1_.func_145835_a(this.field_147560_j, this.field_147561_k, this.field_147558_l) < p_180546_1_.func_145833_n())
{
RenderHelper.func_74519_b();
+ if(!drawingBatch || !p_180546_1_.hasFastRenderer())
+ {
RenderHelper.func_74519_b();
int i = this.field_147550_f.func_175626_b(p_180546_1_.func_174877_v(), 0);
int j = i % 65536;
int k = i / 65536;
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/entity/SharedMonsterAttributes.java
+++ ../src-work/minecraft/net/minecraft/entity/SharedMonsterAttributes.java
@@ -16,7 +16,7 @@
public class SharedMonsterAttributes
{
private static final Logger field_151476_f = LogManager.getLogger();
- public static final IAttribute field_111267_a = (new RangedAttribute((IAttribute)null, "generic.maxHealth", 20.0D, 0.0D, 1024.0D)).func_111117_a("Max Health").func_111112_a(true);
+ public static final IAttribute field_111267_a = (new RangedAttribute((IAttribute)null, "generic.maxHealth", 20.0D, Float.MIN_VALUE, 1024.0D)).func_111117_a("Max Health").func_111112_a(true); // Forge: set smallest max-health value to fix MC-119183. This gets rounded to float so we use the smallest positive float value.
public static final IAttribute field_111265_b = (new RangedAttribute((IAttribute)null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).func_111117_a("Follow Range");
public static final IAttribute field_111266_c = (new RangedAttribute((IAttribute)null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).func_111117_a("Knockback Resistance");
public static final IAttribute field_111263_d = (new RangedAttribute((IAttribute)null, "generic.movementSpeed", 0.699999988079071D, 0.0D, 1024.0D)).func_111117_a("Movement Speed").func_111112_a(true);
@@ -34,7 +34,15 @@
this.field_77994_a = p_i1881_2_;
this.field_77991_e = p_i1881_3_;
@@ -117,7 +123,7 @@
@@ -99,6 +105,7 @@
public static ItemStack func_77949_a(NBTTagCompound p_77949_0_)
{
+ if (p_77949_0_.func_82582_d()) return null; // Deserialized inventories can have empty ItemStack compounds. Fixes tons of NumberFormatExceptions
ItemStack itemstack = new ItemStack();
itemstack.func_77963_c(p_77949_0_);
return itemstack.func_77973_b() != null ? itemstack : null;
@@ -117,7 +124,7 @@
public ItemStack func_77979_a(int p_77979_1_)
{
p_77979_1_ = Math.min(p_77979_1_, this.field_77994_a);
@@ -43,7 +51,7 @@
if (this.field_77990_d != null)
{
@@ -130,11 +136,12 @@
@@ -130,11 +137,12 @@
public Item func_77973_b()
{
@@ -57,7 +65,7 @@
EnumActionResult enumactionresult = this.func_77973_b().func_180614_a(this, p_179546_1_, p_179546_2_, p_179546_3_, p_179546_4_, p_179546_5_, p_179546_6_, p_179546_7_, p_179546_8_);
if (enumactionresult == EnumActionResult.SUCCESS)
@@ -173,12 +180,20 @@
@@ -173,12 +181,20 @@
p_77955_1_.func_74782_a("tag", this.field_77990_d);
}
@@ -79,7 +87,7 @@
this.field_77994_a = p_77963_1_.func_74771_c("Count");
this.field_77991_e = p_77963_1_.func_74765_d("Damage");
@@ -196,11 +211,12 @@
@@ -196,11 +212,12 @@
this.field_151002_e.func_179215_a(this.field_77990_d);
}
}
@@ -93,7 +101,7 @@
}
public boolean func_77985_e()
@@ -210,7 +226,7 @@
@@ -210,7 +227,7 @@
public boolean func_77984_f()
{
@@ -102,7 +110,7 @@
}
public boolean func_77981_g()
@@ -220,32 +236,27 @@
@@ -220,32 +237,27 @@
public boolean func_77951_h()
{
@@ -140,7 +148,7 @@
}
public boolean func_96631_a(int p_96631_1_, Random p_96631_2_)
@@ -277,8 +288,8 @@
@@ -277,8 +289,8 @@
}
}
@@ -151,7 +159,7 @@
}
}
@@ -332,7 +343,7 @@
@@ -332,7 +344,7 @@
public boolean func_150998_b(IBlockState p_150998_1_)
{
@@ -160,7 +168,7 @@
}
public boolean func_111282_a(EntityPlayer p_111282_1_, EntityLivingBase p_111282_2_, EnumHand p_111282_3_)
@@ -342,7 +353,7 @@
@@ -342,7 +354,7 @@
public ItemStack func_77946_l()
{
@@ -169,7 +177,7 @@
if (this.field_77990_d != null)
{
@@ -354,7 +365,19 @@
@@ -354,7 +366,19 @@
public static boolean func_77970_a(@Nullable ItemStack p_77970_0_, @Nullable ItemStack p_77970_1_)
{
@@ -190,7 +198,7 @@
}
public static boolean func_77989_b(@Nullable ItemStack p_77989_0_, @Nullable ItemStack p_77989_1_)
@@ -364,7 +387,11 @@
@@ -364,7 +388,11 @@
private boolean func_77959_d(ItemStack p_77959_1_)
{
@@ -203,7 +211,7 @@
}
public static boolean func_179545_c(@Nullable ItemStack p_179545_0_, @Nullable ItemStack p_179545_1_)
@@ -764,6 +791,7 @@
@@ -764,6 +792,7 @@
}
}
@@ -211,7 +219,7 @@
return list;
}
@@ -875,7 +903,7 @@
@@ -875,7 +904,7 @@
}
else
{
@@ -220,7 +228,7 @@
}
return multimap;
@@ -908,6 +936,18 @@
@@ -908,6 +937,18 @@
@Deprecated
public void func_150996_a(Item p_150996_1_)
{
@@ -239,7 +247,7 @@
this.field_151002_e = p_150996_1_;
}
@@ -993,4 +1033,45 @@
@@ -993,4 +1034,45 @@
return false;
}
}
@@ -364,7 +364,7 @@
throw new ReportedException(crashreport1);
}
}
@@ -1682,7 +1796,7 @@
@@ -1682,11 +1796,11 @@
{
BlockPos blockpos = tileentity.func_174877_v();
@@ -373,6 +373,11 @@
{
try
{
- this.field_72984_F.func_76320_a(tileentity.getClass().getSimpleName());
+ this.field_72984_F.func_76320_a(this.field_72984_F.field_76327_a ? tileentity.getClass().getSimpleName() : ""); // Fix for MC-117087
((ITickable)tileentity).func_73660_a();
this.field_72984_F.func_76319_b();
}
@@ -1695,6 +1809,13 @@
CrashReport crashreport2 = CrashReport.func_85055_a(throwable, "Ticking block entity");
CrashReportCategory crashreportcategory2 = crashreport2.func_85058_a("Block entity being ticked");
@@ -387,7 +392,7 @@
throw new ReportedException(crashreport2);
}
}
@@ -1707,20 +1828,28 @@
@@ -1707,20 +1828,31 @@
if (this.func_175667_e(tileentity.func_174877_v()))
{
@@ -404,13 +409,18 @@
-
if (!this.field_147483_b.isEmpty())
{
- this.field_175730_i.removeAll(this.field_147483_b);
- this.field_147482_g.removeAll(this.field_147483_b);
+ for (Object tile : field_147483_b)
+ {
+ ((TileEntity)tile).onChunkUnload();
+ }
+
this.field_175730_i.removeAll(this.field_147483_b);
this.field_147482_g.removeAll(this.field_147483_b);
+ // forge: faster "contains" makes this removal much more efficient (MC-117075)
+ java.util.Set<TileEntity> remove = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<TileEntity, Boolean>());
+ remove.addAll(field_147483_b);
+ this.field_175730_i.removeAll(remove);
+ this.field_147482_g.removeAll(remove);
this.field_147483_b.clear();
}
@@ -419,7 +429,7 @@
this.field_72984_F.func_76318_c("pendingBlockEntities");
if (!this.field_147484_a.isEmpty())
@@ -1759,8 +1888,12 @@
@@ -1759,8 +1891,12 @@
public boolean func_175700_a(TileEntity p_175700_1_)
{
@@ -433,7 +443,7 @@
if (flag && p_175700_1_ instanceof ITickable)
{
this.field_175730_i.add(p_175700_1_);
@@ -1780,6 +1913,11 @@
@@ -1780,6 +1916,11 @@
{
if (this.field_147481_N)
{
@@ -445,7 +455,7 @@
this.field_147484_a.addAll(p_147448_1_);
}
else
@@ -1800,9 +1938,12 @@
@@ -1800,9 +1941,12 @@
{
int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t);
int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v);
@@ -460,7 +470,7 @@
{
p_72866_1_.field_70142_S = p_72866_1_.field_70165_t;
p_72866_1_.field_70137_T = p_72866_1_.field_70163_u;
@@ -2001,6 +2142,10 @@
@@ -2001,6 +2145,10 @@
blockpos$pooledmutableblockpos.func_185344_t();
return true;
}
@@ -471,7 +481,7 @@
}
}
}
@@ -2040,6 +2185,16 @@
@@ -2040,6 +2188,16 @@
IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos);
Block block = iblockstate.func_177230_c();
@@ -488,7 +498,7 @@
if (iblockstate.func_185904_a() == p_72918_2_)
{
double d0 = (double)((float)(l1 + 1) - BlockLiquid.func_149801_b(((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue()));
@@ -2116,6 +2271,9 @@
@@ -2116,6 +2274,9 @@
{
IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(k1, l1, i2));
@@ -498,7 +508,7 @@
if (iblockstate.func_185904_a() == p_72830_2_)
{
int j2 = ((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue();
@@ -2148,6 +2306,7 @@
@@ -2148,6 +2309,7 @@
public Explosion func_72885_a(@Nullable Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_)
{
Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_);
@@ -506,7 +516,7 @@
explosion.func_77278_a();
explosion.func_77279_a(true);
return explosion;
@@ -2270,6 +2429,7 @@
@@ -2270,6 +2432,7 @@
public void func_175690_a(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_)
{
@@ -514,7 +524,7 @@
if (!this.func_189509_E(p_175690_1_))
{
if (p_175690_2_ != null && !p_175690_2_.func_145837_r())
@@ -2277,6 +2437,8 @@
@@ -2277,6 +2440,8 @@
if (this.field_147481_N)
{
p_175690_2_.func_174878_a(p_175690_1_);
@@ -523,7 +533,7 @@
Iterator<TileEntity> iterator = this.field_147484_a.iterator();
while (iterator.hasNext())
@@ -2295,8 +2457,10 @@
@@ -2295,8 +2460,10 @@
else
{
this.func_175700_a(p_175690_2_);
@@ -535,7 +545,7 @@
}
}
}
@@ -2309,6 +2473,8 @@
@@ -2309,6 +2476,8 @@
{
tileentity.func_145843_s();
this.field_147484_a.remove(tileentity);
@@ -544,7 +554,7 @@
}
else
{
@@ -2321,6 +2487,7 @@
@@ -2321,6 +2490,7 @@
this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_);
}
@@ -552,7 +562,7 @@
}
public void func_147457_a(TileEntity p_147457_1_)
@@ -2347,7 +2514,7 @@
@@ -2347,7 +2517,7 @@
if (chunk != null && !chunk.func_76621_g())
{
IBlockState iblockstate = this.func_180495_p(p_175677_1_);
@@ -561,7 +571,7 @@
}
else
{
@@ -2370,6 +2537,7 @@
@@ -2370,6 +2540,7 @@
{
this.field_72985_G = p_72891_1_;
this.field_72992_H = p_72891_2_;
@@ -569,7 +579,7 @@
}
public void func_72835_b()
@@ -2379,6 +2547,11 @@
@@ -2379,6 +2550,11 @@
protected void func_72947_a()
{
@@ -581,7 +591,7 @@
if (this.field_72986_A.func_76059_o())
{
this.field_73004_o = 1.0F;
@@ -2392,6 +2565,11 @@
@@ -2392,6 +2568,11 @@
protected void func_72979_l()
{
@@ -593,7 +603,7 @@
if (!this.field_73011_w.func_177495_o())
{
if (!this.field_72995_K)
@@ -2511,6 +2689,11 @@
@@ -2511,6 +2692,11 @@
public boolean func_175670_e(BlockPos p_175670_1_, boolean p_175670_2_)
{
@@ -605,7 +615,7 @@
Biome biome = this.func_180494_b(p_175670_1_);
float f = biome.func_180626_a(p_175670_1_);
@@ -2552,6 +2735,11 @@
@@ -2552,6 +2738,11 @@
public boolean func_175708_f(BlockPos p_175708_1_, boolean p_175708_2_)
{
@@ -617,7 +627,7 @@
Biome biome = this.func_180494_b(p_175708_1_);
float f = biome.func_180626_a(p_175708_1_);
@@ -2569,7 +2757,7 @@
@@ -2569,7 +2760,7 @@
{
IBlockState iblockstate = this.func_180495_p(p_175708_1_);
@@ -626,7 +636,7 @@
{
return true;
}
@@ -2601,10 +2789,11 @@
@@ -2601,10 +2792,11 @@
else
{
IBlockState iblockstate = this.func_180495_p(p_175638_1_);
@@ -641,7 +651,15 @@
{
j = 1;
}
@@ -2703,7 +2892,7 @@
@@ -2638,6 +2830,7 @@
if (i >= 14)
{
+ blockpos$pooledmutableblockpos.func_185344_t();
return i;
}
}
@@ -2703,7 +2896,7 @@
int j4 = j2 + enumfacing.func_96559_d();
int k4 = k2 + enumfacing.func_82599_e();
blockpos$pooledmutableblockpos.func_181079_c(i4, j4, k4);
@@ -650,7 +668,7 @@
i3 = this.func_175642_b(p_180500_1_, blockpos$pooledmutableblockpos);
if (i3 == l2 - l4 && j < this.field_72994_J.length)
@@ -2811,10 +3000,10 @@
@@ -2811,10 +3004,10 @@
public List<Entity> func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate <? super Entity > p_175674_3_)
{
List<Entity> list = Lists.<Entity>newArrayList();
@@ -665,7 +683,7 @@
for (int i1 = i; i1 <= j; ++i1)
{
@@ -2867,10 +3056,10 @@
@@ -2867,10 +3060,10 @@
public <T extends Entity> List<T> func_175647_a(Class <? extends T > p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate <? super T > p_175647_3_)
{
@@ -680,7 +698,7 @@
List<T> list = Lists.<T>newArrayList();
for (int i1 = i; i1 < j; ++i1)
@@ -2950,11 +3139,13 @@
@@ -2950,11 +3143,13 @@
public void func_175650_b(Collection<Entity> p_175650_1_)
{
@@ -697,7 +715,7 @@
}
}
@@ -2967,7 +3158,7 @@
@@ -2967,7 +3162,7 @@
{
IBlockState iblockstate = this.func_180495_p(p_175716_2_);
AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.func_176223_P().func_185890_d(this, p_175716_2_);
@@ -706,7 +724,7 @@
}
public int func_181545_F()
@@ -3050,7 +3241,7 @@
@@ -3050,7 +3245,7 @@
public int func_175651_c(BlockPos p_175651_1_, EnumFacing p_175651_2_)
{
IBlockState iblockstate = this.func_180495_p(p_175651_1_);
@@ -715,7 +733,7 @@
}
public boolean func_175640_z(BlockPos p_175640_1_)
@@ -3185,7 +3376,7 @@
@@ -3185,7 +3380,7 @@
{
d2 *= ((Double)Objects.firstNonNull(p_184150_11_.apply(entityplayer1), Double.valueOf(1.0D))).doubleValue();
}
@@ -724,7 +742,7 @@
if ((p_184150_9_ < 0.0D || Math.abs(entityplayer1.field_70163_u - p_184150_3_) < p_184150_9_ * p_184150_9_) && (p_184150_7_ < 0.0D || d1 < d2 * d2) && (d0 == -1.0D || d1 < d0))
{
d0 = d1;
@@ -3247,7 +3438,7 @@
@@ -3247,7 +3442,7 @@
public long func_72905_C()
{
@@ -733,7 +751,7 @@
}
public long func_82737_E()
@@ -3257,17 +3448,17 @@
@@ -3257,17 +3452,17 @@
public long func_72820_D()
{
@@ -754,7 +772,7 @@
if (!this.func_175723_af().func_177746_a(blockpos))
{
@@ -3279,7 +3470,7 @@
@@ -3279,7 +3474,7 @@
public void func_175652_B(BlockPos p_175652_1_)
{
@@ -763,7 +781,7 @@
}
@SideOnly(Side.CLIENT)
@@ -3299,12 +3490,18 @@
@@ -3299,12 +3494,18 @@
if (!this.field_72996_f.contains(p_72897_1_))
{
@@ -782,7 +800,7 @@
return true;
}
@@ -3398,8 +3595,7 @@
@@ -3398,8 +3599,7 @@
public boolean func_180502_D(BlockPos p_180502_1_)
{
@@ -792,7 +810,7 @@
}
@Nullable
@@ -3460,12 +3656,12 @@
@@ -3460,12 +3660,12 @@
public int func_72800_K()
{
@@ -807,7 +825,7 @@
}
public Random func_72843_D(int p_72843_1_, int p_72843_2_, int p_72843_3_)
@@ -3509,7 +3705,7 @@
@@ -3509,7 +3709,7 @@
@SideOnly(Side.CLIENT)
public double func_72919_O()
{
@@ -816,7 +834,7 @@
}
public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_)
@@ -3543,7 +3739,7 @@
@@ -3543,7 +3743,7 @@
public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_)
{
@@ -825,7 +843,7 @@
{
BlockPos blockpos = p_175666_1_.func_177972_a(enumfacing);
@@ -3551,18 +3747,14 @@
@@ -3551,18 +3751,14 @@
{
IBlockState iblockstate = this.func_180495_p(blockpos);
@@ -848,7 +866,7 @@
}
}
}
@@ -3628,6 +3820,112 @@
@@ -3628,6 +3824,112 @@
return i >= -128 && i <= 128 && j >= -128 && j <= 128;
}
@@ -1056,4 +1056,10 @@ public class FMLClientHandler implements IFMLSidedHandler
{
MinecraftForge.EVENT_BUS.post(new ModelRegistryEvent());
}
@Override
public boolean isDisplayVSyncForced()
{
return SplashProgress.isDisplayVSyncForced;
}
}
@@ -106,6 +106,10 @@ public class SplashProgress
private static int barBorderColor;
private static int barColor;
private static int barBackgroundColor;
static boolean isDisplayVSyncForced = false;
private static final int TIMING_FRAME_COUNT = 200;
private static final int TIMING_FRAME_THRESHOLD = TIMING_FRAME_COUNT * 5 * 1000000; // 5 ms per frame, scaled to nanos
static final Semaphore mutex = new Semaphore(1);
private static String getString(String name, String def)
@@ -240,7 +244,8 @@ public class SplashProgress
private final int barHeight = 20;
private final int textHeight2 = 20;
private final int barOffset = 55;
private long updateTiming;
private long framecount;
public void run()
{
setGL();
@@ -252,6 +257,7 @@ public class SplashProgress
glDisable(GL_TEXTURE_2D);
while(!done)
{
framecount++;
ProgressBar first = null, penult = null, last = null;
Iterator<ProgressBar> i = ProgressManager.barIterator();
while(i.hasNext())
@@ -348,16 +354,40 @@ public class SplashProgress
// is trying to impose a framerate or other thing is occurring. Without the mutex, the main
// thread would delay waiting for the same global display lock
mutex.acquireUninterruptibly();
long updateStart = System.nanoTime();
Display.update();
// As soon as we're done, we release the mutex. The other thread can now ping the processmessages
// call as often as it wants until we get get back here again
long dur = System.nanoTime() - updateStart;
if (framecount < TIMING_FRAME_COUNT) {
updateTiming += dur;
}
mutex.release();
if(pause)
{
clearGL();
setGL();
}
Display.sync(100);
// Such a hack - if the time taken is greater than 10 milliseconds, we're gonna guess that we're on a
// system where vsync is forced through the swapBuffers call - so we have to force a sleep and let the
// loading thread have a turn - some badly designed mods access Keyboard and therefore GlobalLock.lock
// during splash screen, and mutex against the above Display.update call as a result.
// 4 milliseconds is a guess - but it should be enough to trigger in most circumstances. (Maybe if
// 240FPS is possible, this won't fire?)
if (framecount >= TIMING_FRAME_COUNT && updateTiming > TIMING_FRAME_THRESHOLD) {
if (!isDisplayVSyncForced)
{
isDisplayVSyncForced = true;
FMLLog.log(Level.INFO, "Using alternative sync timing : %d frames of Display.update took %d nanos", TIMING_FRAME_COUNT, updateTiming);
}
try { Thread.sleep(16); } catch (InterruptedException ie) {}
} else
{
if (framecount ==TIMING_FRAME_COUNT) {
FMLLog.log(Level.INFO, "Using sync timing. %d frames of Display.update took %d nanos", TIMING_FRAME_COUNT, updateTiming);
}
Display.sync(100);
}
}
clearGL();
}
@@ -751,4 +751,6 @@ public class FMLCommonHandler
{
sidedDelegate.fireSidedRegistryEvents();
}
public boolean isDisplayVSyncForced() { return sidedDelegate.isDisplayVSyncForced(); }
}
@@ -77,4 +77,6 @@ public interface IFMLSidedHandler
void reloadRenderers();
void fireSidedRegistryEvents();
boolean isDisplayVSyncForced();
}
@@ -32,7 +32,6 @@ import com.google.common.base.Joiner;
public class ProgressManager
{
private static final List<ProgressBar> bars = new CopyOnWriteArrayList<ProgressBar>();
/**
* Not a fully fleshed out API, may change in future MC versions.
* However feel free to use and suggest additions.
@@ -57,7 +56,9 @@ public class ProgressManager
return bar;
}
public static boolean isDisplayVSyncForced() {
return FMLCommonHandler.instance().isDisplayVSyncForced();
}
/**
* Not a fully fleshed out API, may change in future MC versions.
* However feel free to use and suggest additions.
@@ -529,10 +529,12 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
else
{
List<Packet<INetHandlerPlayClient>> parts = ((FMLProxyPacket)msg).toS3FPackets();
for (Packet<INetHandlerPlayClient> pkt : parts)
int sizeMinusOne = parts.size() - 1;
for (int i = 0; i < sizeMinusOne; i++)
{
ctx.write(pkt, promise);
ctx.write(parts.get(i), ctx.voidPromise());
}
ctx.write(parts.get(sizeMinusOne), promise);
}
}
else
@@ -645,7 +647,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
{
throw new IOException("Received FML MultiPart packet out of order, Expected " + part_expected + " Got " + part);
}
int len = input.readableBytes() - 1;
int len = input.readableBytes();
input.readBytes(data, offset, len);
part_expected++;
offset += len;
@@ -143,7 +143,7 @@ public class FMLProxyPacket implements Packet<INetHandler> {
return new CPacketCustomPayload(channel, payload);
}
static final int PART_SIZE = 0x1000000 - 0x50; // Make it a constant so that it gets inlined below.
static final int PART_SIZE = 0x100000 - 0x50; // Make it a constant so that it gets inlined below.
// FIXME int overflow
public static final int MAX_LENGTH = PART_SIZE * 255;
public List<Packet<INetHandlerPlayClient>> toS3FPackets() throws IOException
@@ -332,4 +332,10 @@ public class FMLServerHandler implements IFMLSidedHandler
{
// NOOP
}
@Override
public boolean isDisplayVSyncForced()
{
return false;
}
}
+1 -1
View File
@@ -7,7 +7,7 @@
<Console name="SysOut" target="SYSTEM_OUT">
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
</Console>
<Queue name="ServerGuiConsole">
<Queue name="ServerGuiConsole" ignoreExceptions="true">
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level] [%logger]: %msg%n" />
</Queue>
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
+1 -1
View File
@@ -9,7 +9,7 @@
</TerminalConsole>
<!-- Keep a console appender open so log4j2 doesn't close our main out stream if we redirect System.out to the logger -->
<Console name="SysOut" target="SYSTEM_OUT"/>
<Queue name="ServerGuiConsole">
<Queue name="ServerGuiConsole" ignoreExceptions="true">
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level] [%logger]: %replace{%msg}{(?i)\u00A7[0-9A-FK-OR]}{}%n" />
</Queue>
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
@@ -0,0 +1,78 @@
package net.minecraftforge.debug;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import net.minecraftforge.fml.relauncher.Side;
import javax.annotation.Nullable;
@Mod(modid = BigNetworkMessageTest.MOD_ID, name = "Big network message test mod", version = "1.0", acceptableRemoteVersions = "*")
@Mod.EventBusSubscriber
public class BigNetworkMessageTest
{
static final boolean ENABLED = true;
static final String MOD_ID = "big_packet_test";
public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(MOD_ID);
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent e)
{
if (ENABLED)
{
IMessageHandler<BigMessage, IMessage> handler = new IMessageHandler<BigMessage, IMessage>()
{
@Override public IMessage onMessage(BigMessage message, MessageContext ctx)
{
return null;
}
};
INSTANCE.registerMessage(handler, BigMessage.class, 0, Side.SERVER);
}
}
@SubscribeEvent
public static void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent evt)
{
if (ENABLED)
{
INSTANCE.sendTo(new BigMessage(), (EntityPlayerMP) evt.player);
}
}
public static class BigMessage implements IMessage
{
private static final int BYTE_COUNT = 0x200000;// 2MB
@Override public void toBytes(ByteBuf buf)
{
// write consecutive bytes, overflowing back to zero as necessary
for (int i = 0; i < BYTE_COUNT; i++)
{
buf.writeByte(i & 0xFF);
}
}
@Override public void fromBytes(ByteBuf buf)
{
for (int i = 0; i < BYTE_COUNT; i++)
{
int read = buf.readUnsignedByte();
int expected = i & 0xFF;
if (read != expected)
{
throw new RuntimeException("Found incorrect byte at " + (i + 1) + " expected " + expected + " but found " + read);
}
}
}
}
}