Compare commits

...
28 Commits
Author SHA1 Message Date
Ben Staddon 23410ad4d4 [1.11] Fix dormant chunk cache allowing entity data to be overwritten (#4672) 2018-01-09 21:03:45 -08:00
Bartek Bok 19577254b2 Fix invalid rendering of single-frame B3D models (#3917) 2017-12-18 21:43:51 -08:00
Bartek Bok ddbbeae4f1 Fix invalid FastTESR quad ordering (#3900) 2017-12-09 18:02:05 -08:00
Ben Staddon c87aa67a8a Recalculate chunk heightmap minimum (MC-117412) (#3888) 2017-11-03 22:51:53 -07:00
Bartek Bok ff1213fa7d Fix stacked entity item rendering (#3886) 2017-10-26 21:46:44 -07:00
Ben Staddon 7d60ce788b Save/restore dormant chunk entity data from NBT (#3940) 2017-10-14 18:34:20 -07:00
mezz 4d02491374 Fix performance regression in FastTESR rendering 2017-10-07 17:10:26 -07:00
PhiPro95 f1ee747082 Clean up Block.getLightValue(IBlockState, IBlockAccess, BlockPos) (#4202) 2017-10-05 20:21:50 -07:00
P3pp3rF1y 949c8c20d4 Change to allow items to interact with villagers (#4194) 2017-10-04 22:23:09 -07:00
Ben Staddon 146e1ecd94 Add a hook to allow world providers to change the lightmap colours. (#3922) 2017-10-04 21:24:36 -07:00
howtonotwin 068578e5ba Add smarter getter for block slipperiness (#3620) 2017-10-03 23:49:21 -07:00
mezz d5963874b6 Fix MC-117075 lag spike when unloading many tile entities 2017-09-10 13:36:32 -07:00
Bartosz Skrzypczak 4b0dbdb19b Fix splitting big packets skipping one byte per additional part (#4302) 2017-08-13 16:29:27 -05:00
mezz 4641bfc701 Allow the server to handle item-block interaction if onItemUse does not return PASS (#3951) 2017-07-30 18:03:53 -07:00
diesieben07 0e5519533f Ignore fortune for anything but seeds in crops (#3959) 2017-07-24 23:13:04 -07:00
mezz 8029851b4e Prevent player from dying infinitely due to zero max health (MC-119183) 2017-07-20 22:00:38 -07:00
mezz 1c7077d4a1 Fix unblockable damage being blocked by armor. (#3933) 2017-07-15 16:31:59 -07:00
E2 8e453de369 RenderLivingEvent now stores partialTick (#3822) 2017-07-03 12:35:29 -07:00
mincrmatt12 35e1737cb3 Add rotation origin variable for animated models (#3875) 2017-07-03 12:31:54 -07:00
LexManos b930704955 Fix BiomeDictionary not collecting correctly. 2017-06-28 23:17:17 -07:00
LexManos 619f83931f Optimize ExtendedBlockState.getClean, cache the return value instead of calculating it. Closes #3936 2017-06-28 23:15:54 -07:00
LexManos 5c8a222cb8 Add @ObjectHolder scanning to vanilla MobEffects, Biomes, Enchantments, SoundEvents, and PotionTypes constants. Closes #4104 2017-06-28 23:02:44 -07:00
LexManos 615f4966ce Version Bump for RB 2017-06-28 21:33:54 -07:00
LexManos 878193152a Fix ItemStackTransformer not applying at runtime. 2017-06-25 13:17:53 -07:00
KingLemming e747a17ec3 Enable support for modded Fishing Rods. (#4011) 2017-06-24 01:26:58 -07:00
diesieben07 96aceffb6f Clean up Logging (#3953) 2017-06-22 22:33:11 -07:00
mezz b43300c388 Fix log4j configuration 2017-06-07 20:43:37 -07:00
Choonster TheMage faf6c22b71 Fix IItemHandler wrappers returned by EntityLivingBase (#3942) 2017-06-05 14:04:10 -07:00
180 changed files with 2240 additions and 984 deletions

No files matched your search

@@ -16,7 +16,15 @@
public static final AxisAlignedBB field_185505_j = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); public static final AxisAlignedBB field_185505_j = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
@Nullable @Nullable
public static final AxisAlignedBB field_185506_k = null; public static final AxisAlignedBB field_185506_k = null;
@@ -307,7 +308,7 @@ @@ -73,6 +74,7 @@
public float field_149763_I;
protected final Material field_149764_J;
protected final MapColor field_181083_K;
+ @Deprecated // Forge: State/world/pos/entity sensitive version below
public float field_149765_K;
protected final BlockStateContainer field_176227_L;
private IBlockState field_176228_M;
@@ -307,7 +309,7 @@
public boolean func_176200_f(IBlockAccess p_176200_1_, BlockPos p_176200_2_) public boolean func_176200_f(IBlockAccess p_176200_1_, BlockPos p_176200_2_)
{ {
@@ -25,7 +33,7 @@
} }
public Block func_149711_c(float p_149711_1_) public Block func_149711_c(float p_149711_1_)
@@ -345,9 +346,10 @@ @@ -345,9 +347,10 @@
return this.field_149789_z; return this.field_149789_z;
} }
@@ -37,7 +45,7 @@
} }
@Deprecated @Deprecated
@@ -360,13 +362,13 @@ @@ -360,13 +363,13 @@
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int func_185484_c(IBlockState p_185484_1_, IBlockAccess p_185484_2_, BlockPos p_185484_3_) public int func_185484_c(IBlockState p_185484_1_, IBlockAccess p_185484_2_, BlockPos p_185484_3_)
{ {
@@ -53,7 +61,7 @@
} }
else else
{ {
@@ -430,7 +432,7 @@ @@ -430,7 +433,7 @@
} }
} }
@@ -62,7 +70,7 @@
} }
public boolean func_176212_b(IBlockAccess p_176212_1_, BlockPos p_176212_2_, EnumFacing p_176212_3_) public boolean func_176212_b(IBlockAccess p_176212_1_, BlockPos p_176212_2_, EnumFacing p_176212_3_)
@@ -521,6 +523,10 @@ @@ -521,6 +524,10 @@
public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_)
{ {
@@ -73,7 +81,7 @@
} }
public int func_149745_a(Random p_149745_1_) public int func_149745_a(Random p_149745_1_)
@@ -536,8 +542,7 @@ @@ -536,8 +543,7 @@
@Deprecated @Deprecated
public float func_180647_a(IBlockState p_180647_1_, EntityPlayer p_180647_2_, World p_180647_3_, BlockPos p_180647_4_) public float func_180647_a(IBlockState p_180647_1_, EntityPlayer p_180647_2_, World p_180647_3_, BlockPos p_180647_4_)
{ {
@@ -83,7 +91,7 @@
} }
public final void func_176226_b(World p_176226_1_, BlockPos p_176226_2_, IBlockState p_176226_3_, int p_176226_4_) public final void func_176226_b(World p_176226_1_, BlockPos p_176226_2_, IBlockState p_176226_3_, int p_176226_4_)
@@ -547,20 +552,17 @@ @@ -547,20 +553,17 @@
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
{ {
@@ -110,7 +118,7 @@
} }
} }
} }
@@ -568,8 +570,13 @@ @@ -568,8 +571,13 @@
public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_)
{ {
@@ -125,7 +133,7 @@
float f = 0.5F; float f = 0.5F;
double d0 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D; double d0 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D;
double d1 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D; double d1 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D;
@@ -598,6 +605,7 @@ @@ -598,6 +606,7 @@
return 0; return 0;
} }
@@ -133,7 +141,7 @@
public float func_149638_a(Entity p_149638_1_) public float func_149638_a(Entity p_149638_1_)
{ {
return this.field_149781_w / 5.0F; return this.field_149781_w / 5.0F;
@@ -636,7 +644,7 @@ @@ -636,7 +645,7 @@
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
{ {
@@ -142,7 +150,7 @@
} }
public boolean func_180639_a(World p_180639_1_, BlockPos p_180639_2_, IBlockState p_180639_3_, EntityPlayer p_180639_4_, EnumHand p_180639_5_, EnumFacing p_180639_6_, float p_180639_7_, float p_180639_8_, float p_180639_9_) public boolean func_180639_a(World p_180639_1_, BlockPos p_180639_2_, IBlockState p_180639_3_, EntityPlayer p_180639_4_, EnumHand p_180639_5_, EnumFacing p_180639_6_, float p_180639_7_, float p_180639_8_, float p_180639_9_)
@@ -648,6 +656,8 @@ @@ -648,6 +657,8 @@
{ {
} }
@@ -151,7 +159,7 @@
public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_)
{ {
return this.func_176203_a(p_180642_7_); return this.func_176203_a(p_180642_7_);
@@ -689,21 +699,35 @@ @@ -689,21 +700,35 @@
p_180657_2_.func_71029_a(StatList.func_188055_a(this)); p_180657_2_.func_71029_a(StatList.func_188055_a(this));
p_180657_2_.func_71020_j(0.005F); p_180657_2_.func_71020_j(0.005F);
@@ -190,7 +198,7 @@
} }
protected ItemStack func_180643_i(IBlockState p_180643_1_) protected ItemStack func_180643_i(IBlockState p_180643_1_)
@@ -789,6 +813,7 @@ @@ -789,6 +814,7 @@
p_176216_2_.field_70181_x = 0.0D; p_176216_2_.field_70181_x = 0.0D;
} }
@@ -198,7 +206,7 @@
public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_)
{ {
return new ItemStack(Item.func_150898_a(this), 1, this.func_180651_a(p_185473_3_)); return new ItemStack(Item.func_150898_a(this), 1, this.func_180651_a(p_185473_3_));
@@ -893,6 +918,7 @@ @@ -893,6 +919,7 @@
} }
} }
@@ -206,7 +214,7 @@
public SoundType func_185467_w() public SoundType func_185467_w()
{ {
return this.field_149762_H; return this.field_149762_H;
@@ -908,6 +934,1217 @@ @@ -908,6 +935,1249 @@
{ {
} }
@@ -215,8 +223,45 @@
+ protected ThreadLocal<EntityPlayer> harvesters = new ThreadLocal(); + protected ThreadLocal<EntityPlayer> harvesters = new ThreadLocal();
+ private ThreadLocal<IBlockState> silk_check_state = new ThreadLocal(); + private ThreadLocal<IBlockState> silk_check_state = new ThreadLocal();
+ protected static java.util.Random RANDOM = new java.util.Random(); // Useful for random things without a seed. + protected static java.util.Random RANDOM = new java.util.Random(); // Useful for random things without a seed.
+
+ /** + /**
+ * Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15 + * Gets the slipperiness at the given location at the given state. Normally
+ * between 0 and 1.
+ * <p>
+ * Note that entities may reduce slipperiness by a certain factor of their own;
+ * for {@link net.minecraft.entity.EntityLivingBase}, this is {@code .91}.
+ * {@link net.minecraft.entity.item.EntityItem} uses {@code .98}, and
+ * {@link net.minecraft.entity.projectile.EntityFishHook} uses {@code .92}.
+ *
+ * @param state state of the block
+ * @param world the world
+ * @param pos the position in the world
+ * @param entity the entity in question
+ * @return the factor by which the entity's motion should be multiplied
+ */
+ public float getSlipperiness(IBlockState state, IBlockAccess world, BlockPos pos, @Nullable Entity entity)
+ {
+ return field_149765_K;
+ }
+
+ /**
+ * Sets the base slipperiness level. Normally between 0 and 1.
+ * <p>
+ * <b>Calling this method may have no effect on the function of this block</b>,
+ * or may not have the expected result. This block is free to caclculate
+ * its slipperiness arbitrarily. This method is guaranteed to work on the
+ * base {@code Block} class.
+ *
+ * @param slipperiness the base slipperiness of this block
+ * @see #getSlipperiness(IBlockState, IBlockAccess, BlockPos, Entity)
+ */
+ public void setDefaultSlipperiness(float slipperiness)
+ {
+ this.field_149765_K = slipperiness;
+ }
+
+ /**
+ * Get a light value for this block, taking into account the given state and coordinates, normal ranges are between 0 and 15
+ * + *
+ * @param state Block state + * @param state Block state
+ * @param world The current world + * @param world The current world
@@ -225,11 +270,6 @@
+ */ + */
+ public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) + public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
+ { + {
+ IBlockState other = world.func_180495_p(pos);
+ if (other.func_177230_c() != this)
+ {
+ return other.getLightValue(world, pos);
+ }
+ return state.func_185906_d(); + return state.func_185906_d();
+ } + }
+ +
@@ -1424,7 +1464,7 @@
public static void func_149671_p() public static void func_149671_p()
{ {
func_176215_a(0, field_176230_a, (new BlockAir()).func_149663_c("air")); func_176215_a(0, field_176230_a, (new BlockAir()).func_149663_c("air"));
@@ -1201,14 +2438,7 @@ @@ -1201,14 +2471,7 @@
} }
else else
{ {
@@ -43,7 +43,7 @@
+ @Override + @Override
+ public java.util.List<ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + public java.util.List<ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ { + {
+ java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune); + java.util.List<ItemStack> ret = super.getDrops(world, pos, state, 0);
+ int age = func_185527_x(state); + int age = func_185527_x(state);
+ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); + Random rand = world instanceof World ? ((World)world).field_73012_v : new Random();
+ +
@@ -64,7 +64,8 @@
+ +
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
{ {
super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, 0); - super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, 0);
+ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_);
- if (!p_180653_1_.field_72995_K) - if (!p_180653_1_.field_72995_K)
+ if (false && !p_180653_1_.field_72995_K) // Forge: NOP all this. + if (false && !p_180653_1_.field_72995_K) // Forge: NOP all this.
@@ -103,7 +103,7 @@
} }
return p_178893_1_.equals(this.field_178895_c) && flag; return p_178893_1_.equals(this.field_178895_c) && flag;
@@ -373,13 +384,29 @@ @@ -373,13 +384,34 @@
} }
else else
{ {
@@ -120,7 +120,12 @@
if (this.field_78779_k != GameType.SPECTATOR) if (this.field_78779_k != GameType.SPECTATOR)
{ {
+ EnumActionResult ret = itemstack.onItemUseFirst(p_187099_1_, p_187099_2_, p_187099_3_, p_187099_6_, p_187099_4_, f, f1, f2); + EnumActionResult ret = itemstack.onItemUseFirst(p_187099_1_, p_187099_2_, p_187099_3_, p_187099_6_, p_187099_4_, f, f1, f2);
+ if (ret != EnumActionResult.PASS) return ret; + if (ret != EnumActionResult.PASS)
+ {
+ // The server needs to process the item use as well. Otherwise onItemUseFirst won't ever be called on the server without causing weird bugs
+ this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2));
+ return ret;
+ }
+ +
IBlockState iblockstate = p_187099_2_.func_180495_p(p_187099_3_); IBlockState iblockstate = p_187099_2_.func_180495_p(p_187099_3_);
+ boolean bypass = itemstack.func_190926_b() || itemstack.func_77973_b().doesSneakBypassUse(itemstack, p_187099_2_, p_187099_3_, p_187099_1_); + boolean bypass = itemstack.func_190926_b() || itemstack.func_77973_b().doesSneakBypassUse(itemstack, p_187099_2_, p_187099_3_, p_187099_1_);
@@ -135,7 +140,7 @@
} }
if (!flag && itemstack.func_77973_b() instanceof ItemBlock) if (!flag && itemstack.func_77973_b() instanceof ItemBlock)
@@ -395,7 +422,7 @@ @@ -395,7 +427,7 @@
this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2));
@@ -144,7 +149,7 @@
{ {
if (itemstack.func_190926_b()) if (itemstack.func_190926_b())
{ {
@@ -421,14 +448,20 @@ @@ -421,14 +453,20 @@
{ {
int i = itemstack.func_77960_j(); int i = itemstack.func_77960_j();
int j = itemstack.func_190916_E(); int j = itemstack.func_190916_E();
@@ -166,7 +171,7 @@
} }
} }
} }
@@ -457,6 +490,8 @@ @@ -457,6 +495,8 @@
} }
else else
{ {
@@ -175,7 +180,7 @@
int i = itemstack.func_190916_E(); int i = itemstack.func_190916_E();
ActionResult<ItemStack> actionresult = itemstack.func_77957_a(p_187101_2_, p_187101_1_, p_187101_3_); ActionResult<ItemStack> actionresult = itemstack.func_77957_a(p_187101_2_, p_187101_1_, p_187101_3_);
ItemStack itemstack1 = (ItemStack)actionresult.func_188398_b(); ItemStack itemstack1 = (ItemStack)actionresult.func_188398_b();
@@ -464,6 +499,10 @@ @@ -464,6 +504,10 @@
if (itemstack1 != itemstack || itemstack1.func_190916_E() != i) if (itemstack1 != itemstack || itemstack1.func_190916_E() != i)
{ {
p_187101_1_.func_184611_a(p_187101_3_, itemstack1); p_187101_1_.func_184611_a(p_187101_3_, itemstack1);
@@ -186,7 +191,7 @@
} }
return actionresult.func_188397_a(); return actionresult.func_188397_a();
@@ -500,6 +539,9 @@ @@ -500,6 +544,9 @@
this.func_78750_j(); this.func_78750_j();
Vec3d vec3d = new Vec3d(p_187102_3_.field_72307_f.field_72450_a - p_187102_2_.field_70165_t, p_187102_3_.field_72307_f.field_72448_b - p_187102_2_.field_70163_u, p_187102_3_.field_72307_f.field_72449_c - p_187102_2_.field_70161_v); Vec3d vec3d = new Vec3d(p_187102_3_.field_72307_f.field_72450_a - p_187102_2_.field_70165_t, p_187102_3_.field_72307_f.field_72448_b - p_187102_2_.field_70163_u, p_187102_3_.field_72307_f.field_72449_c - p_187102_2_.field_70161_v);
this.field_78774_b.func_147297_a(new CPacketUseEntity(p_187102_2_, p_187102_4_, vec3d)); this.field_78774_b.func_147297_a(new CPacketUseEntity(p_187102_2_, p_187102_4_, vec3d));
@@ -0,0 +1,17 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java
@@ -108,4 +108,14 @@
{
return field_74596_h;
}
+
+ /* ======================================== FORGE START =====================================*/
+
+ /**
+ * Vector from render view entity position (corrected for partialTickTime) to the middle of screen
+ */
+ public static Vec3d getCameraPosition()
+ {
+ return field_178811_e;
+ }
}
@@ -78,7 +78,18 @@
if (this.field_78531_r.field_71474_y.field_74320_O == 0 && !flag && !this.field_78531_r.field_71474_y.field_74319_N && !this.field_78531_r.field_71442_b.func_78747_a()) if (this.field_78531_r.field_71474_y.field_74320_O == 0 && !flag && !this.field_78531_r.field_71474_y.field_74319_N && !this.field_78531_r.field_71442_b.func_78747_a())
{ {
this.func_180436_i(); this.func_180436_i();
@@ -1101,6 +1100,10 @@ @@ -876,6 +875,10 @@
f10 = 0.25F + f7 * 0.75F;
}
+ float[] colors = {f8, f9, f10};
+ world.field_73011_w.getLightmapColors(p_78472_1_, f, f2, f3, colors);
+ f8 = colors[0]; f9 = colors[1]; f10 = colors[2];
+
if (this.field_78531_r.field_71439_g.func_70644_a(MobEffects.field_76439_r))
{
float f15 = this.func_180438_a(this.field_78531_r.field_71439_g, p_78472_1_);
@@ -1101,6 +1104,10 @@
GlStateManager.func_179096_D(); GlStateManager.func_179096_D();
this.func_78478_c(); this.func_78478_c();
this.field_78510_Z = System.nanoTime(); this.field_78510_Z = System.nanoTime();
@@ -89,7 +100,7 @@
} }
if (this.field_78531_r.field_71462_r != null) if (this.field_78531_r.field_71462_r != null)
@@ -1109,7 +1112,7 @@ @@ -1109,7 +1116,7 @@
try try
{ {
@@ -98,7 +109,7 @@
} }
catch (Throwable throwable) catch (Throwable throwable)
{ {
@@ -1204,7 +1207,7 @@ @@ -1204,7 +1211,7 @@
if (this.field_78531_r.field_71442_b.func_178889_l() == GameType.SPECTATOR) if (this.field_78531_r.field_71442_b.func_178889_l() == GameType.SPECTATOR)
{ {
@@ -107,7 +118,7 @@
} }
else else
{ {
@@ -1329,7 +1332,9 @@ @@ -1329,7 +1336,9 @@
GlStateManager.func_179094_E(); GlStateManager.func_179094_E();
RenderHelper.func_74519_b(); RenderHelper.func_74519_b();
this.field_78531_r.field_71424_I.func_76318_c("entities"); this.field_78531_r.field_71424_I.func_76318_c("entities");
@@ -117,7 +128,7 @@
RenderHelper.func_74518_a(); RenderHelper.func_74518_a();
this.func_175072_h(); this.func_175072_h();
} }
@@ -1342,6 +1347,7 @@ @@ -1342,6 +1351,7 @@
EntityPlayer entityplayer = (EntityPlayer)entity; EntityPlayer entityplayer = (EntityPlayer)entity;
GlStateManager.func_179118_c(); GlStateManager.func_179118_c();
this.field_78531_r.field_71424_I.func_76318_c("outline"); this.field_78531_r.field_71424_I.func_76318_c("outline");
@@ -125,7 +136,7 @@
renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_175068_2_); renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_175068_2_);
GlStateManager.func_179141_d(); GlStateManager.func_179141_d();
} }
@@ -1388,6 +1394,17 @@ @@ -1388,6 +1398,17 @@
GlStateManager.func_179103_j(7425); GlStateManager.func_179103_j(7425);
this.field_78531_r.field_71424_I.func_76318_c("translucent"); this.field_78531_r.field_71424_I.func_76318_c("translucent");
renderglobal.func_174977_a(BlockRenderLayer.TRANSLUCENT, (double)p_175068_2_, p_175068_1_, entity); renderglobal.func_174977_a(BlockRenderLayer.TRANSLUCENT, (double)p_175068_2_, p_175068_1_, entity);
@@ -143,7 +154,7 @@
GlStateManager.func_179103_j(7424); GlStateManager.func_179103_j(7424);
GlStateManager.func_179132_a(true); GlStateManager.func_179132_a(true);
GlStateManager.func_179089_o(); GlStateManager.func_179089_o();
@@ -1400,6 +1417,9 @@ @@ -1400,6 +1421,9 @@
this.func_180437_a(renderglobal, p_175068_2_, p_175068_1_, d0, d1, d2); this.func_180437_a(renderglobal, p_175068_2_, p_175068_1_, d0, d1, d2);
} }
@@ -153,7 +164,7 @@
this.field_78531_r.field_71424_I.func_76318_c("hand"); this.field_78531_r.field_71424_I.func_76318_c("hand");
if (this.field_175074_C) if (this.field_175074_C)
@@ -1515,6 +1535,13 @@ @@ -1515,6 +1539,13 @@
protected void func_78474_d(float p_78474_1_) protected void func_78474_d(float p_78474_1_)
{ {
@@ -167,7 +178,7 @@
float f = this.field_78531_r.field_71441_e.func_72867_j(p_78474_1_); float f = this.field_78531_r.field_71441_e.func_72867_j(p_78474_1_);
if (f > 0.0F) if (f > 0.0F)
@@ -1845,6 +1872,13 @@ @@ -1845,6 +1876,13 @@
this.field_175081_S = f7; this.field_175081_S = f7;
} }
@@ -181,7 +192,7 @@
GlStateManager.func_179082_a(this.field_175080_Q, this.field_175082_R, this.field_175081_S, 0.0F); GlStateManager.func_179082_a(this.field_175080_Q, this.field_175082_R, this.field_175081_S, 0.0F);
} }
@@ -1855,7 +1889,9 @@ @@ -1855,7 +1893,9 @@
GlStateManager.func_187432_a(0.0F, -1.0F, 0.0F); GlStateManager.func_187432_a(0.0F, -1.0F, 0.0F);
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
IBlockState iblockstate = ActiveRenderInfo.func_186703_a(this.field_78531_r.field_71441_e, entity, p_78468_2_); IBlockState iblockstate = ActiveRenderInfo.func_186703_a(this.field_78531_r.field_71441_e, entity, p_78468_2_);
@@ -192,7 +203,7 @@
if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_70644_a(MobEffects.field_76440_q)) if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_70644_a(MobEffects.field_76440_q))
{ {
float f1 = 5.0F; float f1 = 5.0F;
@@ -1940,6 +1976,7 @@ @@ -1940,6 +1980,7 @@
GlStateManager.func_179102_b(f * 0.05F); GlStateManager.func_179102_b(f * 0.05F);
GlStateManager.func_179153_c(Math.min(f, 192.0F) * 0.5F); GlStateManager.func_179153_c(Math.min(f, 192.0F) * 0.5F);
} }
@@ -29,7 +29,7 @@
GlStateManager.func_179109_b(f3, f4, f5); GlStateManager.func_179109_b(f3, f4, f5);
} }
@@ -134,10 +131,10 @@ @@ -134,11 +131,11 @@
float f7 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; float f7 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
float f9 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; float f9 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
float f6 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; float f6 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
@@ -38,17 +38,20 @@
} }
- ibakedmodel.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GROUND); - ibakedmodel.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GROUND);
+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); - this.field_177080_a.func_180454_a(itemstack, ibakedmodel);
this.field_177080_a.func_180454_a(itemstack, ibakedmodel); + IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false);
+ this.field_177080_a.func_180454_a(itemstack, transformedModel);
GlStateManager.func_179121_F(); GlStateManager.func_179121_F();
} }
else
@@ -152,10 +149,10 @@ @@ -152,10 +149,10 @@
GlStateManager.func_179109_b(f8, f10, 0.0F); GlStateManager.func_179109_b(f8, f10, 0.0F);
} }
- ibakedmodel.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GROUND); - ibakedmodel.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GROUND);
+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); - this.field_177080_a.func_180454_a(itemstack, ibakedmodel);
this.field_177080_a.func_180454_a(itemstack, ibakedmodel); + IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false);
+ this.field_177080_a.func_180454_a(itemstack, transformedModel);
GlStateManager.func_179121_F(); GlStateManager.func_179121_F();
- GlStateManager.func_179109_b(0.0F * f, 0.0F * f1, 0.09375F * f2); - GlStateManager.func_179109_b(0.0F * f, 0.0F * f1, 0.09375F * f2);
+ GlStateManager.func_179109_b(0.0F, 0.0F, 0.09375F); + GlStateManager.func_179109_b(0.0F, 0.0F, 0.09375F);
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderFish.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderFish.java
@@ -75,7 +75,7 @@
int k = entityplayer.func_184591_cq() == EnumHandSide.RIGHT ? 1 : -1;
ItemStack itemstack = entityplayer.func_184614_ca();
- if (itemstack.func_77973_b() != Items.field_151112_aM)
+ if (!(itemstack.func_77973_b() instanceof net.minecraft.item.ItemFishingRod))
{
k = -k;
}
@@ -14,7 +14,7 @@
public void func_76986_a(T p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) public void func_76986_a(T p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{ {
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre<T>(p_76986_1_, this, p_76986_2_, p_76986_4_, p_76986_6_))) return; + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre<T>(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_))) return;
GlStateManager.func_179094_E(); GlStateManager.func_179094_E();
GlStateManager.func_179129_p(); GlStateManager.func_179129_p();
this.field_77045_g.field_78095_p = this.func_77040_d(p_76986_1_, p_76986_9_); this.field_77045_g.field_78095_p = this.func_77040_d(p_76986_1_, p_76986_9_);
@@ -45,7 +45,7 @@
GlStateManager.func_179089_o(); GlStateManager.func_179089_o();
GlStateManager.func_179121_F(); GlStateManager.func_179121_F();
super.func_76986_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); super.func_76986_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post<T>(p_76986_1_, this, p_76986_2_, p_76986_4_, p_76986_6_)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post<T>(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_));
} }
public float func_188322_c(T p_188322_1_, float p_188322_2_) public float func_188322_c(T p_188322_1_, float p_188322_2_)
@@ -12,9 +12,9 @@
if (!this.func_94310_b(stitcher$holder)) if (!this.func_94310_b(stitcher$holder))
{ {
String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {stitcher$holder.func_98150_a().func_94215_i(), Integer.valueOf(stitcher$holder.func_98150_a().func_94211_a()), Integer.valueOf(stitcher$holder.func_98150_a().func_94216_b())}); String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {stitcher$holder.func_98150_a().func_94215_i(), Integer.valueOf(stitcher$holder.func_98150_a().func_94211_a()), Integer.valueOf(stitcher$holder.func_98150_a().func_94216_b())});
+ net.minecraftforge.fml.common.FMLLog.info(s); + net.minecraftforge.fml.common.FMLLog.log.info(s);
+ for (Stitcher.Holder h : astitcher$holder) + for (Stitcher.Holder h : astitcher$holder)
+ net.minecraftforge.fml.common.FMLLog.info(" %s", h); + net.minecraftforge.fml.common.FMLLog.log.info(" {}", h);
throw new StitcherException(stitcher$holder, s); throw new StitcherException(stitcher$holder, s);
} }
} }
@@ -52,7 +52,7 @@
int j = Integer.MAX_VALUE; int j = Integer.MAX_VALUE;
int k = 1 << this.field_147636_j; int k = 1 << this.field_147636_j;
+ net.minecraftforge.fml.common.FMLLog.info("Max texture size: %d", i); + net.minecraftforge.fml.common.FMLLog.log.info("Max texture size: {}", i);
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.field_110574_e.size()); + net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.field_110574_e.size());
+ +
+ if(!skipFirst) + if(!skipFirst)
@@ -1,11 +1,12 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java --- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java +++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java
@@ -116,11 +116,14 @@ @@ -115,12 +115,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()) 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()) + 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 i = this.field_147550_f.func_175626_b(p_180546_1_.func_174877_v(), 0);
int j = i % 65536; int j = i % 65536;
int k = i / 65536; int k = i / 65536;
@@ -27,7 +28,7 @@
tileentityspecialrenderer.func_180535_a(p_178469_1_, p_178469_2_, p_178469_4_, p_178469_6_, p_178469_8_, p_178469_9_); tileentityspecialrenderer.func_180535_a(p_178469_1_, p_178469_2_, p_178469_4_, p_178469_6_, p_178469_8_, p_178469_9_);
} }
catch (Throwable throwable) catch (Throwable throwable)
@@ -165,4 +173,52 @@ @@ -165,4 +173,53 @@
{ {
return this.field_147557_n; return this.field_147557_n;
} }
@@ -72,7 +73,8 @@
+ +
+ if(pass > 0) + if(pass > 0)
+ { + {
+ batchBuffer.func_178180_c().func_181674_a((float)field_147554_b, (float)field_147555_c, (float)field_147552_d); + net.minecraft.util.math.Vec3d cameraPos = net.minecraft.client.renderer.ActiveRenderInfo.getCameraPosition();
+ batchBuffer.func_178180_c().func_181674_a((float)cameraPos.field_72450_a, (float)cameraPos.field_72448_b, (float)cameraPos.field_72449_c);
+ } + }
+ batchBuffer.func_78381_a(); + batchBuffer.func_78381_a();
+ +
@@ -155,7 +155,7 @@
} }
public boolean func_174816_a(Explosion p_174816_1_, World p_174816_2_, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_) public boolean func_174816_a(Explosion p_174816_1_, World p_174816_2_, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_)
@@ -2862,6 +2889,184 @@ @@ -2862,6 +2889,185 @@
EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_); EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_);
} }
@@ -248,6 +248,7 @@
+ /** + /**
+ * Reset the entity ID to a new value. Not to be used from Mod code + * Reset the entity ID to a new value. Not to be used from Mod code
+ */ + */
+ @Deprecated
+ public final void resetEntityId() + public final void resetEntityId()
+ { + {
+ this.field_145783_c = field_70152_a++; + this.field_145783_c = field_70152_a++;
@@ -0,0 +1,24 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityFlying.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityFlying.java
@@ -44,7 +44,9 @@
if (this.field_70122_E)
{
- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().field_149765_K * 0.91F;
+ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v));
+ IBlockState underState = this.field_70170_p.func_180495_p(underPos);
+ f = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, underPos, this) * 0.91F;
}
float f1 = 0.16277136F / (f * f * f);
@@ -53,7 +55,9 @@
if (this.field_70122_E)
{
- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().field_149765_K * 0.91F;
+ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v));
+ IBlockState underState = this.field_70170_p.func_180495_p(underPos);
+ f = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, underPos, this) * 0.91F;
}
this.func_70091_d(MoverType.SELF, this.field_70159_w, this.field_70181_x, this.field_70179_y);
@@ -81,7 +81,7 @@
} }
@Nullable @Nullable
@@ -189,7 +203,17 @@ @@ -189,7 +203,16 @@
} }
else else
{ {
@@ -91,15 +91,14 @@
+ } + }
+ catch (Exception e) + catch (Exception e)
+ { + {
+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, + net.minecraftforge.fml.common.FMLLog.log.error("An Entity {}({}) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
+ "An Entity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", + p_75615_0_.func_74779_i("id"), entity.func_70005_c_(), e);
+ p_75615_0_.func_74779_i("id"), entity.func_70005_c_());
+ entity = null; + entity = null;
+ } + }
} }
return entity; return entity;
@@ -197,7 +221,7 @@ @@ -197,7 +220,7 @@
public static Set<ResourceLocation> func_180124_b() public static Set<ResourceLocation> func_180124_b()
{ {
@@ -108,7 +107,7 @@
} }
public static boolean func_180123_a(Entity p_180123_0_, ResourceLocation p_180123_1_) public static boolean func_180123_a(Entity p_180123_0_, ResourceLocation p_180123_1_)
@@ -336,7 +360,7 @@ @@ -336,7 +359,7 @@
func_191305_a("zombie_horse", 3232308, 9945732); func_191305_a("zombie_horse", 3232308, 9945732);
func_191305_a("zombie_pigman", 15373203, 5009705); func_191305_a("zombie_pigman", 15373203, 5009705);
func_191305_a("zombie_villager", 5651507, 7969893); func_191305_a("zombie_villager", 5651507, 7969893);
@@ -117,7 +116,7 @@
} }
private static void func_191303_a(int p_191303_0_, String p_191303_1_, Class <? extends Entity > p_191303_2_, String p_191303_3_) private static void func_191303_a(int p_191303_0_, String p_191303_1_, Class <? extends Entity > p_191303_2_, String p_191303_3_)
@@ -357,22 +381,19 @@ @@ -357,22 +380,19 @@
else else
{ {
ResourceLocation resourcelocation = new ResourceLocation(p_191303_1_); ResourceLocation resourcelocation = new ResourceLocation(p_191303_1_);
@@ -223,7 +223,27 @@
} }
protected void func_70629_bd() protected void func_70629_bd()
@@ -1972,6 +2002,7 @@ @@ -1793,7 +1823,8 @@
if (this.field_70122_E)
{
- f6 = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos).func_177230_c().field_149765_K * 0.91F;
+ IBlockState underState = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos);
+ f6 = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, blockpos$pooledmutableblockpos, this) * 0.91F;
}
float f7 = 0.16277136F / (f6 * f6 * f6);
@@ -1813,7 +1844,8 @@
if (this.field_70122_E)
{
- f6 = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos.func_189532_c(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)).func_177230_c().field_149765_K * 0.91F;
+ IBlockState underState = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos.func_189532_c(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v));
+ f6 = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, blockpos$pooledmutableblockpos, this) * 0.91F;
}
if (this.func_70617_f_())
@@ -1972,6 +2004,7 @@
public void func_70071_h_() public void func_70071_h_()
{ {
@@ -231,7 +251,7 @@
super.func_70071_h_(); super.func_70071_h_();
this.func_184608_ct(); this.func_184608_ct();
@@ -2015,6 +2046,7 @@ @@ -2015,6 +2048,7 @@
if (!ItemStack.func_77989_b(itemstack1, itemstack)) if (!ItemStack.func_77989_b(itemstack1, itemstack))
{ {
((WorldServer)this.field_70170_p).func_73039_n().func_151247_a(this, new SPacketEntityEquipment(this.func_145782_y(), entityequipmentslot, itemstack1)); ((WorldServer)this.field_70170_p).func_73039_n().func_151247_a(this, new SPacketEntityEquipment(this.func_145782_y(), entityequipmentslot, itemstack1));
@@ -239,7 +259,7 @@
if (!itemstack.func_190926_b()) if (!itemstack.func_190926_b())
{ {
@@ -2488,6 +2520,40 @@ @@ -2488,6 +2522,40 @@
this.field_70752_e = true; this.field_70752_e = true;
} }
@@ -280,7 +300,7 @@
public abstract EnumHandSide func_184591_cq(); public abstract EnumHandSide func_184591_cq();
public boolean func_184587_cr() public boolean func_184587_cr()
@@ -2508,12 +2574,19 @@ @@ -2508,12 +2576,19 @@
if (itemstack == this.field_184627_bm) if (itemstack == this.field_184627_bm)
{ {
@@ -301,7 +321,7 @@
{ {
this.func_71036_o(); this.func_71036_o();
} }
@@ -2531,8 +2604,10 @@ @@ -2531,8 +2606,10 @@
if (!itemstack.func_190926_b() && !this.func_184587_cr()) if (!itemstack.func_190926_b() && !this.func_184587_cr())
{ {
@@ -313,7 +333,7 @@
if (!this.field_70170_p.field_72995_K) if (!this.field_70170_p.field_72995_K)
{ {
@@ -2613,7 +2688,9 @@ @@ -2613,7 +2690,9 @@
if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr()) if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr())
{ {
this.func_184584_a(this.field_184627_bm, 16); this.func_184584_a(this.field_184627_bm, 16);
@@ -324,7 +344,7 @@
this.func_184602_cy(); this.func_184602_cy();
} }
} }
@@ -2637,7 +2714,8 @@ @@ -2637,7 +2716,8 @@
{ {
if (!this.field_184627_bm.func_190926_b()) if (!this.field_184627_bm.func_190926_b())
{ {
@@ -334,14 +354,14 @@
} }
this.func_184602_cy(); this.func_184602_cy();
@@ -2761,4 +2839,29 @@ @@ -2761,4 +2841,29 @@
{ {
return true; return true;
} }
+ +
+ // FORGE + // FORGE
+ private final net.minecraftforge.items.IItemHandlerModifiable handHandler = new net.minecraftforge.items.ItemStackHandler(field_184630_bs); + private final net.minecraftforge.items.IItemHandlerModifiable handHandler = new net.minecraftforge.items.wrapper.EntityHandsInvWrapper(this);
+ private final net.minecraftforge.items.IItemHandlerModifiable armorHandler = new net.minecraftforge.items.ItemStackHandler(field_184631_bt); + private final net.minecraftforge.items.IItemHandlerModifiable armorHandler = new net.minecraftforge.items.wrapper.EntityArmorInvWrapper(this);
+ private final net.minecraftforge.items.IItemHandler joinedHandler = new net.minecraftforge.items.wrapper.CombinedInvWrapper(armorHandler, handHandler); + private final net.minecraftforge.items.IItemHandler joinedHandler = new net.minecraftforge.items.wrapper.CombinedInvWrapper(armorHandler, handHandler);
+ +
+ @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked")
@@ -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);
@@ -0,0 +1,32 @@
--- ../src-base/minecraft/net/minecraft/entity/item/EntityBoat.java
+++ ../src-work/minecraft/net/minecraft/entity/item/EntityBoat.java
@@ -476,7 +476,7 @@
if (!list.isEmpty())
{
- f += iblockstate.func_177230_c().field_149765_K;
+ f += iblockstate.func_177230_c().getSlipperiness(iblockstate, this.field_70170_p, blockpos$pooledmutableblockpos, this);
++k1;
}
@@ -948,4 +948,20 @@
return values()[0];
}
}
+
+ // Forge: Fix MC-119811 by instantly completing lerp on board
+ @Override
+ protected void func_184200_o(Entity passenger)
+ {
+ super.func_184200_o(passenger);
+ if(this.func_184186_bw() && this.field_184476_at > 0)
+ {
+ this.field_184476_at = 0;
+ this.field_70165_t = this.field_70281_h;
+ this.field_70163_u = this.field_184477_av;
+ this.field_70161_v = this.field_184478_aw;
+ this.field_70177_z = (float)this.field_70273_g;
+ this.field_70125_A = (float)this.field_184479_ay;
+ }
+ }
}
@@ -28,7 +28,18 @@
if (this.func_92059_d().func_190926_b()) if (this.func_92059_d().func_190926_b())
{ {
this.func_70106_y(); this.func_70106_y();
@@ -169,8 +176,16 @@ @@ -137,7 +144,9 @@
if (this.field_70122_E)
{
- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().field_149765_K * 0.98F;
+ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v));
+ net.minecraft.block.state.IBlockState underState = this.field_70170_p.func_180495_p(underPos);
+ f = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, underPos, this) * 0.98F;
}
this.field_70159_w *= (double)f;
@@ -169,8 +178,16 @@
} }
} }
@@ -46,7 +57,7 @@
this.func_70106_y(); this.func_70106_y();
} }
} }
@@ -227,6 +242,10 @@ @@ -227,6 +244,10 @@
{ {
return false; return false;
} }
@@ -57,7 +68,7 @@
else else
{ {
itemstack1.func_190917_f(itemstack.func_190916_E()); itemstack1.func_190917_f(itemstack.func_190916_E());
@@ -284,6 +303,7 @@ @@ -284,6 +305,7 @@
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_)
{ {
@@ -65,7 +76,7 @@
if (this.func_180431_b(p_70097_1_)) if (this.func_180431_b(p_70097_1_))
{ {
return false; return false;
@@ -316,6 +336,7 @@ @@ -316,6 +338,7 @@
p_70014_1_.func_74777_a("Health", (short)this.field_70291_e); p_70014_1_.func_74777_a("Health", (short)this.field_70291_e);
p_70014_1_.func_74777_a("Age", (short)this.field_70292_b); p_70014_1_.func_74777_a("Age", (short)this.field_70292_b);
p_70014_1_.func_74777_a("PickupDelay", (short)this.field_145804_b); p_70014_1_.func_74777_a("PickupDelay", (short)this.field_145804_b);
@@ -73,7 +84,7 @@
if (this.func_145800_j() != null) if (this.func_145800_j() != null)
{ {
@@ -360,17 +381,22 @@ @@ -360,17 +383,22 @@
{ {
this.func_70106_y(); this.func_70106_y();
} }
@@ -97,7 +108,7 @@
{ {
if (item == Item.func_150898_a(Blocks.field_150364_r)) if (item == Item.func_150898_a(Blocks.field_150364_r))
{ {
@@ -407,6 +433,7 @@ @@ -407,6 +435,7 @@
} }
} }
@@ -105,7 +116,7 @@
p_70100_1_.func_71001_a(this, i); p_70100_1_.func_71001_a(this, i);
if (itemstack.func_190926_b()) if (itemstack.func_190926_b())
@@ -513,6 +540,6 @@ @@ -513,6 +542,6 @@
public void func_174870_v() public void func_174870_v()
{ {
this.func_174871_r(); this.func_174871_r();
@@ -1,6 +1,17 @@
--- ../src-base/minecraft/net/minecraft/entity/item/EntityXPOrb.java --- ../src-base/minecraft/net/minecraft/entity/item/EntityXPOrb.java
+++ ../src-work/minecraft/net/minecraft/entity/item/EntityXPOrb.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityXPOrb.java
@@ -170,6 +170,7 @@ @@ -137,7 +137,9 @@
if (this.field_70122_E)
{
- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().field_149765_K * 0.98F;
+ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v));
+ net.minecraft.block.state.IBlockState underState = this.field_70170_p.func_180495_p(underPos);
+ f = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, underPos, this) * 0.98F;
}
this.field_70159_w *= (double)f;
@@ -170,6 +172,7 @@
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_)
{ {
@@ -8,7 +19,7 @@
if (this.func_180431_b(p_70097_1_)) if (this.func_180431_b(p_70097_1_))
{ {
return false; return false;
@@ -208,6 +209,7 @@ @@ -208,6 +211,7 @@
{ {
if (this.field_70532_c == 0 && p_70100_1_.field_71090_bL == 0) if (this.field_70532_c == 0 && p_70100_1_.field_71090_bL == 0)
{ {
@@ -18,6 +18,15 @@
} }
} }
@@ -251,7 +251,7 @@
itemstack.func_111282_a(p_184645_1_, this, p_184645_2_);
return true;
}
- else if (!this.func_190669_a(itemstack, this.getClass()) && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_())
+ else if (!this.func_190669_a(itemstack, this.getClass()) && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_() && !p_184645_1_.func_70093_af())
{
if (this.field_70963_i == null)
{
@@ -323,6 +323,7 @@ @@ -323,6 +323,7 @@
{ {
super.func_70014_b(p_70014_1_); super.func_70014_b(p_70014_1_);
@@ -1,5 +1,16 @@
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityFishHook.java --- ../src-base/minecraft/net/minecraft/entity/projectile/EntityFishHook.java
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityFishHook.java +++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityFishHook.java
@@ -269,8 +269,8 @@
{
ItemStack itemstack = this.field_146042_b.func_184614_ca();
ItemStack itemstack1 = this.field_146042_b.func_184592_cb();
- boolean flag = itemstack.func_77973_b() == Items.field_151112_aM;
- boolean flag1 = itemstack1.func_77973_b() == Items.field_151112_aM;
+ boolean flag = itemstack.func_77973_b() instanceof net.minecraft.item.ItemFishingRod;
+ boolean flag1 = itemstack1.func_77973_b() instanceof net.minecraft.item.ItemFishingRod;
if (!this.field_146042_b.field_70128_L && this.field_146042_b.func_70089_S() && (flag || flag1) && this.func_70068_e(this.field_146042_b) <= 1024.0D)
{
@@ -506,6 +506,7 @@ @@ -506,6 +506,7 @@
{ {
int i = 0; int i = 0;
@@ -4,7 +4,7 @@
public void func_151394_a(ItemStack p_151394_1_, ItemStack p_151394_2_, float p_151394_3_) public void func_151394_a(ItemStack p_151394_1_, ItemStack p_151394_2_, float p_151394_3_)
{ {
+ if (func_151395_a(p_151394_1_) != ItemStack.field_190927_a) { net.minecraftforge.fml.common.FMLLog.info("Ignored smelting recipe with conflicting input: " + p_151394_1_ + " = " + p_151394_2_); return; } + if (func_151395_a(p_151394_1_) != ItemStack.field_190927_a) { net.minecraftforge.fml.common.FMLLog.log.info("Ignored smelting recipe with conflicting input: {} = {}", p_151394_1_, p_151394_2_); return; }
this.field_77604_b.put(p_151394_1_, p_151394_2_); this.field_77604_b.put(p_151394_1_, p_151394_2_);
this.field_77605_c.put(p_151394_2_, Float.valueOf(p_151394_3_)); this.field_77605_c.put(p_151394_2_, Float.valueOf(p_151394_3_));
} }
@@ -44,27 +44,25 @@
if (oclass != null) if (oclass != null)
{ {
@@ -103,6 +108,9 @@ @@ -103,6 +108,8 @@
catch (Throwable throwable1) catch (Throwable throwable1)
{ {
field_145852_a.error("Failed to create block entity {}", new Object[] {s, throwable1}); field_145852_a.error("Failed to create block entity {}", new Object[] {s, throwable1});
+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, throwable1, + net.minecraftforge.fml.common.FMLLog.log.error("A TileEntity {}({}) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
+ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", + s, oclass == null ? null : oclass.getName(), throwable1);
+ s, oclass.getName());
} }
if (tileentity != null) if (tileentity != null)
@@ -115,6 +123,9 @@ @@ -115,6 +122,8 @@
catch (Throwable throwable) catch (Throwable throwable)
{ {
field_145852_a.error("Failed to load data for block entity {}", new Object[] {s, throwable}); field_145852_a.error("Failed to load data for block entity {}", new Object[] {s, throwable});
+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, throwable, + net.minecraftforge.fml.common.FMLLog.log.error("A TileEntity {}({}) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
+ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", + s, oclass.getName(), throwable);
+ s, oclass.getName());
tileentity = null; tileentity = null;
} }
} }
@@ -156,7 +167,6 @@ @@ -156,7 +165,6 @@
} }
} }
@@ -72,7 +70,7 @@
public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_) public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_)
{ {
double d0 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_; double d0 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_;
@@ -297,6 +307,204 @@ @@ -297,6 +305,204 @@
{ {
} }
@@ -13,7 +13,7 @@
+ { + {
+ p_i1098_1_ = "MissingName"; + p_i1098_1_ = "MissingName";
+ p_i1098_2_ = p_i1098_3_ = "NotValid"; + p_i1098_2_ = p_i1098_3_ = "NotValid";
+ org.apache.logging.log4j.Logger logger = net.minecraftforge.fml.common.FMLLog.getLogger(); + org.apache.logging.log4j.Logger logger = net.minecraftforge.fml.common.FMLLog.log;
+ logger.log(org.apache.logging.log4j.Level.WARN, "========================================================="); + logger.log(org.apache.logging.log4j.Level.WARN, "=========================================================");
+ logger.log(org.apache.logging.log4j.Level.WARN, "WARNING!! the username was not set for this session, typically"); + logger.log(org.apache.logging.log4j.Level.WARN, "WARNING!! the username was not set for this session, typically");
+ logger.log(org.apache.logging.log4j.Level.WARN, "this means you installed Forge incorrectly. We have set your"); + logger.log(org.apache.logging.log4j.Level.WARN, "this means you installed Forge incorrectly. We have set your");
@@ -385,7 +385,7 @@
+ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) + if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities)
+ { + {
+ net.minecraftforge.fml.common.FMLLog.severe(crashreport.func_71502_e()); + net.minecraftforge.fml.common.FMLLog.log.fatal(crashreport.func_71502_e());
+ func_72900_e(entity); + func_72900_e(entity);
+ } + }
+ else + else
@@ -398,7 +398,7 @@
entity2.func_85029_a(crashreportcategory1); entity2.func_85029_a(crashreportcategory1);
+ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) + if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities)
+ { + {
+ net.minecraftforge.fml.common.FMLLog.severe(crashreport1.func_71502_e()); + net.minecraftforge.fml.common.FMLLog.log.fatal(crashreport1.func_71502_e());
+ func_72900_e(entity2); + func_72900_e(entity2);
+ } + }
+ else + else
@@ -425,7 +425,7 @@
tileentity.func_145828_a(crashreportcategory2); tileentity.func_145828_a(crashreportcategory2);
+ if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities) + if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities)
+ { + {
+ net.minecraftforge.fml.common.FMLLog.severe(crashreport2.func_71502_e()); + net.minecraftforge.fml.common.FMLLog.log.fatal(crashreport2.func_71502_e());
+ tileentity.func_145843_s(); + tileentity.func_145843_s();
+ this.func_175713_t(tileentity.func_174877_v()); + this.func_175713_t(tileentity.func_174877_v());
+ } + }
@@ -433,7 +433,7 @@
throw new ReportedException(crashreport2); throw new ReportedException(crashreport2);
} }
} }
@@ -1703,20 +1826,28 @@ @@ -1703,20 +1826,31 @@
if (this.func_175667_e(tileentity.func_174877_v())) if (this.func_175667_e(tileentity.func_174877_v()))
{ {
@@ -450,13 +450,18 @@
- -
if (!this.field_147483_b.isEmpty()) 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) + for (Object tile : field_147483_b)
+ { + {
+ ((TileEntity)tile).onChunkUnload(); + ((TileEntity)tile).onChunkUnload();
+ } + }
+ +
this.field_175730_i.removeAll(this.field_147483_b); + // forge: faster "contains" makes this removal much more efficient (MC-117075)
this.field_147482_g.removeAll(this.field_147483_b); + 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(); this.field_147483_b.clear();
} }
@@ -465,7 +470,7 @@
this.field_72984_F.func_76318_c("pendingBlockEntities"); this.field_72984_F.func_76318_c("pendingBlockEntities");
if (!this.field_147484_a.isEmpty()) if (!this.field_147484_a.isEmpty())
@@ -1755,12 +1886,18 @@ @@ -1755,12 +1889,18 @@
public boolean func_175700_a(TileEntity p_175700_1_) public boolean func_175700_a(TileEntity p_175700_1_)
{ {
@@ -484,7 +489,7 @@
if (this.field_72995_K) if (this.field_72995_K)
{ {
@@ -1776,6 +1913,11 @@ @@ -1776,6 +1916,11 @@
{ {
if (this.field_147481_N) if (this.field_147481_N)
{ {
@@ -496,7 +501,7 @@
this.field_147484_a.addAll(p_147448_1_); this.field_147484_a.addAll(p_147448_1_);
} }
else else
@@ -1796,9 +1938,12 @@ @@ -1796,9 +1941,12 @@
{ {
int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t); int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t);
int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v); int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v);
@@ -511,7 +516,7 @@
{ {
p_72866_1_.field_70142_S = p_72866_1_.field_70165_t; p_72866_1_.field_70142_S = p_72866_1_.field_70165_t;
p_72866_1_.field_70137_T = p_72866_1_.field_70163_u; p_72866_1_.field_70137_T = p_72866_1_.field_70163_u;
@@ -1816,6 +1961,7 @@ @@ -1816,6 +1964,7 @@
} }
else else
{ {
@@ -519,7 +524,7 @@
p_72866_1_.func_70071_h_(); p_72866_1_.func_70071_h_();
} }
} }
@@ -1997,6 +2143,11 @@ @@ -1997,6 +2146,11 @@
blockpos$pooledmutableblockpos.func_185344_t(); blockpos$pooledmutableblockpos.func_185344_t();
return true; return true;
} }
@@ -531,7 +536,7 @@
} }
} }
} }
@@ -2036,6 +2187,16 @@ @@ -2036,6 +2190,16 @@
IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos); IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos);
Block block = iblockstate.func_177230_c(); Block block = iblockstate.func_177230_c();
@@ -548,7 +553,7 @@
if (iblockstate.func_185904_a() == p_72918_2_) 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())); double d0 = (double)((float)(l1 + 1) - BlockLiquid.func_149801_b(((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue()));
@@ -2102,6 +2263,7 @@ @@ -2102,6 +2266,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_) 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_); 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_);
@@ -556,7 +561,7 @@
explosion.func_77278_a(); explosion.func_77278_a();
explosion.func_77279_a(true); explosion.func_77279_a(true);
return explosion; return explosion;
@@ -2224,6 +2386,7 @@ @@ -2224,6 +2389,7 @@
public void func_175690_a(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_) public void func_175690_a(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_)
{ {
@@ -564,7 +569,7 @@
if (!this.func_189509_E(p_175690_1_)) if (!this.func_189509_E(p_175690_1_))
{ {
if (p_175690_2_ != null && !p_175690_2_.func_145837_r()) if (p_175690_2_ != null && !p_175690_2_.func_145837_r())
@@ -2231,6 +2394,8 @@ @@ -2231,6 +2397,8 @@
if (this.field_147481_N) if (this.field_147481_N)
{ {
p_175690_2_.func_174878_a(p_175690_1_); p_175690_2_.func_174878_a(p_175690_1_);
@@ -573,7 +578,7 @@
Iterator<TileEntity> iterator = this.field_147484_a.iterator(); Iterator<TileEntity> iterator = this.field_147484_a.iterator();
while (iterator.hasNext()) while (iterator.hasNext())
@@ -2248,7 +2413,8 @@ @@ -2248,7 +2416,8 @@
} }
else else
{ {
@@ -583,7 +588,7 @@
this.func_175700_a(p_175690_2_); this.func_175700_a(p_175690_2_);
} }
} }
@@ -2263,6 +2429,8 @@ @@ -2263,6 +2432,8 @@
{ {
tileentity.func_145843_s(); tileentity.func_145843_s();
this.field_147484_a.remove(tileentity); this.field_147484_a.remove(tileentity);
@@ -592,7 +597,7 @@
} }
else else
{ {
@@ -2275,6 +2443,7 @@ @@ -2275,6 +2446,7 @@
this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_); this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_);
} }
@@ -600,7 +605,7 @@
} }
public void func_147457_a(TileEntity p_147457_1_) public void func_147457_a(TileEntity p_147457_1_)
@@ -2301,7 +2470,7 @@ @@ -2301,7 +2473,7 @@
if (chunk != null && !chunk.func_76621_g()) if (chunk != null && !chunk.func_76621_g())
{ {
IBlockState iblockstate = this.func_180495_p(p_175677_1_); IBlockState iblockstate = this.func_180495_p(p_175677_1_);
@@ -609,7 +614,7 @@
} }
else else
{ {
@@ -2324,6 +2493,7 @@ @@ -2324,6 +2496,7 @@
{ {
this.field_72985_G = p_72891_1_; this.field_72985_G = p_72891_1_;
this.field_72992_H = p_72891_2_; this.field_72992_H = p_72891_2_;
@@ -617,7 +622,7 @@
} }
public void func_72835_b() public void func_72835_b()
@@ -2333,6 +2503,11 @@ @@ -2333,6 +2506,11 @@
protected void func_72947_a() protected void func_72947_a()
{ {
@@ -629,7 +634,7 @@
if (this.field_72986_A.func_76059_o()) if (this.field_72986_A.func_76059_o())
{ {
this.field_73004_o = 1.0F; this.field_73004_o = 1.0F;
@@ -2346,6 +2521,11 @@ @@ -2346,6 +2524,11 @@
protected void func_72979_l() protected void func_72979_l()
{ {
@@ -641,7 +646,7 @@
if (this.field_73011_w.func_191066_m()) if (this.field_73011_w.func_191066_m())
{ {
if (!this.field_72995_K) if (!this.field_72995_K)
@@ -2470,6 +2650,11 @@ @@ -2470,6 +2653,11 @@
public boolean func_175670_e(BlockPos p_175670_1_, boolean p_175670_2_) public boolean func_175670_e(BlockPos p_175670_1_, boolean p_175670_2_)
{ {
@@ -653,7 +658,7 @@
Biome biome = this.func_180494_b(p_175670_1_); Biome biome = this.func_180494_b(p_175670_1_);
float f = biome.func_180626_a(p_175670_1_); float f = biome.func_180626_a(p_175670_1_);
@@ -2511,6 +2696,11 @@ @@ -2511,6 +2699,11 @@
public boolean func_175708_f(BlockPos p_175708_1_, boolean p_175708_2_) public boolean func_175708_f(BlockPos p_175708_1_, boolean p_175708_2_)
{ {
@@ -665,7 +670,7 @@
Biome biome = this.func_180494_b(p_175708_1_); Biome biome = this.func_180494_b(p_175708_1_);
float f = biome.func_180626_a(p_175708_1_); float f = biome.func_180626_a(p_175708_1_);
@@ -2528,7 +2718,7 @@ @@ -2528,7 +2721,7 @@
{ {
IBlockState iblockstate = this.func_180495_p(p_175708_1_); IBlockState iblockstate = this.func_180495_p(p_175708_1_);
@@ -674,7 +679,7 @@
{ {
return true; return true;
} }
@@ -2560,10 +2750,11 @@ @@ -2560,10 +2753,11 @@
else else
{ {
IBlockState iblockstate = this.func_180495_p(p_175638_1_); IBlockState iblockstate = this.func_180495_p(p_175638_1_);
@@ -689,7 +694,7 @@
{ {
j = 1; j = 1;
} }
@@ -2597,6 +2788,7 @@ @@ -2597,6 +2791,7 @@
if (i >= 14) if (i >= 14)
{ {
@@ -697,7 +702,7 @@
return i; return i;
} }
} }
@@ -2662,7 +2854,7 @@ @@ -2662,7 +2857,7 @@
int j4 = j2 + enumfacing.func_96559_d(); int j4 = j2 + enumfacing.func_96559_d();
int k4 = k2 + enumfacing.func_82599_e(); int k4 = k2 + enumfacing.func_82599_e();
blockpos$pooledmutableblockpos.func_181079_c(i4, j4, k4); blockpos$pooledmutableblockpos.func_181079_c(i4, j4, k4);
@@ -706,7 +711,7 @@
i3 = this.func_175642_b(p_180500_1_, blockpos$pooledmutableblockpos); i3 = this.func_175642_b(p_180500_1_, blockpos$pooledmutableblockpos);
if (i3 == l2 - l4 && j < this.field_72994_J.length) if (i3 == l2 - l4 && j < this.field_72994_J.length)
@@ -2770,10 +2962,10 @@ @@ -2770,10 +2965,10 @@
public List<Entity> func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate <? super Entity > p_175674_3_) 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(); List<Entity> list = Lists.<Entity>newArrayList();
@@ -721,7 +726,7 @@
for (int i1 = i; i1 <= j; ++i1) for (int i1 = i; i1 <= j; ++i1)
{ {
@@ -2826,10 +3018,10 @@ @@ -2826,10 +3021,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_) 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_)
{ {
@@ -736,7 +741,7 @@
List<T> list = Lists.<T>newArrayList(); List<T> list = Lists.<T>newArrayList();
for (int i1 = i; i1 < j; ++i1) for (int i1 = i; i1 < j; ++i1)
@@ -2909,11 +3101,13 @@ @@ -2909,11 +3104,13 @@
public void func_175650_b(Collection<Entity> p_175650_1_) public void func_175650_b(Collection<Entity> p_175650_1_)
{ {
@@ -753,7 +758,7 @@
} }
} }
@@ -2926,7 +3120,7 @@ @@ -2926,7 +3123,7 @@
{ {
IBlockState iblockstate = this.func_180495_p(p_190527_2_); IBlockState iblockstate = this.func_180495_p(p_190527_2_);
AxisAlignedBB axisalignedbb = p_190527_3_ ? null : p_190527_1_.func_176223_P().func_185890_d(this, p_190527_2_); AxisAlignedBB axisalignedbb = p_190527_3_ ? null : p_190527_1_.func_176223_P().func_185890_d(this, p_190527_2_);
@@ -762,7 +767,7 @@
} }
public int func_181545_F() public int func_181545_F()
@@ -3009,7 +3203,7 @@ @@ -3009,7 +3206,7 @@
public int func_175651_c(BlockPos p_175651_1_, EnumFacing p_175651_2_) public int func_175651_c(BlockPos p_175651_1_, EnumFacing p_175651_2_)
{ {
IBlockState iblockstate = this.func_180495_p(p_175651_1_); IBlockState iblockstate = this.func_180495_p(p_175651_1_);
@@ -771,7 +776,7 @@
} }
public boolean func_175640_z(BlockPos p_175640_1_) public boolean func_175640_z(BlockPos p_175640_1_)
@@ -3152,6 +3346,8 @@ @@ -3152,6 +3349,8 @@
d2 *= ((Double)Objects.firstNonNull(p_184150_11_.apply(entityplayer1), Double.valueOf(1.0D))).doubleValue(); d2 *= ((Double)Objects.firstNonNull(p_184150_11_.apply(entityplayer1), Double.valueOf(1.0D))).doubleValue();
} }
@@ -780,7 +785,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)) 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; d0 = d1;
@@ -3213,7 +3409,7 @@ @@ -3213,7 +3412,7 @@
public long func_72905_C() public long func_72905_C()
{ {
@@ -789,7 +794,7 @@
} }
public long func_82737_E() public long func_82737_E()
@@ -3223,17 +3419,17 @@ @@ -3223,17 +3422,17 @@
public long func_72820_D() public long func_72820_D()
{ {
@@ -810,7 +815,7 @@
if (!this.func_175723_af().func_177746_a(blockpos)) if (!this.func_175723_af().func_177746_a(blockpos))
{ {
@@ -3245,7 +3441,7 @@ @@ -3245,7 +3444,7 @@
public void func_175652_B(BlockPos p_175652_1_) public void func_175652_B(BlockPos p_175652_1_)
{ {
@@ -819,7 +824,7 @@
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@@ -3265,12 +3461,18 @@ @@ -3265,12 +3464,18 @@
if (!this.field_72996_f.contains(p_72897_1_)) if (!this.field_72996_f.contains(p_72897_1_))
{ {
@@ -838,7 +843,7 @@
return true; return true;
} }
@@ -3364,8 +3566,7 @@ @@ -3364,8 +3569,7 @@
public boolean func_180502_D(BlockPos p_180502_1_) public boolean func_180502_D(BlockPos p_180502_1_)
{ {
@@ -848,7 +853,7 @@
} }
@Nullable @Nullable
@@ -3426,12 +3627,12 @@ @@ -3426,12 +3630,12 @@
public int func_72800_K() public int func_72800_K()
{ {
@@ -863,7 +868,7 @@
} }
public Random func_72843_D(int p_72843_1_, int p_72843_2_, int p_72843_3_) public Random func_72843_D(int p_72843_1_, int p_72843_2_, int p_72843_3_)
@@ -3475,7 +3676,7 @@ @@ -3475,7 +3679,7 @@
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public double func_72919_O() public double func_72919_O()
{ {
@@ -872,7 +877,7 @@
} }
public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_) public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_)
@@ -3509,7 +3710,7 @@ @@ -3509,7 +3713,7 @@
public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_)
{ {
@@ -881,7 +886,7 @@
{ {
BlockPos blockpos = p_175666_1_.func_177972_a(enumfacing); BlockPos blockpos = p_175666_1_.func_177972_a(enumfacing);
@@ -3517,18 +3718,14 @@ @@ -3517,18 +3721,14 @@
{ {
IBlockState iblockstate = this.func_180495_p(blockpos); IBlockState iblockstate = this.func_180495_p(blockpos);
@@ -904,7 +909,7 @@
} }
} }
} }
@@ -3594,6 +3791,115 @@ @@ -3594,6 +3794,115 @@
return i >= -128 && i <= 128 && j >= -128 && j <= 128; return i >= -128 && i <= 128 && j >= -128 && j <= 128;
} }
@@ -54,7 +54,7 @@
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@@ -222,6 +208,339 @@ @@ -222,6 +208,353 @@
return new WorldBorder(); return new WorldBorder();
} }
@@ -177,6 +177,20 @@
+ weatherRenderer = renderer; + weatherRenderer = renderer;
+ } + }
+ +
+ /**
+ * Allows for manipulating the coloring of the lightmap texture.
+ * Will be called for each 16*16 combination of sky/block light values.
+ *
+ * @param partialTicks Progress between ticks.
+ * @param sunBrightness Current sun brightness.
+ * @param skyLight Sky light brightness factor.
+ * @param blockLight Block light brightness factor.
+ * @param colors The color values that will be used: [r, g, b].
+ *
+ * @see net.minecraft.client.renderer.EntityRenderer#updateLightmap(float)
+ */
+ public void getLightmapColors(float partialTicks, float sunBrightness, float skyLight, float blockLight, float[] colors) {}
+
+ public BlockPos getRandomizedSpawnPoint() + public BlockPos getRandomizedSpawnPoint()
+ { + {
+ BlockPos ret = this.field_76579_a.func_175694_M(); + BlockPos ret = this.field_76579_a.func_175694_M();
@@ -283,7 +283,15 @@
{ {
this.field_76637_e.func_175664_x(blockpos$mutableblockpos); this.field_76637_e.func_175664_x(blockpos$mutableblockpos);
} }
@@ -1476,4 +1495,34 @@ @@ -1407,6 +1426,7 @@
else
{
System.arraycopy(p_177420_1_, 0, this.field_76634_f, 0, this.field_76634_f.length);
+ this.field_82912_p = com.google.common.primitives.Ints.min(this.field_76634_f); // Forge: update min height value (MC-117412)
}
}
@@ -1476,4 +1496,34 @@
QUEUED, QUEUED,
CHECK; CHECK;
} }
@@ -310,11 +318,11 @@
+ private void logCascadingWorldGeneration() + private void logCascadingWorldGeneration()
+ { + {
+ net.minecraftforge.fml.common.ModContainer activeModContainer = net.minecraftforge.fml.common.Loader.instance().activeModContainer(); + net.minecraftforge.fml.common.ModContainer activeModContainer = net.minecraftforge.fml.common.Loader.instance().activeModContainer();
+ String format = "%s loaded a new chunk (%d, %d Dimension: %d) during chunk population, causing cascading worldgen lag. Please report this to the mod's issue tracker. This log can be disabled in the Forge config."; + String format = "{} loaded a new chunk ({}, {} Dimension: {}) during chunk population, causing cascading worldgen lag. Please report this to the mod's issue tracker. This log can be disabled in the Forge config.";
+ +
+ if (activeModContainer == null) // vanilla minecraft has problems too (MC-114332), log it at a quieter level. + if (activeModContainer == null) // vanilla minecraft has problems too (MC-114332), log it at a quieter level.
+ net.minecraftforge.fml.common.FMLLog.fine(format, "Minecraft", this.field_76635_g, this.field_76647_h, this.field_76637_e.field_73011_w.getDimension()); + net.minecraftforge.fml.common.FMLLog.log.debug(format, "Minecraft", this.field_76635_g, this.field_76647_h, this.field_76637_e.field_73011_w.getDimension());
+ else + else
+ net.minecraftforge.fml.common.FMLLog.warning(format, activeModContainer.getName(), this.field_76635_g, this.field_76647_h, this.field_76637_e.field_73011_w.getDimension()); + net.minecraftforge.fml.common.FMLLog.log.warn(format, activeModContainer.getName(), this.field_76635_g, this.field_76647_h, this.field_76637_e.field_73011_w.getDimension());
+ } + }
} }
@@ -97,17 +97,18 @@
} }
} }
} }
@@ -121,7 +180,9 @@ @@ -121,7 +180,10 @@
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound.func_74782_a("Level", nbttagcompound1); nbttagcompound.func_74782_a("Level", nbttagcompound1);
nbttagcompound.func_74768_a("DataVersion", 922); nbttagcompound.func_74768_a("DataVersion", 922);
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().getDataFixer().writeVersionData(nbttagcompound); + net.minecraftforge.fml.common.FMLCommonHandler.instance().getDataFixer().writeVersionData(nbttagcompound);
this.func_75820_a(p_75816_2_, p_75816_1_, nbttagcompound1); this.func_75820_a(p_75816_2_, p_75816_1_, nbttagcompound1);
+ net.minecraftforge.common.ForgeChunkManager.storeChunkNBT(p_75816_2_, nbttagcompound1);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(p_75816_2_, nbttagcompound)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(p_75816_2_, nbttagcompound));
this.func_75824_a(p_75816_2_.func_76632_l(), nbttagcompound); this.func_75824_a(p_75816_2_.func_76632_l(), nbttagcompound);
} }
catch (Exception exception) catch (Exception exception)
@@ -305,11 +366,20 @@ @@ -305,11 +367,19 @@
{ {
NBTTagCompound nbttagcompound2 = new NBTTagCompound(); NBTTagCompound nbttagcompound2 = new NBTTagCompound();
@@ -121,14 +122,13 @@
+ } + }
+ catch (Exception e) + catch (Exception e)
+ { + {
+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, + net.minecraftforge.fml.common.FMLLog.log.error("An Entity type {} has thrown an exception trying to write state. It will not persist. Report this to the mod author",
+ "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author", + entity.getClass().getName(), e);
+ entity.getClass().getName());
+ } + }
} }
} }
@@ -318,8 +388,17 @@ @@ -318,8 +388,16 @@
for (TileEntity tileentity : p_75820_1_.func_177434_r().values()) for (TileEntity tileentity : p_75820_1_.func_177434_r().values())
{ {
@@ -139,14 +139,13 @@
+ } + }
+ catch (Exception e) + catch (Exception e)
+ { + {
+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, + net.minecraftforge.fml.common.FMLLog.log.error("A TileEntity type {} has throw an exception trying to write state. It will not persist. Report this to the mod author",
+ "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author", + tileentity.getClass().getName(), e);
+ tileentity.getClass().getName());
+ } + }
} }
p_75820_3_.func_74782_a("TileEntities", nbttaglist2); p_75820_3_.func_74782_a("TileEntities", nbttaglist2);
@@ -388,6 +467,12 @@ @@ -388,6 +466,12 @@
chunk.func_76616_a(p_75823_2_.func_74770_j("Biomes")); chunk.func_76616_a(p_75823_2_.func_74770_j("Biomes"));
} }
@@ -159,7 +158,7 @@
NBTTagList nbttaglist1 = p_75823_2_.func_150295_c("Entities", 10); NBTTagList nbttaglist1 = p_75823_2_.func_150295_c("Entities", 10);
for (int j1 = 0; j1 < nbttaglist1.func_74745_c(); ++j1) for (int j1 = 0; j1 < nbttaglist1.func_74745_c(); ++j1)
@@ -431,8 +516,6 @@ @@ -431,8 +515,6 @@
p_75823_1_.func_180497_b(new BlockPos(nbttagcompound3.func_74762_e("x"), nbttagcompound3.func_74762_e("y"), nbttagcompound3.func_74762_e("z")), block, nbttagcompound3.func_74762_e("t"), nbttagcompound3.func_74762_e("p")); p_75823_1_.func_180497_b(new BlockPos(nbttagcompound3.func_74762_e("x"), nbttagcompound3.func_74762_e("y"), nbttagcompound3.func_74762_e("z")), block, nbttagcompound3.func_74762_e("t"), nbttagcompound3.func_74762_e("p"));
} }
} }
@@ -29,7 +29,7 @@
+ chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(pos, this.field_73251_h); + chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(pos, this.field_73251_h);
+ if (chunk != null || !(this.field_73247_e instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader)) + if (chunk != null || !(this.field_73247_e instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader))
{ {
+ if (!loadingChunks.add(pos)) net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in dimension %d that is already being loaded. This will cause weird chunk breakages.", p_186028_1_, p_186028_2_, this.field_73251_h.field_73011_w.getDimension()); + if (!loadingChunks.add(pos)) net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk ({},{}) in dimension {} that is already being loaded. This will cause weird chunk breakages.", p_186028_1_, p_186028_2_, this.field_73251_h.field_73011_w.getDimension());
+ if (chunk == null) chunk = this.func_73239_e(p_186028_1_, p_186028_2_); + if (chunk == null) chunk = this.func_73239_e(p_186028_1_, p_186028_2_);
+ +
+ if (chunk != null) + if (chunk != null)
@@ -72,11 +72,15 @@
Iterator<Long> iterator = this.field_73248_b.iterator(); Iterator<Long> iterator = this.field_73248_b.iterator();
for (int i = 0; i < 100 && iterator.hasNext(); iterator.remove()) for (int i = 0; i < 100 && iterator.hasNext(); iterator.remove())
@@ -239,6 +272,11 @@ @@ -235,10 +268,15 @@
if (chunk != null && chunk.field_189550_d)
{
chunk.func_76623_d();
+ net.minecraftforge.common.ForgeChunkManager.putDormantChunk(ChunkPos.func_77272_a(chunk.field_76635_g, chunk.field_76647_h), chunk);
this.func_73242_b(chunk);
this.func_73243_a(chunk); this.func_73243_a(chunk);
this.field_73244_f.remove(olong); this.field_73244_f.remove(olong);
++i; ++i;
+ net.minecraftforge.common.ForgeChunkManager.putDormantChunk(ChunkPos.func_77272_a(chunk.field_76635_g, chunk.field_76647_h), chunk);
+ if (field_73244_f.size() == 0 && net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this.field_73251_h).size() == 0 && !this.field_73251_h.field_73011_w.func_186058_p().shouldLoadSpawn()){ + if (field_73244_f.size() == 0 && net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this.field_73251_h).size() == 0 && !this.field_73251_h.field_73011_w.func_186058_p().shouldLoadSpawn()){
+ net.minecraftforge.common.DimensionManager.unloadWorld(this.field_73251_h.field_73011_w.getDimension()); + net.minecraftforge.common.DimensionManager.unloadWorld(this.field_73251_h.field_73011_w.getDimension());
+ break; + break;
@@ -512,7 +512,7 @@ public class ForgeHooksClient
glEnableVertexAttribArray(attr.getIndex()); glEnableVertexAttribArray(attr.getIndex());
glVertexAttribPointer(attr.getIndex(), count, constant, false, stride, buffer); glVertexAttribPointer(attr.getIndex(), count, constant, false, stride, buffer);
default: default:
FMLLog.severe("Unimplemented vanilla attribute upload: %s", attrType.getDisplayName()); FMLLog.log.fatal("Unimplemented vanilla attribute upload: {}", attrType.getDisplayName());
} }
} }
@@ -542,7 +542,7 @@ public class ForgeHooksClient
case GENERIC: case GENERIC:
glDisableVertexAttribArray(attr.getIndex()); glDisableVertexAttribArray(attr.getIndex());
default: default:
FMLLog.severe("Unimplemented vanilla attribute upload: %s", attrType.getDisplayName()); FMLLog.log.fatal("Unimplemented vanilla attribute upload: {}", attrType.getDisplayName());
} }
} }
@@ -28,14 +28,22 @@ public abstract class RenderLivingEvent<T extends EntityLivingBase> extends Even
{ {
private final EntityLivingBase entity; private final EntityLivingBase entity;
private final RenderLivingBase<T> renderer; private final RenderLivingBase<T> renderer;
private final float partialRenderTick;
private final double x; private final double x;
private final double y; private final double y;
private final double z; private final double z;
@Deprecated
public RenderLivingEvent(EntityLivingBase entity, RenderLivingBase<T> renderer, double x, double y, double z) public RenderLivingEvent(EntityLivingBase entity, RenderLivingBase<T> renderer, double x, double y, double z)
{
this(entity, renderer, 1, x, y, z);
}
public RenderLivingEvent(EntityLivingBase entity, RenderLivingBase<T> renderer, float partialRenderTick, double x, double y, double z)
{ {
this.entity = entity; this.entity = entity;
this.renderer = renderer; this.renderer = renderer;
this.partialRenderTick = partialRenderTick;
this.x = x; this.x = x;
this.y = y; this.y = y;
this.z = z; this.z = z;
@@ -43,6 +51,7 @@ public abstract class RenderLivingEvent<T extends EntityLivingBase> extends Even
public EntityLivingBase getEntity() { return entity; } public EntityLivingBase getEntity() { return entity; }
public RenderLivingBase<T> getRenderer() { return renderer; } public RenderLivingBase<T> getRenderer() { return renderer; }
public float getPartialRenderTick() { return partialRenderTick; }
public double getX() { return x; } public double getX() { return x; }
public double getY() { return y; } public double getY() { return y; }
public double getZ() { return z; } public double getZ() { return z; }
@@ -50,16 +59,20 @@ public abstract class RenderLivingEvent<T extends EntityLivingBase> extends Even
@Cancelable @Cancelable
public static class Pre<T extends EntityLivingBase> extends RenderLivingEvent<T> public static class Pre<T extends EntityLivingBase> extends RenderLivingEvent<T>
{ {
@Deprecated
public Pre(EntityLivingBase entity, RenderLivingBase<T> renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } public Pre(EntityLivingBase entity, RenderLivingBase<T> renderer, double x, double y, double z){ super(entity, renderer, x, y, z); }
public Pre(EntityLivingBase entity, RenderLivingBase<T> renderer, float partialRenderTick, double x, double y, double z){ super(entity, renderer, partialRenderTick, x, y, z); }
} }
public static class Post<T extends EntityLivingBase> extends RenderLivingEvent<T> public static class Post<T extends EntityLivingBase> extends RenderLivingEvent<T>
{ {
@Deprecated
public Post(EntityLivingBase entity, RenderLivingBase<T> renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } public Post(EntityLivingBase entity, RenderLivingBase<T> renderer, double x, double y, double z){ super(entity, renderer, x, y, z); }
public Post(EntityLivingBase entity, RenderLivingBase<T> renderer, float partialRenderTick, double x, double y, double z){ super(entity, renderer, partialRenderTick, x, y, z); }
} }
public abstract static class Specials<T extends EntityLivingBase> extends RenderLivingEvent<T> public abstract static class Specials<T extends EntityLivingBase> extends RenderLivingEvent<T>
{ {
public Specials(EntityLivingBase entity, RenderLivingBase<T> renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } public Specials(EntityLivingBase entity, RenderLivingBase<T> renderer, double x, double y, double z){ super(entity, renderer, 0, x, y, z); }
@Cancelable @Cancelable
public static class Pre<T extends EntityLivingBase> extends Specials<T> public static class Pre<T extends EntityLivingBase> extends Specials<T>
@@ -68,7 +81,7 @@ public abstract class RenderLivingEvent<T extends EntityLivingBase> extends Even
} }
public static class Post<T extends EntityLivingBase> extends Specials<T> public static class Post<T extends EntityLivingBase> extends Specials<T>
{ {
public Post(EntityLivingBase entity, RenderLivingBase<T> renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } public Post(EntityLivingBase entity, RenderLivingBase<T> renderer, double x, double y, double z){ super(entity, renderer, x, y, z); }
} }
} }
} }
@@ -188,9 +188,9 @@ public class ForgeBlockStateV1 extends Marker
String value = v.textures.get(tex.getValue().substring(1)); String value = v.textures.get(tex.getValue().substring(1));
if (value == null) if (value == null)
{ {
FMLLog.severe("Could not resolve texture name \"" + tex.getValue() + "\" for permutation \"" + e.getKey() + "\""); FMLLog.log.fatal("Could not resolve texture name \"{}\" for permutation \"{}\"", tex.getValue(), e.getKey());
for (Entry<String, String> t: v.textures.entrySet()) for (Entry<String, String> t: v.textures.entrySet())
FMLLog.severe(t.getKey() + "=" + t.getValue()); FMLLog.log.fatal("{}={}", t.getKey(), t.getValue());
throw new JsonParseException("Could not resolve texture name \"" + tex.getValue() + "\" for permutation \"" + e.getKey() + "\""); throw new JsonParseException("Could not resolve texture name \"" + tex.getValue() + "\" for permutation \"" + e.getKey() + "\"");
} }
v.textures.put(tex.getKey(), value); v.textures.put(tex.getKey(), value);
@@ -418,7 +418,7 @@ public final class ModelFluid implements IModelCustomData
String fluid = e.getAsString(); String fluid = e.getAsString();
if(!FluidRegistry.isFluidRegistered(fluid)) if(!FluidRegistry.isFluidRegistered(fluid))
{ {
FMLLog.severe("fluid '%s' not found", fluid); FMLLog.log.fatal("fluid '{}' not found", fluid);
return WATER; return WATER;
} }
return new ModelFluid(FluidRegistry.getFluid(fluid)); return new ModelFluid(FluidRegistry.getFluid(fluid));
@@ -342,7 +342,7 @@ public final class ModelLoader extends ModelBakery
catch(Exception normalException) catch(Exception normalException)
{ {
// try blockstate json if the item model is missing // try blockstate json if the item model is missing
FMLLog.fine("Item json isn't found for '" + memory + "', trying to load the variant from the blockstate json"); FMLLog.log.debug("Item json isn't found for '{}', trying to load the variant from the blockstate json", memory);
try try
{ {
model = ModelLoaderRegistry.getModel(memory); model = ModelLoaderRegistry.getModel(memory);
@@ -375,7 +375,7 @@ public final class ModelLoader extends ModelBakery
} }
catch (Exception exception) catch (Exception exception)
{ {
FMLLog.getLogger().error("Could not load the forge bucket model from the blockstate", exception); FMLLog.log.error("Could not load the forge bucket model from the blockstate", exception);
return; return;
} }
} }
@@ -791,7 +791,7 @@ public final class ModelLoader extends ModelBakery
textures.addAll(model.getTextures()); // Kick this, just in case. textures.addAll(model.getTextures()); // Kick this, just in case.
models.add(model); models.add(model);
builder.add(Pair.of(model, v.getState())); builder.add(Pair.<IModel, IModelState>of(model, new ModelStateComposition(v.getState(), model.getDefaultState())));
} }
if (models.size() == 0) //If all variants are missing, add one with the missing model and default rotation. if (models.size() == 0) //If all variants are missing, add one with the missing model and default rotation.
@@ -1083,17 +1083,17 @@ public final class ModelLoader extends ModelBakery
if(entry.getValue() instanceof ItemLoadingException) if(entry.getValue() instanceof ItemLoadingException)
{ {
ItemLoadingException ex = (ItemLoadingException)entry.getValue(); ItemLoadingException ex = (ItemLoadingException)entry.getValue();
FMLLog.getLogger().error(errorMsg + ", normal location exception: ", ex.normalException); FMLLog.log.error("{}, normal location exception: ", errorMsg, ex.normalException);
FMLLog.getLogger().error(errorMsg + ", blockstate location exception: ", ex.blockstateException); FMLLog.log.error("{}, blockstate location exception: ", errorMsg, ex.blockstateException);
} }
else else
{ {
FMLLog.getLogger().error(errorMsg, entry.getValue()); FMLLog.log.error(errorMsg, entry.getValue());
} }
ResourceLocation blockstateLocation = new ResourceLocation(location.getResourceDomain(), location.getResourcePath()); ResourceLocation blockstateLocation = new ResourceLocation(location.getResourceDomain(), location.getResourcePath());
if(loadingExceptions.containsKey(blockstateLocation) && !printedBlockStateErrors.contains(blockstateLocation)) if(loadingExceptions.containsKey(blockstateLocation) && !printedBlockStateErrors.contains(blockstateLocation))
{ {
FMLLog.getLogger().error("Exception loading blockstate for the variant " + location + ": ", loadingExceptions.get(blockstateLocation)); FMLLog.log.error("Exception loading blockstate for the variant {}: ", location, loadingExceptions.get(blockstateLocation));
printedBlockStateErrors.add(blockstateLocation); printedBlockStateErrors.add(blockstateLocation);
} }
} }
@@ -1116,7 +1116,7 @@ public final class ModelLoader extends ModelBakery
errorCount++; errorCount++;
if(errorCount < verboseMissingInfoCount) if(errorCount < verboseMissingInfoCount)
{ {
FMLLog.severe("Model definition for location %s not found", missing); FMLLog.log.fatal("Model definition for location {} not found", missing);
} }
modelErrors.put(domain, errorCount); modelErrors.put(domain, errorCount);
} }
@@ -1129,7 +1129,7 @@ public final class ModelLoader extends ModelBakery
{ {
if(e.getValue() >= verboseMissingInfoCount) if(e.getValue() >= verboseMissingInfoCount)
{ {
FMLLog.severe("Suppressed additional %s model loading errors for domain %s", e.getValue() - verboseMissingInfoCount, e.getKey()); FMLLog.log.fatal("Suppressed additional {} model loading errors for domain {}", e.getValue() - verboseMissingInfoCount, e.getKey());
} }
} }
isLoading = false; isLoading = false;
@@ -204,7 +204,7 @@ public class ModelLoaderRegistry
} }
catch(Exception e) catch(Exception e)
{ {
FMLLog.getLogger().error(error, e); FMLLog.log.error(error, e);
return getMissingModel(location, e); return getMissingModel(location, e);
} }
} }
@@ -134,7 +134,7 @@ public final class MultiLayerModel implements IModelCustomData
{ {
return new ModelResourceLocation(e.getAsString()); return new ModelResourceLocation(e.getAsString());
} }
FMLLog.severe("Expect ModelResourceLocation, got: ", json); FMLLog.log.fatal("Expect ModelResourceLocation, got: {}", json);
return new ModelResourceLocation("builtin/missing", "missing"); return new ModelResourceLocation("builtin/missing", "missing");
} }
@@ -291,7 +291,7 @@ public final class MultiModel implements IModel
if(bakedBase == null && parts.isEmpty()) if(bakedBase == null && parts.isEmpty())
{ {
FMLLog.log(Level.ERROR, "MultiModel %s is empty (no base model or parts were provided/resolved)", location); FMLLog.log.error("MultiModel {} is empty (no base model or parts were provided/resolved)", location);
IModel missing = ModelLoaderRegistry.getMissingModel(); IModel missing = ModelLoaderRegistry.getMissingModel();
return missing.bake(missing.getDefaultState(), format, bakedTextureGetter); return missing.bake(missing.getDefaultState(), format, bakedTextureGetter);
} }
@@ -326,6 +326,7 @@ public class ModelBlockAnimation
time -= Math.floor(time); time -= Math.floor(time);
Vector3f translation = new Vector3f(0, 0, 0); Vector3f translation = new Vector3f(0, 0, 0);
Vector3f scale = new Vector3f(1, 1, 1); Vector3f scale = new Vector3f(1, 1, 1);
Vector3f origin = new Vector3f(0, 0, 0);
AxisAngle4f rotation = new AxisAngle4f(0, 0, 0, 0); AxisAngle4f rotation = new AxisAngle4f(0, 0, 0, 0);
for(MBVariableClip var : variables) for(MBVariableClip var : variables)
{ {
@@ -390,11 +391,24 @@ public class ModelBlockAnimation
case ZS: case ZS:
scale.z = value; scale.z = value;
break; break;
case XORIGIN:
origin.x = value - 0.5F;
break;
case YORIGIN:
origin.y = value - 0.5F;
break;
case ZORIGIN:
origin.z = value - 0.5F;
break;
} }
} }
Quat4f rot = new Quat4f(); Quat4f rot = new Quat4f();
rot.set(rotation); rot.set(rotation);
return TRSRTransformation.blockCenterToCorner(new TRSRTransformation(translation, rot, scale, null)); TRSRTransformation base = new TRSRTransformation(translation, rot, scale, null);
Vector3f negOrigin = new Vector3f(origin);
negOrigin.negate();
base = new TRSRTransformation(origin, null, null, null).compose(base).compose(new TRSRTransformation(negOrigin, null, null, null));
return TRSRTransformation.blockCenterToCorner(base);
} }
} }
} }
@@ -498,7 +512,13 @@ public class ModelBlockAnimation
@SerializedName("scale_y") @SerializedName("scale_y")
YS, YS,
@SerializedName("scale_z") @SerializedName("scale_z")
ZS; ZS,
@SerializedName("origin_x")
XORIGIN,
@SerializedName("origin_y")
YORIGIN,
@SerializedName("origin_z")
ZORIGIN;
} }
public static enum Type public static enum Type
@@ -572,12 +592,12 @@ public class ModelBlockAnimation
} }
catch(IOException e) catch(IOException e)
{ {
FMLLog.log(Level.ERROR, e, "Exception loading vanilla model animation %s, skipping", armatureLocation); FMLLog.log.error("Exception loading vanilla model animation {}, skipping", armatureLocation, e);
return defaultModelBlockAnimation; return defaultModelBlockAnimation;
} }
catch(JsonParseException e) catch(JsonParseException e)
{ {
FMLLog.log(Level.ERROR, e, "Exception loading vanilla model animation %s, skipping", armatureLocation); FMLLog.log.error("Exception loading vanilla model animation {}, skipping", armatureLocation, e);
return defaultModelBlockAnimation; return defaultModelBlockAnimation;
} }
} }
@@ -496,7 +496,7 @@ public enum B3DLoader implements ICustomModelLoader
{ {
if(e.getValue().getResourcePath().startsWith("#")) if(e.getValue().getResourcePath().startsWith("#"))
{ {
FMLLog.severe("unresolved texture '%s' for b3d model '%s'", e.getValue().getResourcePath(), modelLocation); FMLLog.log.fatal("unresolved texture '{}' for b3d model '{}'", e.getValue().getResourcePath(), modelLocation);
builder.put(e.getKey(), missing); builder.put(e.getKey(), missing);
} }
else else
@@ -533,6 +533,9 @@ public enum B3DLoader implements ICustomModelLoader
@Override @Override
public ModelWrapper process(ImmutableMap<String, String> data) public ModelWrapper process(ImmutableMap<String, String> data)
{ {
ImmutableSet<String> newMeshes = this.meshes;
int newDefaultKey = this.defaultKey;
boolean hasChanged = false;
if(data.containsKey("mesh")) if(data.containsKey("mesh"))
{ {
JsonElement e = new JsonParser().parse(data.get("mesh")); JsonElement e = new JsonParser().parse(data.get("mesh"));
@@ -551,15 +554,16 @@ public enum B3DLoader implements ICustomModelLoader
} }
else else
{ {
FMLLog.severe("unknown mesh definition '%s' in array for b3d model '%s'", s.toString(), modelLocation); FMLLog.log.fatal("unknown mesh definition '{}' in array for b3d model '{}'", s.toString(), modelLocation);
return this; return this;
} }
} }
return new ModelWrapper(modelLocation, model, builder.build(), smooth, gui3d, defaultKey, textures); newMeshes = builder.build();
hasChanged = true;
} }
else else
{ {
FMLLog.severe("unknown mesh definition '%s' for b3d model '%s'", e.toString(), modelLocation); FMLLog.log.fatal("unknown mesh definition '{}' for b3d model '{}'", e.toString(), modelLocation);
return this; return this;
} }
} }
@@ -568,15 +572,16 @@ public enum B3DLoader implements ICustomModelLoader
JsonElement e = new JsonParser().parse(data.get("key")); JsonElement e = new JsonParser().parse(data.get("key"));
if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isNumber()) if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isNumber())
{ {
return new ModelWrapper(modelLocation, model, meshes, smooth, gui3d, e.getAsNumber().intValue(), textures); newDefaultKey = e.getAsNumber().intValue();
hasChanged = true;
} }
else else
{ {
FMLLog.severe("unknown keyframe definition '%s' for b3d model '%s'", e.toString(), modelLocation); FMLLog.log.fatal("unknown keyframe definition '{}' for b3d model '{}'", e.toString(), modelLocation);
return this; return this;
} }
} }
return this; return hasChanged ? new ModelWrapper(modelLocation, model, newMeshes, smooth, gui3d, newDefaultKey, textures) : this;
} }
public Optional<IClip> getClip(String name) public Optional<IClip> getClip(String name)
@@ -139,7 +139,7 @@ public class B3DModel
{ {
if(texture > textures.size()) if(texture > textures.size())
{ {
logger.error(String.format("texture %s is out of range", texture)); logger.error("texture {} is out of range", texture);
return null; return null;
} }
else if(texture == -1) return Texture.White; else if(texture == -1) return Texture.White;
@@ -152,7 +152,7 @@ public class B3DModel
{ {
if(brush > brushes.size()) if(brush > brushes.size())
{ {
logger.error(String.format("brush %s is out of range", brush)); logger.error("brush {} is out of range", brush);
return null; return null;
} }
else if(brush == -1) return null; else if(brush == -1) return null;
@@ -165,7 +165,7 @@ public class B3DModel
{ {
if(vertex > vertices.size()) if(vertex > vertices.size())
{ {
logger.error(String.format("vertex %s is out of range", vertex)); logger.error("vertex {} is out of range", vertex);
return null; return null;
} }
return vertices.get(vertex); return vertices.get(vertex);
@@ -408,17 +408,17 @@ public class B3DModel
{ {
if(pos != null) if(pos != null)
{ {
if(oldKey.getPos() != null) logger.error("Duplicate keys: %s and %s (ignored)", oldKey, key); if(oldKey.getPos() != null) logger.error("Duplicate keys: {} and {} (ignored)", oldKey, key);
else key = new Key(oldKey.getPos(), key.getScale(), key.getRot()); else key = new Key(oldKey.getPos(), key.getScale(), key.getRot());
} }
if(scale != null) if(scale != null)
{ {
if(oldKey.getScale() != null) logger.error("Duplicate keys: %s and %s (ignored)", oldKey, key); if(oldKey.getScale() != null) logger.error("Duplicate keys: {} and {} (ignored)", oldKey, key);
else key = new Key(key.getPos(), oldKey.getScale(), key.getRot()); else key = new Key(key.getPos(), oldKey.getScale(), key.getRot());
} }
if(rot != null) if(rot != null)
{ {
if(oldKey.getRot() != null) logger.error("Duplicate keys: %s and %s (ignored)", oldKey, key); if(oldKey.getRot() != null) logger.error("Duplicate keys: {} and {} (ignored)", oldKey, key);
else key = new Key(key.getPos(), key.getScale(), oldKey.getRot()); else key = new Key(key.getPos(), key.getScale(), oldKey.getRot());
} }
} }
@@ -51,7 +51,7 @@ public enum OBJLoader implements ICustomModelLoader {
public void addDomain(String domain) public void addDomain(String domain)
{ {
enabledDomains.add(domain.toLowerCase()); enabledDomains.add(domain.toLowerCase());
FMLLog.log(Level.INFO, "OBJLoader: Domain %s has been added.", domain.toLowerCase()); FMLLog.log.info("OBJLoader: Domain {} has been added.", domain.toLowerCase());
} }
public void onResourceManagerReload(IResourceManager resourceManager) public void onResourceManagerReload(IResourceManager resourceManager)
@@ -128,7 +128,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
{ {
if (e.getValue().getTexture().getTextureLocation().getResourcePath().startsWith("#")) if (e.getValue().getTexture().getTextureLocation().getResourcePath().startsWith("#"))
{ {
FMLLog.severe("OBJLoader: Unresolved texture '%s' for obj model '%s'", e.getValue().getTexture().getTextureLocation().getResourcePath(), modelLocation); FMLLog.log.fatal("OBJLoader: Unresolved texture '{}' for obj model '{}'", e.getValue().getTexture().getTextureLocation().getResourcePath(), modelLocation);
builder.put(e.getKey(), missing); builder.put(e.getKey(), missing);
} }
else else
@@ -285,7 +285,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
else if (key.equalsIgnoreCase("f")) // Face Elements: f v1[/vt1][/vn1] ... else if (key.equalsIgnoreCase("f")) // Face Elements: f v1[/vt1][/vn1] ...
{ {
if (splitData.length > 4) if (splitData.length > 4)
FMLLog.warning("OBJModel.Parser: found a face ('f') with more than 4 vertices, only the first 4 of these vertices will be rendered!"); FMLLog.log.warn("OBJModel.Parser: found a face ('f') with more than 4 vertices, only the first 4 of these vertices will be rendered!");
List<Vertex> v = Lists.newArrayListWithCapacity(splitData.length); List<Vertex> v = Lists.newArrayListWithCapacity(splitData.length);
@@ -368,7 +368,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
if (!unknownObjectCommands.contains(key)) if (!unknownObjectCommands.contains(key))
{ {
unknownObjectCommands.add(key); unknownObjectCommands.add(key);
FMLLog.info("OBJLoader.Parser: command '%s' (model: '%s') is not currently supported, skipping. Line: %d '%s'", key, objFrom, lineNum, currentLine); FMLLog.log.info("OBJLoader.Parser: command '{}' (model: '{}') is not currently supported, skipping. Line: {} '{}'", key, objFrom, lineNum, currentLine);
} }
} }
} }
@@ -545,7 +545,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
} }
else else
{ {
FMLLog.info("OBJModel: A color has already been defined for material '%s' in '%s'. The color defined by key '%s' will not be applied!", material.getName(), new ResourceLocation(domain, path).toString(), key); FMLLog.log.info("OBJModel: A color has already been defined for material '{}' in '{}'. The color defined by key '{}' will not be applied!", material.getName(), new ResourceLocation(domain, path).toString(), key);
} }
} }
else if (key.equalsIgnoreCase("map_Ka") || key.equalsIgnoreCase("map_Kd") || key.equalsIgnoreCase("map_Ks")) else if (key.equalsIgnoreCase("map_Ka") || key.equalsIgnoreCase("map_Kd") || key.equalsIgnoreCase("map_Ks"))
@@ -569,7 +569,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
} }
else else
{ {
FMLLog.info("OBJModel: A texture has already been defined for material '%s' in '%s'. The texture defined by key '%s' will not be applied!", material.getName(), new ResourceLocation(domain, path).toString(), key); FMLLog.log.info("OBJModel: A texture has already been defined for material '{}' in '{}'. The texture defined by key '{}' will not be applied!", material.getName(), new ResourceLocation(domain, path).toString(), key);
} }
} }
else if (key.equalsIgnoreCase("d") || key.equalsIgnoreCase("Tr")) else if (key.equalsIgnoreCase("d") || key.equalsIgnoreCase("Tr"))
@@ -585,7 +585,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
if (!unknownMaterialCommands.contains(key)) if (!unknownMaterialCommands.contains(key))
{ {
unknownMaterialCommands.add(key); unknownMaterialCommands.add(key);
FMLLog.info("OBJLoader.MaterialLibrary: key '%s' (model: '%s') is not currently supported, skipping", key, new ResourceLocation(domain, path)); FMLLog.log.info("OBJLoader.MaterialLibrary: key '{}' (model: '{}') is not currently supported, skipping", key, new ResourceLocation(domain, path));
} }
} }
} }
@@ -173,6 +173,7 @@ public class BiomeDictionary
Preconditions.checkArgument(ForgeRegistries.BIOMES.containsValue(biome), "Cannot add types to unregistered biome %s", biome); Preconditions.checkArgument(ForgeRegistries.BIOMES.containsValue(biome), "Cannot add types to unregistered biome %s", biome);
Collection<Type> supertypes = listSupertypes(types); Collection<Type> supertypes = listSupertypes(types);
Collections.addAll(supertypes, types);
for (Type type : supertypes) for (Type type : supertypes)
{ {
@@ -373,7 +374,7 @@ public class BiomeDictionary
if (!hasAnyType(biome)) if (!hasAnyType(biome))
{ {
makeBestGuess(biome); makeBestGuess(biome);
FMLLog.warning("No types have been added to Biome %s, types have been assigned on a best-effort guess: %s", biome.getRegistryName(), getTypes(biome)); FMLLog.log.warn("No types have been added to Biome {}, types have been assigned on a best-effort guess: {}", biome.getRegistryName(), getTypes(biome));
} }
} }
@@ -389,7 +390,7 @@ public class BiomeDictionary
for (Type sType : Type.byName.values()) for (Type sType : Type.byName.values())
{ {
if (type.subTypes.contains(type) && supertypes.add(sType)) if (sType.subTypes.contains(type) && supertypes.add(sType))
next.add(sType); next.add(sType);
} }
} }
@@ -169,11 +169,11 @@ public class DimensionManager
int leakCount = leakedWorlds.count(System.identityHashCode(w)); int leakCount = leakedWorlds.count(System.identityHashCode(w));
if (leakCount == 5) if (leakCount == 5)
{ {
FMLLog.fine("The world %x (%s) may have leaked: first encounter (5 occurrences).\n", System.identityHashCode(w), w.getWorldInfo().getWorldName()); FMLLog.log.debug("The world {} ({}) may have leaked: first encounter (5 occurrences).\n", Integer.toHexString(System.identityHashCode(w)), w.getWorldInfo().getWorldName());
} }
else if (leakCount % 5 == 0) else if (leakCount % 5 == 0)
{ {
FMLLog.fine("The world %x (%s) may have leaked: seen %d times.\n", System.identityHashCode(w), w.getWorldInfo().getWorldName(), leakCount); FMLLog.log.debug("The world {} ({}) may have leaked: seen {} times.\n", Integer.toHexString(System.identityHashCode(w)), w.getWorldInfo().getWorldName(), leakCount);
} }
} }
} }
@@ -191,13 +191,13 @@ public class DimensionManager
worlds.put(id, world); worlds.put(id, world);
weakWorldMap.put(world, world); weakWorldMap.put(world, world);
server.worldTickTimes.put(id, new long[100]); server.worldTickTimes.put(id, new long[100]);
FMLLog.info("Loading dimension %d (%s) (%s)", id, world.getWorldInfo().getWorldName(), world.getMinecraftServer()); FMLLog.log.info("Loading dimension {} ({}) ({})", id, world.getWorldInfo().getWorldName(), world.getMinecraftServer());
} }
else else
{ {
worlds.remove(id); worlds.remove(id);
server.worldTickTimes.remove(id); server.worldTickTimes.remove(id);
FMLLog.info("Unloading dimension %d", id); FMLLog.log.info("Unloading dimension {}", id);
} }
ArrayList<WorldServer> tmp = new ArrayList<WorldServer>(); ArrayList<WorldServer> tmp = new ArrayList<WorldServer>();
@@ -292,8 +292,8 @@ public class DimensionManager
} }
catch (Exception e) catch (Exception e)
{ {
FMLCommonHandler.instance().getFMLLogger().log(Level.ERROR, String.format("An error occurred trying to create an instance of WorldProvider %d (%s)", FMLLog.log.error("An error occurred trying to create an instance of WorldProvider {} ({})",
dim, getProviderType(dim)),e); dim, getProviderType(dim), e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@@ -307,7 +307,7 @@ public class DimensionManager
{ {
if(!unloadQueue.contains(id)) if(!unloadQueue.contains(id))
{ {
FMLLog.fine("Queueing dimension %s to unload", id); FMLLog.log.debug("Queueing dimension {} to unload", id);
unloadQueue.add(id); unloadQueue.add(id);
} }
else else
@@ -339,7 +339,7 @@ public class DimensionManager
dimension.ticksWaited = 0; dimension.ticksWaited = 0;
if (w == null || !ForgeChunkManager.getPersistentChunksFor(w).isEmpty() || !w.playerEntities.isEmpty() || dimension.type.shouldLoadSpawn()) //Don't unload the world if the status changed if (w == null || !ForgeChunkManager.getPersistentChunksFor(w).isEmpty() || !w.playerEntities.isEmpty() || dimension.type.shouldLoadSpawn()) //Don't unload the world if the status changed
{ {
FMLLog.fine("Aborting unload for dimension %s as status changed", id); FMLLog.log.debug("Aborting unload for dimension {} as status changed", id);
continue; continue;
} }
try try
@@ -40,12 +40,14 @@ import net.minecraft.entity.Entity;
import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ClassInheritanceMultiMap; import net.minecraft.util.ClassInheritanceMultiMap;
import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.storage.AnvilChunkLoader;
import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property; import net.minecraftforge.common.config.Property;
@@ -112,7 +114,7 @@ public class ForgeChunkManager
private static Map<World, ImmutableSetMultimap<ChunkPos,Ticket>> forcedChunks = new MapMaker().weakKeys().makeMap(); private static Map<World, ImmutableSetMultimap<ChunkPos,Ticket>> forcedChunks = new MapMaker().weakKeys().makeMap();
private static BiMap<UUID,Ticket> pendingEntities = HashBiMap.create(); private static BiMap<UUID,Ticket> pendingEntities = HashBiMap.create();
private static Map<World,Cache<Long, Chunk>> dormantChunkCache = new MapMaker().weakKeys().makeMap(); private static Map<World,Cache<Long, ChunkEntry>> dormantChunkCache = new MapMaker().weakKeys().makeMap();
private static File cfgFile; private static File cfgFile;
private static Configuration config; private static Configuration config;
@@ -129,6 +131,18 @@ public class ForgeChunkManager
MOD_PROP_ORDER.add("maximumChunksPerTicket"); MOD_PROP_ORDER.add("maximumChunksPerTicket");
} }
private static class ChunkEntry
{
public final Chunk chunk;
public final NBTTagCompound nbt;
public ChunkEntry(Chunk chunk)
{
this.chunk = chunk;
this.nbt = new NBTTagCompound();
}
}
public static Iterator<Chunk> getPersistentChunksIterableFor(final World world, Iterator<Chunk> chunkIterator) public static Iterator<Chunk> getPersistentChunksIterableFor(final World world, Iterator<Chunk> chunkIterator)
{ {
final ImmutableSetMultimap<ChunkPos, Ticket> persistentChunksFor = getPersistentChunksFor(world); final ImmutableSetMultimap<ChunkPos, Ticket> persistentChunksFor = getPersistentChunksFor(world);
@@ -263,7 +277,7 @@ public class ForgeChunkManager
} }
else else
{ {
FMLLog.log(Level.ERROR, "Attempt to create a player ticket without a valid player"); FMLLog.log.error("Attempt to create a player ticket without a valid player");
throw new RuntimeException(); throw new RuntimeException();
} }
} }
@@ -277,7 +291,7 @@ public class ForgeChunkManager
{ {
if (depth > getMaxChunkDepthFor(modId) || (depth <= 0 && getMaxChunkDepthFor(modId) > 0)) if (depth > getMaxChunkDepthFor(modId) || (depth <= 0 && getMaxChunkDepthFor(modId) > 0))
{ {
FMLLog.warning("The mod %s tried to modify the chunk ticket depth to: %d, its allowed maximum is: %d", modId, depth, getMaxChunkDepthFor(modId)); FMLLog.log.warn("The mod {} tried to modify the chunk ticket depth to: {}, its allowed maximum is: {}", modId, depth, getMaxChunkDepthFor(modId));
} }
else else
{ {
@@ -472,7 +486,7 @@ public class ForgeChunkManager
if (dormantChunkCacheSize != 0) if (dormantChunkCacheSize != 0)
{ // only put into cache if we're using dormant chunk caching { // only put into cache if we're using dormant chunk caching
dormantChunkCache.put(world, CacheBuilder.newBuilder().maximumSize(dormantChunkCacheSize).<Long, Chunk>build()); dormantChunkCache.put(world, CacheBuilder.newBuilder().maximumSize(dormantChunkCacheSize).<Long, ChunkEntry>build());
} }
WorldServer worldServer = (WorldServer) world; WorldServer worldServer = (WorldServer) world;
File chunkDir = worldServer.getChunkSaveLocation(); File chunkDir = worldServer.getChunkSaveLocation();
@@ -489,7 +503,7 @@ public class ForgeChunkManager
} }
catch (IOException e) catch (IOException e)
{ {
FMLLog.log(Level.WARN, e, "Unable to read forced chunk data at %s - it will be ignored", chunkLoaderData.getAbsolutePath()); FMLLog.log.warn("Unable to read forced chunk data at {} - it will be ignored", chunkLoaderData.getAbsolutePath(), e);
return; return;
} }
NBTTagList ticketList = forcedChunkData.getTagList("TicketList", Constants.NBT.TAG_COMPOUND); NBTTagList ticketList = forcedChunkData.getTagList("TicketList", Constants.NBT.TAG_COMPOUND);
@@ -501,13 +515,13 @@ public class ForgeChunkManager
if (!isPlayer && !Loader.isModLoaded(modId)) if (!isPlayer && !Loader.isModLoaded(modId))
{ {
FMLLog.warning("Found chunkloading data for mod %s which is currently not available or active - it will be removed from the world save", modId); FMLLog.log.warn("Found chunkloading data for mod {} which is currently not available or active - it will be removed from the world save", modId);
continue; continue;
} }
if (!isPlayer && !callbacks.containsKey(modId)) if (!isPlayer && !callbacks.containsKey(modId))
{ {
FMLLog.warning("The mod %s has registered persistent chunkloading data but doesn't seem to want to be called back with it - it will be removed from the world save", modId); FMLLog.log.warn("The mod {} has registered persistent chunkloading data but doesn't seem to want to be called back with it - it will be removed from the world save", modId);
continue; continue;
} }
@@ -561,7 +575,7 @@ public class ForgeChunkManager
{ {
if (tick.ticketType == Type.ENTITY && tick.entity == null) if (tick.ticketType == Type.ENTITY && tick.entity == null)
{ {
FMLLog.warning("Failed to load persistent chunkloading entity %s from store.", pendingEntities.inverse().get(tick)); FMLLog.log.warn("Failed to load persistent chunkloading entity {} from store.", pendingEntities.inverse().get(tick));
loadedTickets.remove(tick.modId, tick); loadedTickets.remove(tick.modId, tick);
} }
} }
@@ -583,7 +597,7 @@ public class ForgeChunkManager
} }
if (tickets.size() > maxTicketLength) if (tickets.size() > maxTicketLength)
{ {
FMLLog.warning("The mod %s has too many open chunkloading tickets %d. Excess will be dropped", modId, tickets.size()); FMLLog.log.warn("The mod {} has too many open chunkloading tickets {}. Excess will be dropped", modId, tickets.size());
tickets.subList(maxTicketLength, tickets.size()).clear(); tickets.subList(maxTicketLength, tickets.size()).clear();
} }
ForgeChunkManager.tickets.get(world).putAll(modId, tickets); ForgeChunkManager.tickets.get(world).putAll(modId, tickets);
@@ -641,7 +655,7 @@ public class ForgeChunkManager
ModContainer container = getContainer(mod); ModContainer container = getContainer(mod);
if (container == null) if (container == null)
{ {
FMLLog.warning("Unable to register a callback for an unknown mod %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod)); FMLLog.log.warn("Unable to register a callback for an unknown mod {} ({} : {})", mod, mod.getClass().getName(), Integer.toHexString(System.identityHashCode(mod)));
return; return;
} }
@@ -699,12 +713,12 @@ public class ForgeChunkManager
ModContainer mc = getContainer(mod); ModContainer mc = getContainer(mod);
if (mc == null) if (mc == null)
{ {
FMLLog.log(Level.ERROR, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod)); FMLLog.log.error("Failed to locate the container for mod instance {} ({} : {})", mod, mod.getClass().getName(), Integer.toHexString(System.identityHashCode(mod)));
return null; return null;
} }
if (playerTickets.get(player).size()>playerTicketLength) if (playerTickets.get(player).size()>playerTicketLength)
{ {
FMLLog.warning("Unable to assign further chunkloading tickets to player %s (on behalf of mod %s)", player, mc.getModId()); FMLLog.log.warn("Unable to assign further chunkloading tickets to player {} (on behalf of mod {})", player, mc.getModId());
return null; return null;
} }
Ticket ticket = new Ticket(mc.getModId(),type,world,player); Ticket ticket = new Ticket(mc.getModId(),type,world,player);
@@ -726,13 +740,13 @@ public class ForgeChunkManager
ModContainer container = getContainer(mod); ModContainer container = getContainer(mod);
if (container == null) if (container == null)
{ {
FMLLog.log(Level.ERROR, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod)); FMLLog.log.error("Failed to locate the container for mod instance {} ({} : {})", mod, mod.getClass().getName(), Integer.toHexString(System.identityHashCode(mod)));
return null; return null;
} }
String modId = container.getModId(); String modId = container.getModId();
if (!callbacks.containsKey(modId)) if (!callbacks.containsKey(modId))
{ {
FMLLog.severe("The mod %s has attempted to request a ticket without a listener in place", modId); FMLLog.log.fatal("The mod {} has attempted to request a ticket without a listener in place", modId);
throw new RuntimeException("Invalid ticket request"); throw new RuntimeException("Invalid ticket request");
} }
@@ -742,7 +756,7 @@ public class ForgeChunkManager
{ {
if (!warnedMods.contains(modId)) if (!warnedMods.contains(modId))
{ {
FMLLog.info("The mod %s has attempted to allocate a chunkloading ticket beyond it's currently allocated maximum : %d", modId, allowedCount); FMLLog.log.info("The mod {} has attempted to allocate a chunkloading ticket beyond it's currently allocated maximum: {}", modId, allowedCount);
warnedMods.add(modId); warnedMods.add(modId);
} }
return null; return null;
@@ -806,7 +820,7 @@ public class ForgeChunkManager
} }
if (ticket.isPlayerTicket() ? !playerTickets.containsValue(ticket) : !tickets.get(ticket.world).containsEntry(ticket.modId, ticket)) if (ticket.isPlayerTicket() ? !playerTickets.containsValue(ticket) : !tickets.get(ticket.world).containsEntry(ticket.modId, ticket))
{ {
FMLLog.severe("The mod %s attempted to force load a chunk with an invalid ticket. This is not permitted.", ticket.modId); FMLLog.log.fatal("The mod {} attempted to force load a chunk with an invalid ticket. This is not permitted.", ticket.modId);
return; return;
} }
ticket.requestedChunks.add(chunk); ticket.requestedChunks.add(chunk);
@@ -949,7 +963,7 @@ public class ForgeChunkManager
} }
catch (IOException e) catch (IOException e)
{ {
FMLLog.log(Level.WARN, e, "Unable to write forced chunk data to %s - chunkloading won't work", chunkLoaderData.getAbsolutePath()); FMLLog.log.warn("Unable to write forced chunk data to {} - chunkloading won't work", chunkLoaderData.getAbsolutePath(), e);
return; return;
} }
} }
@@ -968,10 +982,32 @@ public class ForgeChunkManager
public static void putDormantChunk(long coords, Chunk chunk) public static void putDormantChunk(long coords, Chunk chunk)
{ {
if (dormantChunkCacheSize == 0) return; // Skip if we're not dormant caching chunks if (dormantChunkCacheSize == 0) return; // Skip if we're not dormant caching chunks
Cache<Long, Chunk> cache = dormantChunkCache.get(chunk.getWorld()); Cache<Long, ChunkEntry> cache = dormantChunkCache.get(chunk.getWorld());
if (cache != null) if (cache != null)
{ {
cache.put(coords, chunk); cache.put(coords, new ChunkEntry(chunk));
}
}
public static void storeChunkNBT(Chunk chunk, NBTTagCompound nbt)
{
if (dormantChunkCacheSize == 0) return;
Cache<Long, ChunkEntry> cache = dormantChunkCache.get(chunk.getWorld());
if (cache == null) return;
ChunkEntry entry = cache.getIfPresent(ChunkPos.asLong(chunk.xPosition, chunk.zPosition));
if (entry != null)
{
entry.nbt.setTag("Entities", nbt.getTagList("Entities", Constants.NBT.TAG_COMPOUND));
entry.nbt.setTag("TileEntities", nbt.getTagList("TileEntities", Constants.NBT.TAG_COMPOUND));
ClassInheritanceMultiMap<Entity>[] entityLists = chunk.getEntityLists();
for (int i = 0; i < entityLists.length; ++i)
{
entityLists[i] = new ClassInheritanceMultiMap<Entity>(Entity.class);
}
chunk.getTileEntityMap().clear();
} }
} }
@@ -979,24 +1015,34 @@ public class ForgeChunkManager
public static Chunk fetchDormantChunk(long coords, World world) public static Chunk fetchDormantChunk(long coords, World world)
{ {
if (dormantChunkCacheSize == 0) return null; // Don't bother with maps at all if its never gonna get a response if (dormantChunkCacheSize == 0) return null; // Don't bother with maps at all if its never gonna get a response
Cache<Long, Chunk> cache = dormantChunkCache.get(world);
if (cache == null) Cache<Long, ChunkEntry> cache = dormantChunkCache.get(world);
if (cache == null) return null;
ChunkEntry entry = cache.getIfPresent(coords);
if (entry == null) return null;
loadChunkEntities(entry.chunk, entry.nbt, world);
cache.invalidate(coords);
return entry.chunk;
}
private static void loadChunkEntities(Chunk chunk, NBTTagCompound nbt, World world)
{
NBTTagList entities = nbt.getTagList("Entities", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < entities.tagCount(); ++i)
{ {
return null; AnvilChunkLoader.readChunkEntity(entities.getCompoundTagAt(i), world, chunk);
chunk.setHasEntities(true);
} }
Chunk chunk = cache.getIfPresent(coords);
if (chunk != null) NBTTagList tileEntities = nbt.getTagList("TileEntities", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < tileEntities.tagCount(); ++i)
{ {
for (ClassInheritanceMultiMap<Entity> eList : chunk.getEntityLists()) TileEntity tileentity = TileEntity.create(world, tileEntities.getCompoundTagAt(i));
{ if (tileentity != null) chunk.addTileEntity(tileentity);
Iterator<Entity> itr = eList.iterator();
while (itr.hasNext())
{
(itr.next()).resetEntityId();
}
}
} }
return chunk;
} }
static void captureConfig(File configDir) static void captureConfig(File configDir)
@@ -1015,7 +1061,7 @@ public class ForgeChunkManager
dest.delete(); dest.delete();
} }
cfgFile.renameTo(dest); cfgFile.renameTo(dest);
FMLLog.log(Level.ERROR, e, "A critical error occurred reading the forgeChunkLoading.cfg file, defaults will be used - the invalid file is backed up at forgeChunkLoading.cfg.bak"); FMLLog.log.error("A critical error occurred reading the forgeChunkLoading.cfg file, defaults will be used - the invalid file is backed up at forgeChunkLoading.cfg.bak", e);
} }
syncConfigDefaults(); syncConfigDefaults();
} }
@@ -1068,7 +1114,7 @@ public class ForgeChunkManager
temp.setMinValue(0); temp.setMinValue(0);
dormantChunkCacheSize = temp.getInt(0); dormantChunkCacheSize = temp.getInt(0);
propOrder.add("dormantChunkCacheSize"); propOrder.add("dormantChunkCacheSize");
FMLLog.info("Configured a dormant chunk cache size of %d", temp.getInt(0)); FMLLog.log.info("Configured a dormant chunk cache size of {}", temp.getInt(0));
config.setCategoryPropertyOrder("defaults", propOrder); config.setCategoryPropertyOrder("defaults", propOrder);
@@ -42,6 +42,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.crash.ICrashReportDetail; import net.minecraft.crash.ICrashReportDetail;
import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTBase;
@@ -119,6 +121,8 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
public static int dimensionUnloadQueueDelay = 0; public static int dimensionUnloadQueueDelay = 0;
public static boolean logCascadingWorldGeneration = true; // see Chunk#logCascadingWorldGeneration() public static boolean logCascadingWorldGeneration = true; // see Chunk#logCascadingWorldGeneration()
static final Logger log = LogManager.getLogger(ForgeVersion.MOD_ID);
private static Configuration config; private static Configuration config;
private static ForgeModContainer INSTANCE; private static ForgeModContainer INSTANCE;
public static ForgeModContainer getInstance() public static ForgeModContainer getInstance()
@@ -232,7 +236,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
if (removeErroringEntities) if (removeErroringEntities)
{ {
FMLLog.warning("Enabling removal of erroring Entities - USE AT YOUR OWN RISK"); FMLLog.log.warn("Enabling removal of erroring Entities - USE AT YOUR OWN RISK");
} }
prop = config.get(Configuration.CATEGORY_GENERAL, "removeErroringTileEntities", false); prop = config.get(Configuration.CATEGORY_GENERAL, "removeErroringTileEntities", false);
@@ -243,7 +247,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
if (removeErroringTileEntities) if (removeErroringTileEntities)
{ {
FMLLog.warning("Enabling removal of erroring Tile Entities - USE AT YOUR OWN RISK"); FMLLog.log.warn("Enabling removal of erroring Tile Entities - USE AT YOUR OWN RISK");
} }
prop = config.get(Configuration.CATEGORY_GENERAL, "fullBoundingBoxLadders", false); prop = config.get(Configuration.CATEGORY_GENERAL, "fullBoundingBoxLadders", false);
@@ -419,11 +423,11 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
itr.remove(); itr.remove();
} }
FMLLog.log(ForgeVersion.MOD_ID, Level.DEBUG, "Preloading CrashReport Classes"); log.debug("Preloading CrashReport Classes");
Collections.sort(all); //Sort it because I like pretty output ;) Collections.sort(all); //Sort it because I like pretty output ;)
for (String name : all) for (String name : all)
{ {
FMLLog.log(ForgeVersion.MOD_ID, Level.DEBUG, "\t" + name); log.debug("\t{}", name);
try try
{ {
Class.forName(name.replace('/', '.'), false, MinecraftForge.class.getClassLoader()); Class.forName(name.replace('/', '.'), false, MinecraftForge.class.getClassLoader());
@@ -37,6 +37,8 @@ import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import com.google.gson.Gson; import com.google.gson.Gson;
@@ -58,7 +60,7 @@ public class ForgeVersion
//This number is incremented every minecraft release, never reset //This number is incremented every minecraft release, never reset
public static final int minorVersion = 20; public static final int minorVersion = 20;
//This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version //This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version
public static final int revisionVersion = 0; public static final int revisionVersion = 1;
//This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code. //This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code.
public static final int buildVersion = 0; public static final int buildVersion = 0;
// This is the minecraft version we're building for - used in various places in Forge/FML code // This is the minecraft version we're building for - used in various places in Forge/FML code
@@ -70,6 +72,8 @@ public class ForgeVersion
@SuppressWarnings("unused") @SuppressWarnings("unused")
private static String target = null; private static String target = null;
private static final Logger log = LogManager.getLogger("ForgeVersionCheck");
public static int getMajorVersion() public static int getMajorVersion()
{ {
return majorVersion; return majorVersion;
@@ -186,7 +190,7 @@ public class ForgeVersion
{ {
if (!ForgeModContainer.getConfig().get(ForgeModContainer.VERSION_CHECK_CAT, "Global", true).getBoolean()) if (!ForgeModContainer.getConfig().get(ForgeModContainer.VERSION_CHECK_CAT, "Global", true).getBoolean())
{ {
FMLLog.log("ForgeVersionCheck", Level.INFO, "Global Forge version check system disabled, no further processing."); log.info("Global Forge version check system disabled, no further processing.");
return; return;
} }
@@ -199,7 +203,7 @@ public class ForgeVersion
} }
else else
{ {
FMLLog.log("ForgeVersionCheck", Level.INFO, "[%s] Skipped version check", mod.getModId()); log.info("[{}] Skipped version check", mod.getModId());
} }
} }
} }
@@ -208,7 +212,7 @@ public class ForgeVersion
{ {
try try
{ {
FMLLog.log("ForgeVersionCheck", Level.INFO, "[%s] Starting version check at %s", mod.getModId(), url.toString()); log.info("[{}] Starting version check at {}", mod.getModId(), url.toString());
Status status = PENDING; Status status = PENDING;
ComparableVersion target = null; ComparableVersion target = null;
@@ -216,7 +220,7 @@ public class ForgeVersion
String data = new String(ByteStreams.toByteArray(con), "UTF-8"); String data = new String(ByteStreams.toByteArray(con), "UTF-8");
con.close(); con.close();
FMLLog.log("ForgeVersionCheck", Level.DEBUG, "[%s] Received version check data:\n%s", mod.getModId(), data); log.debug("[{}] Received version check data:\n{}", mod.getModId(), data);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -269,7 +273,7 @@ public class ForgeVersion
else else
status = BETA; status = BETA;
FMLLog.log("ForgeVersionCheck", Level.INFO, "[%s] Found status: %s Target: %s", mod.getModId(), status, target); log.info("[{}] Found status: {} Target: {}", mod.getModId(), status, target);
Map<ComparableVersion, String> changes = new LinkedHashMap<ComparableVersion, String>(); Map<ComparableVersion, String> changes = new LinkedHashMap<ComparableVersion, String>();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -298,7 +302,7 @@ public class ForgeVersion
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log("ForgeVersionCheck", Level.DEBUG, e, "Failed to process update information"); log.debug("Failed to process update information", e);
status = FAILED; status = FAILED;
} }
} }
@@ -123,6 +123,11 @@ public interface ISpecialArmor
*/ */
public static float applyArmor(EntityLivingBase entity, NonNullList<ItemStack> inventory, DamageSource source, double damage) public static float applyArmor(EntityLivingBase entity, NonNullList<ItemStack> inventory, DamageSource source, double damage)
{ {
if (source.isUnblockable())
{
return (float) damage;
}
if (DEBUG) if (DEBUG)
{ {
System.out.println("Start: " + damage); System.out.println("Start: " + damage);
@@ -149,7 +154,7 @@ public interface ISpecialArmor
totalArmor += prop.Armor; totalArmor += prop.Armor;
totalToughness += prop.Toughness; totalToughness += prop.Toughness;
} }
else if (stack.getItem() instanceof ItemArmor && !source.isUnblockable()) else if (stack.getItem() instanceof ItemArmor)
{ {
ItemArmor armor = (ItemArmor)stack.getItem(); ItemArmor armor = (ItemArmor)stack.getItem();
prop = new ArmorProperties(0, 0, Integer.MAX_VALUE); prop = new ArmorProperties(0, 0, Integer.MAX_VALUE);
@@ -83,7 +83,7 @@ public class MinecraftForge
*/ */
public static void initialize() public static void initialize()
{ {
FMLLog.info("MinecraftForge v%s Initialized", ForgeVersion.getVersion()); FMLLog.log.info("MinecraftForge v{} Initialized", ForgeVersion.getVersion());
OreDictionary.getOreName(0); OreDictionary.getOreName(0);
@@ -113,11 +113,11 @@ public class MinecraftForge
if (all.size() == 0) if (all.size() == 0)
return; return;
FMLLog.log(modID, Level.DEBUG, "Preloading CrashReport Classes"); ForgeModContainer.log.debug("Preloading CrashReport Classes");
Collections.sort(all); //Sort it because I like pretty output ;) Collections.sort(all); //Sort it because I like pretty output ;)
for (String name : all) for (String name : all)
{ {
FMLLog.log(modID, Level.DEBUG, "\t" + name); ForgeModContainer.log.debug("\t{}", name);
try try
{ {
Class.forName(name.replace('/', '.'), false, MinecraftForge.class.getClassLoader()); Class.forName(name.replace('/', '.'), false, MinecraftForge.class.getClassLoader());
@@ -95,7 +95,7 @@ public class WorldSpecificSaveHandler implements ISaveHandler
} }
catch (IOException e) catch (IOException e)
{ {
FMLLog.log(Level.ERROR, e, "A critical error occurred copying %s to world specific dat folder - new file will be created.", parentFile.getName()); FMLLog.log.error("A critical error occurred copying {} to world specific dat folder - new file will be created.", parentFile.getName(), e);
} }
} }
} }
@@ -115,7 +115,7 @@ public enum CapabilityManager
Type type = (Type)entry.getAnnotationInfo().get("value"); Type type = (Type)entry.getAnnotationInfo().get("value");
if (type == null) if (type == null)
{ {
FMLLog.log(Level.WARN, "Unable to inject capability at %s.%s (Invalid Annotation)", targetClass, targetName); FMLLog.log.warn("Unable to inject capability at {}.{} (Invalid Annotation)", targetClass, targetName);
continue; continue;
} }
final String capabilityName = type.getInternalName().replace('/', '.').intern(); final String capabilityName = type.getInternalName().replace('/', '.').intern();
@@ -142,7 +142,7 @@ public enum CapabilityManager
{ {
if ((mtd.getModifiers() & Modifier.STATIC) != Modifier.STATIC) if ((mtd.getModifiers() & Modifier.STATIC) != Modifier.STATIC)
{ {
FMLLog.log(Level.WARN, "Unable to inject capability %s at %s.%s (Non-Static)", capabilityName, targetClass, targetName); FMLLog.log.warn("Unable to inject capability {} at {}.{} (Non-Static)", capabilityName, targetClass, targetName);
return null; return null;
} }
@@ -151,11 +151,11 @@ public enum CapabilityManager
return null; return null;
} }
} }
FMLLog.log(Level.WARN, "Unable to inject capability %s at %s.%s (Method Not Found)", capabilityName, targetClass, targetName); FMLLog.log.warn("Unable to inject capability {} at {}.{} (Method Not Found)", capabilityName, targetClass, targetName);
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.WARN, e, "Unable to inject capability %s at %s.%s", capabilityName, targetClass, targetName); FMLLog.log.warn("Unable to inject capability {} at {}.{}", capabilityName, targetClass, targetName, e);
} }
return null; return null;
} }
@@ -173,14 +173,14 @@ public enum CapabilityManager
Field field = Class.forName(targetClass).getDeclaredField(targetName); Field field = Class.forName(targetClass).getDeclaredField(targetName);
if ((field.getModifiers() & Modifier.STATIC) != Modifier.STATIC) if ((field.getModifiers() & Modifier.STATIC) != Modifier.STATIC)
{ {
FMLLog.log(Level.WARN, "Unable to inject capability %s at %s.%s (Non-Static)", capabilityName, targetClass, targetName); FMLLog.log.warn("Unable to inject capability {} at {}.{} (Non-Static)", capabilityName, targetClass, targetName);
return null; return null;
} }
EnumHelper.setFailsafeFieldValue(field, null, input); EnumHelper.setFailsafeFieldValue(field, null, input);
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.WARN, e, "Unable to inject capability %s at %s.%s", capabilityName, targetClass, targetName); FMLLog.log.warn("Unable to inject capability {} at {}.{}", capabilityName, targetClass, targetName, e);
} }
return null; return null;
} }
@@ -120,7 +120,7 @@ public class ChunkIOExecutor
ChunkIOProvider task = tasks.get(key); ChunkIOProvider task = tasks.get(key);
if (task == null) if (task == null)
{ {
FMLLog.warning("Attempted to dequeue chunk that wasn't queued? %d @ (%d, %d)", world.provider.getDimension(), x, z); FMLLog.log.warn("Attempted to dequeue chunk that wasn't queued? {} @ ({}, {})", world.provider.getDimension(), x, z);
return; return;
} }
@@ -104,7 +104,7 @@ public class ConfigManager
public static void loadData(ASMDataTable data) public static void loadData(ASMDataTable data)
{ {
FMLLog.fine("Loading @Config anotation data"); FMLLog.log.debug("Loading @Config anotation data");
for (ASMData target : data.getAll(Config.class.getName())) for (ASMData target : data.getAll(Config.class.getName()))
{ {
String modid = (String)target.getAnnotationInfo().get("modid"); String modid = (String)target.getAnnotationInfo().get("modid");
@@ -150,7 +150,7 @@ public class ConfigManager
*/ */
public static void sync(String modid, Config.Type type) public static void sync(String modid, Config.Type type)
{ {
FMLLog.fine("Attempting to inject @Config classes into %s for type %s", modid, type); FMLLog.log.debug("Attempting to inject @Config classes into {} for type {}", modid, type);
ClassLoader mcl = Loader.instance().getModClassLoader(); ClassLoader mcl = Loader.instance().getModClassLoader();
File configDir = Loader.instance().getConfigDir(); File configDir = Loader.instance().getConfigDir();
Multimap<Config.Type, ASMData> map = asm_data.get(modid); Multimap<Config.Type, ASMData> map = asm_data.get(modid);
@@ -194,7 +194,7 @@ public class ConfigManager
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "An error occurred trying to load a config for %s into %s", modid, targ.getClassName()); FMLLog.log.error("An error occurred trying to load a config for {} into {}", targ.getClassName(), e);
throw new LoaderException(e); throw new LoaderException(e);
} }
} }
@@ -136,7 +136,7 @@ public class Configuration
{ {
File fileBak = new File(file.getAbsolutePath() + "_" + File fileBak = new File(file.getAbsolutePath() + "_" +
new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".errored"); new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".errored");
FMLLog.severe("An exception occurred while loading config file %s. This file will be renamed to %s " + FMLLog.log.fatal("An exception occurred while loading config file {}. This file will be renamed to {} " +
"and a new config file will be generated.", file.getName(), fileBak.getName()); "and a new config file will be generated.", file.getName(), fileBak.getName());
e.printStackTrace(); e.printStackTrace();
@@ -233,12 +233,12 @@ public final class AnimationStateMachine implements IAnimationStateMachine
} }
catch(IOException e) catch(IOException e)
{ {
FMLLog.log(Level.ERROR, e, "Exception loading Animation State Machine %s, skipping", location); FMLLog.log.error("Exception loading Animation State Machine {}, skipping", location, e);
return missing; return missing;
} }
catch(JsonParseException e) catch(JsonParseException e)
{ {
FMLLog.log(Level.ERROR, e, "Exception loading Animation State Machine %s, skipping", location); FMLLog.log.error("Exception loading Animation State Machine {}, skipping", location, e);
return missing; return missing;
} }
finally finally
@@ -97,7 +97,7 @@ public final class Clips
{ {
return new ModelClip(clip.get(), modelLocation, clipName); return new ModelClip(clip.get(), modelLocation, clipName);
} }
FMLLog.getLogger().error("Unable to find clip " + clipName + " in the model " + modelLocation); FMLLog.log.error("Unable to find clip {} in the model {}", clipName, modelLocation);
} }
// FIXME: missing clip? // FIXME: missing clip?
return new ModelClip(IdentityClip.INSTANCE, modelLocation, clipName); return new ModelClip(IdentityClip.INSTANCE, modelLocation, clipName);
@@ -39,7 +39,7 @@ public class DimensionMessageHandler extends SimpleChannelInboundHandler<ForgeMe
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
{ {
FMLLog.log(Level.ERROR, cause, "DimensionMessageHandler exception"); FMLLog.log.error("DimensionMessageHandler exception", cause);
super.exceptionCaught(ctx, cause); super.exceptionCaught(ctx, cause);
} }
@@ -36,7 +36,7 @@ public class FluidIdRegistryMessageHandler extends SimpleChannelInboundHandler<F
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
{ {
FMLLog.log(Level.ERROR, cause, "FluidIdRegistryMessageHandler exception"); FMLLog.log.error("FluidIdRegistryMessageHandler exception", cause);
super.exceptionCaught(ctx, cause); super.exceptionCaught(ctx, cause);
} }
@@ -110,7 +110,7 @@ public abstract class ForgeMessage {
} }
else else
{ {
FMLLog.getLogger().log(Level.INFO, "Legacy server message contains no default fluid list - there may be problems with fluids"); FMLLog.log.info("Legacy server message contains no default fluid list - there may be problems with fluids");
defaultFluids.clear(); defaultFluids.clear();
} }
} }
@@ -35,7 +35,6 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableTable; import com.google.common.collect.ImmutableTable;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -75,51 +74,36 @@ public class ExtendedBlockState extends BlockStateContainer
protected StateImplementation createState(@Nonnull Block block, @Nonnull ImmutableMap<IProperty<?>, Comparable<?>> properties, @Nullable ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties) protected StateImplementation createState(@Nonnull Block block, @Nonnull ImmutableMap<IProperty<?>, Comparable<?>> properties, @Nullable ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties)
{ {
if (unlistedProperties == null || unlistedProperties.isEmpty()) return super.createState(block, properties, unlistedProperties); if (unlistedProperties == null || unlistedProperties.isEmpty()) return super.createState(block, properties, unlistedProperties);
return new ExtendedStateImplementation(block, properties, unlistedProperties, null); return new ExtendedStateImplementation(block, properties, unlistedProperties, null, null);
} }
protected static class ExtendedStateImplementation extends StateImplementation implements IExtendedBlockState protected static class ExtendedStateImplementation extends StateImplementation implements IExtendedBlockState
{ {
private final ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties; private final ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties;
private Map<Map<IProperty<?>, Comparable<?>>, BlockStateContainer.StateImplementation> normalMap; private IBlockState cleanState;
protected ExtendedStateImplementation(Block block, ImmutableMap<IProperty<?>, Comparable<?>> properties, ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties, @Nullable ImmutableTable<IProperty<?>, Comparable<?>, IBlockState> table) protected ExtendedStateImplementation(Block block, ImmutableMap<IProperty<?>, Comparable<?>> properties, ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties, @Nullable ImmutableTable<IProperty<?>, Comparable<?>, IBlockState> table, IBlockState clean)
{ {
super(block, properties); super(block, properties, table);
this.unlistedProperties = unlistedProperties; this.unlistedProperties = unlistedProperties;
this.propertyValueTable = table; this.cleanState = clean == null ? this : clean;
} }
@Override @Override
@Nonnull @Nonnull
public <T extends Comparable<T>, V extends T> IBlockState withProperty(@Nonnull IProperty<T> property, @Nonnull V value) public <T extends Comparable<T>, V extends T> IBlockState withProperty(@Nonnull IProperty<T> property, @Nonnull V value)
{ {
if (!this.getProperties().containsKey(property)) IBlockState clean = super.withProperty(property, value);
{ if (clean == this.cleanState) {
throw new IllegalArgumentException("Cannot set property " + property + " as it does not exist in " + getBlock().getBlockState()); return this;
} }
else
{ if (Iterables.all(unlistedProperties.values(), Predicates.<Optional<?>>equalTo(Optional.absent())))
if (!property.getAllowedValues().contains(value)) { // no dynamic properties present, looking up in the normal table
{ return clean;
throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on block " + Block.REGISTRY.getNameForObject(getBlock()) + ", it is not an allowed value");
} else
{
if (this.getProperties().get(property) == value)
{
return this;
}
Map<IProperty<?>, Comparable<?>> map = Maps.newHashMap(getProperties());
map.put(property, value);
if (Iterables.all(unlistedProperties.values(), Predicates.<Optional<?>>equalTo(Optional.absent())))
{ // no dynamic properties present, looking up in the normal table
return normalMap.get(map);
}
ImmutableTable<IProperty<?>, Comparable<?>, IBlockState> table = propertyValueTable;
table = ((StateImplementation) table.get(property, value)).getPropertyValueTable();
return new ExtendedStateImplementation(getBlock(), ImmutableMap.copyOf(map), unlistedProperties, table).setMap(this.normalMap);
}
} }
return new ExtendedStateImplementation(getBlock(), clean.getProperties(), unlistedProperties, ((StateImplementation)clean).getPropertyValueTable(), this.cleanState);
} }
public <V> IExtendedBlockState withProperty(IUnlistedProperty<V> property, V value) public <V> IExtendedBlockState withProperty(IUnlistedProperty<V> property, V value)
@@ -136,9 +120,9 @@ public class ExtendedBlockState extends BlockStateContainer
newMap.put(property, Optional.fromNullable(value)); newMap.put(property, Optional.fromNullable(value));
if(Iterables.all(newMap.values(), Predicates.<Optional<?>>equalTo(Optional.absent()))) if(Iterables.all(newMap.values(), Predicates.<Optional<?>>equalTo(Optional.absent())))
{ // no dynamic properties, lookup normal state { // no dynamic properties, lookup normal state
return (IExtendedBlockState) normalMap.get(getProperties()); return (IExtendedBlockState)cleanState;
} }
return new ExtendedStateImplementation(getBlock(), getProperties(), ImmutableMap.copyOf(newMap), propertyValueTable).setMap(this.normalMap); return new ExtendedStateImplementation(getBlock(), getProperties(), ImmutableMap.copyOf(newMap), propertyValueTable, this.cleanState);
} }
public Collection<IUnlistedProperty<?>> getUnlistedNames() public Collection<IUnlistedProperty<?>> getUnlistedNames()
@@ -161,21 +145,9 @@ public class ExtendedBlockState extends BlockStateContainer
} }
@Override @Override
public void buildPropertyValueTable(Map<Map<IProperty<?>, Comparable<?>>, BlockStateContainer.StateImplementation> map)
{
this.normalMap = map;
super.buildPropertyValueTable(map);
}
private ExtendedStateImplementation setMap(Map<Map<IProperty<?>, Comparable<?>>, BlockStateContainer.StateImplementation> map)
{
this.normalMap = map;
return this;
}
public IBlockState getClean() public IBlockState getClean()
{ {
return this.normalMap.get(getProperties()); return cleanState;
} }
} }
} }
@@ -310,7 +310,7 @@ public class EnumHelper
} }
for (String line : lines) for (String line : lines)
FMLLog.severe(line); FMLLog.log.fatal(line);
if (test) if (test)
{ {
@@ -148,8 +148,8 @@ public class Fluid
} }
else else
{ {
FMLLog.warning("A mod has attempted to assign Block " + block + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to the Block " FMLLog.log.warn("A mod has attempted to assign Block {} to the Fluid '{}' but this Fluid has already been linked to the Block {}. "
+ this.block + ". You may have duplicate Fluid Blocks as a result. It *may* be possible to configure your mods to avoid this."); + "You may have duplicate Fluid Blocks as a result. It *may* be possible to configure your mods to avoid this.", block, fluidName, this.block);
} }
return this; return this;
} }
@@ -123,13 +123,13 @@ public abstract class FluidRegistry
String derivedName = defaultName.split(":",2)[1]; String derivedName = defaultName.split(":",2)[1];
String localDefault = defaultFluidName.get(derivedName); String localDefault = defaultFluidName.get(derivedName);
if (localDefault == null) { if (localDefault == null) {
FMLLog.getLogger().log(Level.ERROR, "The fluid {} (specified as {}) is missing from this instance - it will be removed", derivedName, defaultName); FMLLog.log.error("The fluid {} (specified as {}) is missing from this instance - it will be removed", derivedName, defaultName);
continue; continue;
} }
fluid = masterFluidReference.get(localDefault); fluid = masterFluidReference.get(localDefault);
FMLLog.getLogger().log(Level.ERROR, "The fluid {} specified as default is not present - it will be reverted to default {}", defaultName, localDefault); FMLLog.log.error("The fluid {} specified as default is not present - it will be reverted to default {}", defaultName, localDefault);
} }
FMLLog.getLogger().log(Level.DEBUG, "The fluid {} has been selected as the default fluid for {}", defaultName, fluid.getName()); FMLLog.log.debug("The fluid {} has been selected as the default fluid for {}", defaultName, fluid.getName());
Fluid oldFluid = localFluids.put(fluid.getName(), fluid); Fluid oldFluid = localFluids.put(fluid.getName(), fluid);
Integer id = localFluidIDs.remove(oldFluid); Integer id = localFluidIDs.remove(oldFluid);
localFluidIDs.put(fluid, id); localFluidIDs.put(fluid, id);
@@ -260,7 +260,7 @@ public abstract class FluidRegistry
{ {
ModContainer modContainer = Loader.instance().activeModContainer(); ModContainer modContainer = Loader.instance().activeModContainer();
String modContainerName = modContainer == null ? null : modContainer.getName(); String modContainerName = modContainer == null ? null : modContainer.getName();
FMLLog.getLogger().log(Level.ERROR, "Trying to activate the universal filled bucket too late. Call it statically in your Mods class. Mod: {}", modContainerName); FMLLog.log.error("Trying to activate the universal filled bucket too late. Call it statically in your Mods class. Mod: {}", modContainerName);
} }
else else
{ {
@@ -350,7 +350,7 @@ public abstract class FluidRegistry
{ {
String name = masterFluidReference.inverse().get(key); String name = masterFluidReference.inverse().get(key);
if (Strings.isNullOrEmpty(name)) { if (Strings.isNullOrEmpty(name)) {
FMLLog.getLogger().log(Level.ERROR, "The fluid registry is corrupted. A fluid {} {} is not properly registered. The mod that registered this is broken", key.getClass().getName(), key.getName()); FMLLog.log.error("The fluid registry is corrupted. A fluid {} {} is not properly registered. The mod that registered this is broken", key.getClass().getName(), key.getName());
throw new IllegalStateException("The fluid registry is corrupted"); throw new IllegalStateException("The fluid registry is corrupted");
} }
return name; return name;
@@ -361,7 +361,7 @@ public abstract class FluidRegistry
Set<String> defaults = Sets.newHashSet(); Set<String> defaults = Sets.newHashSet();
if (tag.hasKey("DefaultFluidList",9)) if (tag.hasKey("DefaultFluidList",9))
{ {
FMLLog.getLogger().log(Level.DEBUG, "Loading persistent fluid defaults from world"); FMLLog.log.debug("Loading persistent fluid defaults from world");
NBTTagList tl = tag.getTagList("DefaultFluidList", 8); NBTTagList tl = tag.getTagList("DefaultFluidList", 8);
for (int i = 0; i < tl.tagCount(); i++) for (int i = 0; i < tl.tagCount(); i++)
{ {
@@ -370,7 +370,7 @@ public abstract class FluidRegistry
} }
else else
{ {
FMLLog.getLogger().log(Level.DEBUG, "World is missing persistent fluid defaults - using local defaults"); FMLLog.log.debug("World is missing persistent fluid defaults - using local defaults");
} }
loadFluidDefaults(HashBiMap.create(fluidIDs), defaults); loadFluidDefaults(HashBiMap.create(fluidIDs), defaults);
} }
@@ -400,13 +400,13 @@ public abstract class FluidRegistry
if (!illegalFluids.isEmpty()) if (!illegalFluids.isEmpty())
{ {
FMLLog.getLogger().log(Level.FATAL, "The fluid registry is corrupted. Something has inserted a fluid without registering it"); FMLLog.log.fatal("The fluid registry is corrupted. Something has inserted a fluid without registering it");
FMLLog.getLogger().log(Level.FATAL, "There is {} unregistered fluids", illegalFluids.size()); FMLLog.log.fatal("There is {} unregistered fluids", illegalFluids.size());
for (Fluid f: illegalFluids) for (Fluid f: illegalFluids)
{ {
FMLLog.getLogger().log(Level.FATAL, " Fluid name : {}, type: {}", f.getName(), f.getClass().getName()); FMLLog.log.fatal(" Fluid name : {}, type: {}", f.getName(), f.getClass().getName());
} }
FMLLog.getLogger().log(Level.FATAL, "The mods that own these fluids need to register them properly"); FMLLog.log.fatal("The mods that own these fluids need to register them properly");
throw new IllegalStateException("The fluid map contains fluids unknown to the master fluid registry"); throw new IllegalStateException("The fluid map contains fluids unknown to the master fluid registry");
} }
} }
@@ -51,7 +51,7 @@ public class FluidStack
} }
else if (!FluidRegistry.isFluidRegistered(fluid)) else if (!FluidRegistry.isFluidRegistered(fluid))
{ {
FMLLog.bigWarning("Failed attempt to create a FluidStack for an unregistered Fluid %s (type %s)", fluid.getName(), fluid.getClass().getName()); FMLLog.bigWarning("Failed attempt to create a FluidStack for an unregistered Fluid {} (type {})", fluid.getName(), fluid.getClass().getName());
throw new IllegalArgumentException("Cannot create a fluidstack from an unregistered fluid"); throw new IllegalArgumentException("Cannot create a fluidstack from an unregistered fluid");
} }
this.fluidDelegate = FluidRegistry.makeDelegate(fluid); this.fluidDelegate = FluidRegistry.makeDelegate(fluid);
@@ -222,7 +222,7 @@ public class FMLClientHandler implements IFMLSidedHandler
this.resourcePackMap = Maps.newHashMap(); this.resourcePackMap = Maps.newHashMap();
if (minecraft.isDemo()) if (minecraft.isDemo())
{ {
FMLLog.severe("DEMO MODE DETECTED, FML will not work. Finishing now."); FMLLog.log.fatal("DEMO MODE DETECTED, FML will not work. Finishing now.");
haltGame("FML will not run in demo mode", new RuntimeException()); haltGame("FML will not run in demo mode", new RuntimeException());
return; return;
} }
@@ -254,7 +254,7 @@ public class FMLClientHandler implements IFMLSidedHandler
} }
catch (CustomModLoadingErrorDisplayException custom) catch (CustomModLoadingErrorDisplayException custom)
{ {
FMLLog.log(Level.ERROR, custom, "A custom exception was thrown by a mod, the game will now halt"); FMLLog.log.error("A custom exception was thrown by a mod, the game will now halt", custom);
customError = custom; customError = custom;
} }
catch (MultipleModsErrored multiple) catch (MultipleModsErrored multiple)
@@ -277,7 +277,7 @@ public class FMLClientHandler implements IFMLSidedHandler
} }
catch (CustomModLoadingErrorDisplayException custom) catch (CustomModLoadingErrorDisplayException custom)
{ {
FMLLog.log(Level.ERROR, custom, "A custom exception was thrown by a mod, the game will now halt"); FMLLog.log.error("A custom exception was thrown by a mod, the game will now halt", custom);
customError = custom; customError = custom;
} }
catch (LoaderException le) catch (LoaderException le)
@@ -314,7 +314,7 @@ public class FMLClientHandler implements IFMLSidedHandler
{ {
ModMetadata optifineMetadata = MetadataCollection.from(optifineModInfoInputStream, "optifine").getMetadataForId("optifine", dummyOptifineMeta); ModMetadata optifineMetadata = MetadataCollection.from(optifineModInfoInputStream, "optifine").getMetadataForId("optifine", dummyOptifineMeta);
optifineContainer = new DummyModContainer(optifineMetadata); optifineContainer = new DummyModContainer(optifineMetadata);
FMLLog.info("Forge Mod Loader has detected optifine %s, enabling compatibility features", optifineContainer.getVersion()); FMLLog.log.info("Forge Mod Loader has detected optifine {}, enabling compatibility features", optifineContainer.getVersion());
} }
finally finally
{ {
@@ -358,7 +358,7 @@ public class FMLClientHandler implements IFMLSidedHandler
} }
catch (CustomModLoadingErrorDisplayException custom) catch (CustomModLoadingErrorDisplayException custom)
{ {
FMLLog.log(Level.ERROR, custom, "A custom exception was thrown by a mod, the game will now halt"); FMLLog.log.error("A custom exception was thrown by a mod, the game will now halt", custom);
customError = custom; customError = custom;
SplashProgress.finish(); SplashProgress.finish();
return; return;
@@ -393,7 +393,7 @@ public class FMLClientHandler implements IFMLSidedHandler
guiFactories.put(mc, guiFactory); guiFactories.put(mc, guiFactory);
} catch (Exception e) } catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "A critical error occurred instantiating the gui factory for mod %s", mc.getModId()); FMLLog.log.error("A critical error occurred instantiating the gui factory for mod {}", mc.getModId(), e);
} }
} }
loading = false; loading = false;
@@ -683,12 +683,12 @@ public class FMLClientHandler implements IFMLSidedHandler
} }
catch (NoSuchMethodException e) catch (NoSuchMethodException e)
{ {
FMLLog.log(Level.ERROR, "The container %s (type %s) returned an invalid class for it's resource pack.", container.getName(), container.getClass().getName()); FMLLog.log.error("The container {} (type {}) returned an invalid class for it's resource pack.", container.getName(), container.getClass().getName());
return; return;
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "An unexpected exception occurred constructing the custom resource pack for %s", container.getName()); FMLLog.log.error("An unexpected exception occurred constructing the custom resource pack for {}", container.getName(), e);
throw Throwables.propagate(e); throw Throwables.propagate(e);
} }
} }
@@ -762,7 +762,7 @@ public class FMLClientHandler implements IFMLSidedHandler
} }
catch (Exception e1) catch (Exception e1)
{ {
FMLLog.warning("There appears to be a problem loading the save %s, both level files are unreadable.", comparator.getFileName()); FMLLog.log.warn("There appears to be a problem loading the save {}, both level files are unreadable.", comparator.getFileName());
return; return;
} }
} }
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@@ -61,7 +62,7 @@ public class FMLFileResourcePack extends FileResourcePack implements FMLContaine
{ {
if ("pack.mcmeta".equals(resourceName)) if ("pack.mcmeta".equals(resourceName))
{ {
FMLLog.log(container.getName(), Level.DEBUG, "Mod %s is missing a pack.mcmeta file, substituting a dummy one", container.getName()); LogManager.getLogger(container.getName()).debug("Mod {} is missing a pack.mcmeta file, substituting a dummy one", container.getName());
return new ByteArrayInputStream(("{\n" + return new ByteArrayInputStream(("{\n" +
" \"pack\": {\n"+ " \"pack\": {\n"+
" \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+ " \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@@ -66,7 +67,7 @@ public class FMLFolderResourcePack extends FolderResourcePack implements FMLCont
{ {
if ("pack.mcmeta".equals(resourceName)) if ("pack.mcmeta".equals(resourceName))
{ {
FMLLog.log(container.getName(), Level.DEBUG, "Mod %s is missing a pack.mcmeta file, substituting a dummy one", container.getName()); LogManager.getLogger(container.getName()).debug("Mod {} is missing a pack.mcmeta file, substituting a dummy one", container.getName());
return new ByteArrayInputStream(("{\n" + return new ByteArrayInputStream(("{\n" +
" \"pack\": {\n"+ " \"pack\": {\n"+
" \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+ " \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+
@@ -65,7 +65,7 @@ public class GuiErrorBase extends GuiErrorScreen
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "Problem opening mods folder"); FMLLog.log.error("Problem opening mods folder", e);
} }
} }
else if (button.id == 11) else if (button.id == 11)
@@ -76,7 +76,7 @@ public class GuiErrorBase extends GuiErrorScreen
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "Problem opening log file " + clientLog); FMLLog.log.error("Problem opening log file {}", clientLog, e);
} }
} }
} }
@@ -71,7 +71,7 @@ public class GuiJava8Error extends GuiErrorBase
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "Problem launching browser"); FMLLog.log.error("Problem launching browser", e);
} }
} }
else else
@@ -295,7 +295,7 @@ public class GuiModList extends GuiScreen
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "There was a critical issue trying to build the config GUI for %s", selectedMod.getModId()); FMLLog.log.error("There was a critical issue trying to build the config GUI for {}", selectedMod.getModId(), e);
} }
return; return;
} }
@@ -78,7 +78,7 @@ public class GuiOldSaveLoadConfirm extends GuiYesNo implements GuiYesNoCallback
} }
else else
{ {
FMLLog.info("Capturing current state of world %s into file %s", saveName, zip.getAbsolutePath()); FMLLog.log.info("Capturing current state of world {} into file {}", saveName, zip.getAbsolutePath());
try try
{ {
String skip = System.getProperty("fml.doNotBackup"); String skip = System.getProperty("fml.doNotBackup");
@@ -89,11 +89,11 @@ public class GuiOldSaveLoadConfirm extends GuiYesNo implements GuiYesNoCallback
else else
{ {
for (int x = 0; x < 10; x++) for (int x = 0; x < 10; x++)
FMLLog.severe("!!!!!!!!!! UPDATING WORLD WITHOUT DOING BACKUP !!!!!!!!!!!!!!!!"); FMLLog.log.fatal("!!!!!!!!!! UPDATING WORLD WITHOUT DOING BACKUP !!!!!!!!!!!!!!!!");
} }
} catch (IOException e) } catch (IOException e)
{ {
FMLLog.log(Level.WARN, e, "There was a problem saving the backup %s. Please fix and try again", zip.getName()); FMLLog.log.warn("There was a problem saving the backup {}. Please fix and try again", zip.getName(), e);
FMLClientHandler.instance().showGuiScreen(new GuiBackupFailed(parent, zip)); FMLClientHandler.instance().showGuiScreen(new GuiBackupFailed(parent, zip));
return; return;
} }
@@ -160,7 +160,7 @@ public class SplashProgress
} }
catch(IOException e) catch(IOException e)
{ {
FMLLog.info("Could not load splash.properties, will create a default one"); FMLLog.log.info("Could not load splash.properties, will create a default one");
} }
finally finally
{ {
@@ -202,7 +202,7 @@ public class SplashProgress
} }
catch(IOException e) catch(IOException e)
{ {
FMLLog.log(Level.ERROR, e, "Could not save the splash.properties file"); FMLLog.log.error("Could not save the splash.properties file", e);
} }
finally finally
{ {
@@ -231,7 +231,7 @@ public class SplashProgress
CrashReport report = CrashReport.makeCrashReport(new Throwable(), "Loading screen debug info"); CrashReport report = CrashReport.makeCrashReport(new Throwable(), "Loading screen debug info");
StringBuilder systemDetailsBuilder = new StringBuilder(); StringBuilder systemDetailsBuilder = new StringBuilder();
report.getCategory().appendToStringBuilder(systemDetailsBuilder); report.getCategory().appendToStringBuilder(systemDetailsBuilder);
FMLLog.info(systemDetailsBuilder.toString()); FMLLog.log.info(systemDetailsBuilder.toString());
try try
{ {
@@ -398,13 +398,13 @@ public class SplashProgress
if (!isDisplayVSyncForced) if (!isDisplayVSyncForced)
{ {
isDisplayVSyncForced = true; isDisplayVSyncForced = true;
FMLLog.log(Level.INFO, "Using alternative sync timing : %d frames of Display.update took %d nanos", TIMING_FRAME_COUNT, updateTiming); FMLLog.log.info("Using alternative sync timing : {} frames of Display.update took {} nanos", TIMING_FRAME_COUNT, updateTiming);
} }
try { Thread.sleep(16); } catch (InterruptedException ie) {} try { Thread.sleep(16); } catch (InterruptedException ie) {}
} else } else
{ {
if (framecount ==TIMING_FRAME_COUNT) { if (framecount ==TIMING_FRAME_COUNT) {
FMLLog.log(Level.INFO, "Using sync timing. %d frames of Display.update took %d nanos", TIMING_FRAME_COUNT, updateTiming); FMLLog.log.info("Using sync timing. {} frames of Display.update took {} nanos", TIMING_FRAME_COUNT, updateTiming);
} }
Display.sync(100); Display.sync(100);
} }
@@ -577,7 +577,7 @@ public class SplashProgress
{ {
public void uncaughtException(Thread t, Throwable e) public void uncaughtException(Thread t, Throwable e)
{ {
FMLLog.log(Level.ERROR, e, "Splash thread Exception"); FMLLog.log.error("Splash thread Exception", e);
threadError = e; threadError = e;
} }
}); });
@@ -726,7 +726,7 @@ public class SplashProgress
} }
catch(IOException e) catch(IOException e)
{ {
FMLLog.log(Level.ERROR, e, "Could not save the splash.properties file"); FMLLog.log.error("Could not save the splash.properties file", e);
return false; return false;
} }
finally finally
@@ -128,7 +128,7 @@ public class GuiConfigEntries extends GuiListExtended
} }
catch (Throwable e) catch (Throwable e)
{ {
FMLLog.severe("There was a critical error instantiating the custom IConfigEntry for config element %s.", configElement.getName()); FMLLog.log.fatal("There was a critical error instantiating the custom IConfigEntry for config element {}.", configElement.getName());
e.printStackTrace(); e.printStackTrace();
} }
else if (configElement.isProperty()) else if (configElement.isProperty())
@@ -81,7 +81,7 @@ public class GuiEditArrayEntries extends GuiListExtended
} }
catch (Throwable e) catch (Throwable e)
{ {
FMLLog.log(Level.ERROR, e, "There was a critical error instantiating the custom IGuiEditListEntry for property %s.", configElement.getName()); FMLLog.log.error("There was a critical error instantiating the custom IGuiEditListEntry for property {}.", configElement.getName(), e);
} }
} }
} }
@@ -156,7 +156,7 @@ public class GuiEditArrayEntries extends GuiListExtended
} }
catch (Throwable e) catch (Throwable e)
{ {
FMLLog.log(Level.ERROR, e, "There was a critical error instantiating the custom IGuiEditListEntry for property %s.", configElement.getName()); FMLLog.log.error("There was a critical error instantiating the custom IGuiEditListEntry for property {}.", configElement.getName(), e);
} }
} }
else if (configElement.isList() && configElement.getType() == ConfigGuiType.BOOLEAN) else if (configElement.isList() && configElement.getType() == ConfigGuiType.BOOLEAN)
@@ -45,7 +45,7 @@ public class AutomaticEventSubscriber
private static final EnumSet<Side> DEFAULT = EnumSet.allOf(Side.class); private static final EnumSet<Side> DEFAULT = EnumSet.allOf(Side.class);
public static void inject(ModContainer mod, ASMDataTable data, Side side) public static void inject(ModContainer mod, ASMDataTable data, Side side)
{ {
FMLLog.fine("Attempting to inject @EventBusSubscriber classes into the eventbus for %s", mod.getModId()); FMLLog.log.debug("Attempting to inject @EventBusSubscriber classes into the eventbus for {}", mod.getModId());
SetMultimap<String, ASMData> modData = data.getAnnotationsFor(mod); SetMultimap<String, ASMData> modData = data.getAnnotationsFor(mod);
Set<ASMDataTable.ASMData> mods = modData.get(Mod.class.getName()); Set<ASMDataTable.ASMData> mods = modData.get(Mod.class.getName());
Set<ASMDataTable.ASMData> targets = modData.get(Mod.EventBusSubscriber.class.getName()); Set<ASMDataTable.ASMData> targets = modData.get(Mod.EventBusSubscriber.class.getName());
@@ -65,28 +65,28 @@ public class AutomaticEventSubscriber
} }
} }
if (sides == DEFAULT || sides.contains(side)) { if (sides == DEFAULT || sides.contains(side)) {
FMLLog.fine("Found @EventBusSubscriber class %s", targ.getClassName()); FMLLog.log.debug("Found @EventBusSubscriber class {}", targ.getClassName());
String amodid = (String)targ.getAnnotationInfo().get("modid"); String amodid = (String)targ.getAnnotationInfo().get("modid");
if (Strings.isNullOrEmpty(amodid)) { if (Strings.isNullOrEmpty(amodid)) {
amodid = ASMDataTable.getOwnerModID(mods, targ); amodid = ASMDataTable.getOwnerModID(mods, targ);
if (Strings.isNullOrEmpty(amodid)) { if (Strings.isNullOrEmpty(amodid)) {
FMLLog.bigWarning("Could not determine owning mod for @EventBusSubscriber on %s for mod %s", targ.getClassName(), mod.getModId()); FMLLog.bigWarning("Could not determine owning mod for @EventBusSubscriber on {} for mod {}", targ.getClassName(), mod.getModId());
continue; continue;
} }
} }
if (!mod.getModId().equals(amodid)) if (!mod.getModId().equals(amodid))
{ {
FMLLog.fine("Skipping @EventBusSubscriber injection for %s since it is not for mod %s", targ.getClassName(), mod.getModId()); FMLLog.log.debug("Skipping @EventBusSubscriber injection for {} since it is not for mod {}", targ.getClassName(), mod.getModId());
continue; //We're not injecting this guy continue; //We're not injecting this guy
} }
Class<?> subscriptionTarget = Class.forName(targ.getClassName(), true, mcl); Class<?> subscriptionTarget = Class.forName(targ.getClassName(), true, mcl);
MinecraftForge.EVENT_BUS.register(subscriptionTarget); MinecraftForge.EVENT_BUS.register(subscriptionTarget);
FMLLog.fine("Injected @EventBusSubscriber class %s", targ.getClassName()); FMLLog.log.debug("Injected @EventBusSubscriber class {}", targ.getClassName());
} }
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "An error occurred trying to load an EventBusSubscriber %s for modid %s", targ.getClassName(), mod.getModId()); FMLLog.log.error("An error occurred trying to load an EventBusSubscriber {} for modid {}", mod.getModId(), e);
throw new LoaderException(e); throw new LoaderException(e);
} }
} }
@@ -58,6 +58,7 @@ import net.minecraftforge.client.model.animation.Animation;
import net.minecraftforge.common.ForgeVersion; import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.CompoundDataFixer; import net.minecraftforge.common.util.CompoundDataFixer;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.EventBus; import net.minecraftforge.fml.common.eventhandler.EventBus;
import net.minecraftforge.fml.common.gameevent.InputEvent; import net.minecraftforge.fml.common.gameevent.InputEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent;
@@ -185,10 +186,13 @@ public class FMLCommonHandler
/** /**
* Get the forge mod loader logging instance (goes to the forgemodloader log file) * Get the forge mod loader logging instance (goes to the forgemodloader log file)
* @return The log instance for the FML log file * @return The log instance for the FML log file
*
* @deprecated Not used in FML, Mods use your own logger, see {@link FMLPreInitializationEvent#getModLog()}
*/ */
@Deprecated
public Logger getFMLLogger() public Logger getFMLLogger()
{ {
return FMLLog.getLogger(); return FMLLog.log;
} }
public Side getSide() public Side getSide()
@@ -211,7 +215,7 @@ public class FMLCommonHandler
*/ */
public void raiseException(Throwable exception, String message, boolean stopGame) public void raiseException(Throwable exception, String message, boolean stopGame)
{ {
FMLLog.log(Level.ERROR, exception, "Something raised an exception. The message was '%s'. 'stopGame' is %b", message, stopGame); FMLLog.log.error("Something raised an exception. The message was '{}'. 'stopGame' is {}", stopGame, exception);
if (stopGame) if (stopGame)
{ {
getSidedDelegate().haltGame(message,exception); getSidedDelegate().haltGame(message,exception);
@@ -477,19 +481,19 @@ public class FMLCommonHandler
{ {
try try
{ {
FMLLog.info("Waiting for the server to terminate/save."); FMLLog.log.info("Waiting for the server to terminate/save.");
if (!latch.await(10, TimeUnit.SECONDS)) if (!latch.await(10, TimeUnit.SECONDS))
{ {
FMLLog.warning("The server didn't stop within 10 seconds, exiting anyway."); FMLLog.log.warn("The server didn't stop within 10 seconds, exiting anyway.");
} }
else else
{ {
FMLLog.info("Server terminated."); FMLLog.log.info("Server terminated.");
} }
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {
FMLLog.warning("Interrupted wait, exiting."); FMLLog.log.warn("Interrupted wait, exiting.");
} }
} }
@@ -623,7 +627,7 @@ public class FMLCommonHandler
if (!shouldAllowPlayerLogins()) if (!shouldAllowPlayerLogins())
{ {
TextComponentString text = new TextComponentString("Server is still starting! Please wait before reconnecting."); TextComponentString text = new TextComponentString("Server is still starting! Please wait before reconnecting.");
FMLLog.info("Disconnecting Player: " + text.getUnformattedText()); FMLLog.log.info("Disconnecting Player: {}", text.getUnformattedText());
manager.sendPacket(new SPacketDisconnect(text)); manager.sendPacket(new SPacketDisconnect(text));
manager.closeChannel(text); manager.closeChannel(text);
return false; return false;
@@ -633,7 +637,7 @@ public class FMLCommonHandler
{ {
manager.setConnectionState(EnumConnectionState.LOGIN); manager.setConnectionState(EnumConnectionState.LOGIN);
TextComponentString text = new TextComponentString("This server requires FML/Forge to be installed. Contact your server admin for more details."); TextComponentString text = new TextComponentString("This server requires FML/Forge to be installed. Contact your server admin for more details.");
FMLLog.info("Disconnecting Player: " + text.getUnformattedText()); FMLLog.log.info("Disconnecting Player: {}", text.getUnformattedText());
manager.sendPacket(new SPacketDisconnect(text)); manager.sendPacket(new SPacketDisconnect(text));
manager.closeChannel(text); manager.closeChannel(text);
return false; return false;
@@ -658,18 +662,18 @@ public class FMLCommonHandler
*/ */
public void exitJava(int exitCode, boolean hardExit) public void exitJava(int exitCode, boolean hardExit)
{ {
FMLLog.log(Level.INFO, "Java has been asked to exit (code %d) by %s.", exitCode, Thread.currentThread().getStackTrace()[1]); FMLLog.log.info("Java has been asked to exit (code {}) by {}.", exitCode, Thread.currentThread().getStackTrace()[1]);
if (hardExit) if (hardExit)
{ {
FMLLog.log(Level.INFO, "This is an abortive exit and could cause world corruption or other things"); FMLLog.log.info("This is an abortive exit and could cause world corruption or other things");
} }
if (Boolean.parseBoolean(System.getProperty("fml.debugExit", "false"))) if (Boolean.parseBoolean(System.getProperty("fml.debugExit", "false")))
{ {
FMLLog.log(Level.INFO, new Throwable(), "Exit trace"); FMLLog.log.info("Exit trace", new Throwable());
} }
else else
{ {
FMLLog.log(Level.INFO, "If this was an unexpected exit, use -Dfml.debugExit=true as a JVM argument to find out where it was called"); FMLLog.log.info("If this was an unexpected exit, use -Dfml.debugExit=true as a JVM argument to find out where it was called");
} }
if (hardExit) if (hardExit)
{ {
@@ -695,11 +699,11 @@ public class FMLCommonHandler
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {
FMLLog.log(Level.FATAL, e, "Exception caught executing FutureTask: " + e.toString()); FMLLog.log.fatal("Exception caught executing FutureTask: {}", e.toString(), e);
} }
catch (ExecutionException e) catch (ExecutionException e)
{ {
FMLLog.log(Level.FATAL, e, "Exception caught executing FutureTask: " + e.toString()); FMLLog.log.fatal("Exception caught executing FutureTask: {}", e.toString(), e);
} }
} }
@@ -48,6 +48,7 @@ import net.minecraftforge.fml.common.registry.VillagerRegistry;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
@@ -120,7 +121,7 @@ public final class FMLContainer extends DummyModContainer implements WorldAccess
NBTTagCompound registries = new NBTTagCompound(); NBTTagCompound registries = new NBTTagCompound();
fmlData.setTag("Registries", registries); fmlData.setTag("Registries", registries);
FMLLog.fine("Gathering id map for writing to world save %s", info.getWorldName()); FMLLog.log.debug("Gathering id map for writing to world save {}", info.getWorldName());
PersistentRegistryManager.GameDataSnapshot dataSnapshot = PersistentRegistryManager.takeSnapshot(); PersistentRegistryManager.GameDataSnapshot dataSnapshot = PersistentRegistryManager.takeSnapshot();
for (Map.Entry<ResourceLocation, PersistentRegistryManager.GameDataSnapshot.Entry> e : dataSnapshot.entries.entrySet()) for (Map.Entry<ResourceLocation, PersistentRegistryManager.GameDataSnapshot.Entry> e : dataSnapshot.entries.entrySet())
@@ -190,12 +191,12 @@ public final class FMLContainer extends DummyModContainer implements WorldAccess
ModContainer container = Loader.instance().getIndexedModList().get(modId); ModContainer container = Loader.instance().getIndexedModList().get(modId);
if (container == null) if (container == null)
{ {
FMLLog.log("fml.ModTracker", Level.ERROR, "This world was saved with mod %s which appears to be missing, things may not work well", modId); LogManager.getLogger("fml.ModTracker").error("This world was saved with mod {} which appears to be missing, things may not work well", modId);
continue; continue;
} }
if (!modVersion.equals(container.getVersion())) if (!modVersion.equals(container.getVersion()))
{ {
FMLLog.log("fml.ModTracker", Level.INFO, "This world was saved with mod %s version %s and it is now at version %s, things may not work well", modId, modVersion, container.getVersion()); LogManager.getLogger("fml.ModTracker").info("This world was saved with mod {} version {} and it is now at version {}, things may not work well", modId, modVersion, container.getVersion());
} }
} }
} }
@@ -19,73 +19,107 @@
package net.minecraftforge.fml.common; package net.minecraftforge.fml.common;
import org.apache.logging.log4j.Level; import java.util.Locale;
import org.apache.logging.log4j.Logger;
@SuppressWarnings("static-access") import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.relauncher.FMLLaunchHandler;
import net.minecraftforge.fml.relauncher.FMLRelaunchLog;
import net.minecraftforge.fml.relauncher.Side;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.ThreadContext;
/**
* FMLs logging class. <b>Internal use only, NOT FOR MOD LOGGING!</b> Mods use your own log, see {@link FMLPreInitializationEvent#getModLog()}.
*/
public class FMLLog public class FMLLog
{ {
private static net.minecraftforge.fml.relauncher.FMLRelaunchLog coreLog = net.minecraftforge.fml.relauncher.FMLRelaunchLog.log;
public static void log(String targetLog, Level level, String format, Object... data) public static final Logger log;
{
coreLog.log(targetLog, level, format, data);
}
public static void log(Level level, String format, Object... data) static {
{ log = LogManager.getLogger("FML");
coreLog.log(level, format, data); // Default side to client for test harness purposes
} Side side = FMLLaunchHandler.side();
if (side == null) side = Side.CLIENT;
ThreadContext.put("side", side.name().toLowerCase(Locale.ENGLISH));
public static void log(String targetLog, Level level, Throwable ex, String format, Object... data) log.debug("Injecting tracing printstreams for STDOUT/STDERR.");
{ System.setOut(new TracingPrintStream(LogManager.getLogger("STDOUT"), System.out));
coreLog.log(targetLog, level, ex, format, data); System.setErr(new TracingPrintStream(LogManager.getLogger("STDERR"), System.err));
}
public static void log(Level level, Throwable ex, String format, Object... data)
{
coreLog.log(level, ex, format, data);
}
public static void severe(String format, Object... data)
{
log(Level.ERROR, format, data);
} }
public static void bigWarning(String format, Object... data) public static void bigWarning(String format, Object... data)
{ {
StackTraceElement[] trace = Thread.currentThread().getStackTrace(); StackTraceElement[] trace = Thread.currentThread().getStackTrace();
log(Level.WARN, "****************************************"); log.warn("****************************************");
log(Level.WARN, "* "+format, data); log.warn("* "+format, data);
for (int i = 2; i < 8 && i < trace.length; i++) for (int i = 2; i < 8 && i < trace.length; i++)
{ {
log(Level.WARN, "* at %s%s", trace[i].toString(), i == 7 ? "..." : ""); log.warn("* at {}{}", trace[i].toString(), i == 7 ? "..." : "");
} }
log(Level.WARN, "****************************************"); log.warn("****************************************");
} }
@Deprecated
public static void log(String targetLog, Level level, String format, Object... data)
{
FMLRelaunchLog.log(targetLog, level, format, data);
}
@Deprecated
public static void log(Level level, String format, Object... data)
{
FMLRelaunchLog.log(level, format, data);
}
@Deprecated
public static void log(String targetLog, Level level, Throwable ex, String format, Object... data)
{
FMLRelaunchLog.log(targetLog, level, ex, format, data);
}
@Deprecated
public static void log(Level level, Throwable ex, String format, Object... data)
{
FMLRelaunchLog.log(level, ex, format, data);
}
@Deprecated
public static void severe(String format, Object... data)
{
log(Level.ERROR, format, data);
}
@Deprecated
public static void warning(String format, Object... data) public static void warning(String format, Object... data)
{ {
log(Level.WARN, format, data); log(Level.WARN, format, data);
} }
@Deprecated
public static void info(String format, Object... data) public static void info(String format, Object... data)
{ {
log(Level.INFO, format, data); log(Level.INFO, format, data);
} }
@Deprecated
public static void fine(String format, Object... data) public static void fine(String format, Object... data)
{ {
log(Level.DEBUG, format, data); log(Level.DEBUG, format, data);
} }
@Deprecated
public static void finer(String format, Object... data) public static void finer(String format, Object... data)
{ {
log(Level.TRACE, format, data); log(Level.TRACE, format, data);
} }
@Deprecated
public static Logger getLogger() public static Logger getLogger()
{ {
return coreLog.getLogger(); return log;
} }
} }
@@ -57,6 +57,8 @@ import net.minecraftforge.fml.relauncher.Side;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
@@ -107,6 +109,8 @@ public class FMLModContainer implements ModContainer
private URL updateJSONUrl; private URL updateJSONUrl;
private int classVersion; private int classVersion;
private final Logger modLog;
public FMLModContainer(String className, ModCandidate container, Map<String, Object> modDescriptor) public FMLModContainer(String className, ModCandidate container, Map<String, Object> modDescriptor)
{ {
this.className = className; this.className = className;
@@ -125,9 +129,11 @@ public class FMLModContainer implements ModContainer
{ {
// Delay loading of the adapter until the mod is on the classpath, in case the mod itself contains it. // Delay loading of the adapter until the mod is on the classpath, in case the mod itself contains it.
this.languageAdapter = null; this.languageAdapter = null;
FMLLog.finer("Using custom language adapter %s for %s (modid: %s)", languageAdapterType, this.className, getModId()); FMLLog.log.trace("Using custom language adapter {} for {} (modid: {})", languageAdapterType, this.className, getModId());
} }
sanityCheckModId(); sanityCheckModId();
modLog = LogManager.getLogger(getModId());
} }
private void sanityCheckModId() private void sanityCheckModId()
@@ -139,12 +145,12 @@ public class FMLModContainer implements ModContainer
} }
if (modid.length() > 64) if (modid.length() > 64)
{ {
FMLLog.bigWarning("The modid %s is longer than the recommended maximum of 64 characters. Truncation is enforced in 1.11", modid); FMLLog.bigWarning("The modid {} is longer than the recommended maximum of 64 characters. Truncation is enforced in 1.11", modid);
throw new IllegalArgumentException(String.format("The modid %s is longer than the recommended maximum of 64 characters. Truncation is enforced in 1.11", modid)); throw new IllegalArgumentException(String.format("The modid %s is longer than the recommended maximum of 64 characters. Truncation is enforced in 1.11", modid));
} }
if (!modid.equals(modid.toLowerCase(Locale.ENGLISH))) if (!modid.equals(modid.toLowerCase(Locale.ENGLISH)))
{ {
FMLLog.bigWarning("The modid %s is not the same as it's lowercase version. Lowercasing is enforced in 1.11", modid); FMLLog.bigWarning("The modid {} is not the same as it's lowercase version. Lowercasing is enforced in 1.11", modid);
throw new IllegalArgumentException(String.format("The modid %s is not the same as it's lowercase version. Lowercasing will be enforced in 1.11", modid)); throw new IllegalArgumentException(String.format("The modid %s is not the same as it's lowercase version. Lowercasing will be enforced in 1.11", modid));
} }
} }
@@ -158,7 +164,7 @@ public class FMLModContainer implements ModContainer
} }
catch (Exception ex) catch (Exception ex)
{ {
FMLLog.log(Level.ERROR, ex, "Error constructing custom mod language adapter referenced by %s (modid: %s)", this.className, getModId()); FMLLog.log.error("Error constructing custom mod language adapter referenced by {} (modid: {})", getModId(), ex);
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }
} }
@@ -217,15 +223,15 @@ public class FMLModContainer implements ModContainer
modMetadata.requiredMods = requirements; modMetadata.requiredMods = requirements;
modMetadata.dependencies = dependencies; modMetadata.dependencies = dependencies;
modMetadata.dependants = dependants; modMetadata.dependants = dependants;
FMLLog.log(getModId(), Level.TRACE, "Parsed dependency info : %s %s %s", requirements, dependencies, dependants); modLog.trace("Parsed dependency info : {} {} {}", requirements, dependencies, dependants);
} }
else else
{ {
FMLLog.log(getModId(), Level.TRACE, "Using mcmod dependency info : %s %s %s", modMetadata.requiredMods, modMetadata.dependencies, modMetadata.dependants); modLog.trace("Using mcmod dependency info : {} {} {}", modMetadata.requiredMods, modMetadata.dependencies, modMetadata.dependants);
} }
if (Strings.isNullOrEmpty(modMetadata.name)) if (Strings.isNullOrEmpty(modMetadata.name))
{ {
FMLLog.log(getModId(), Level.INFO, "Mod %s is missing the required element 'name'. Substituting %s", getModId(), getModId()); modLog.info("Mod {} is missing the required element 'name'. Substituting {}", getModId(), getModId());
modMetadata.name = getModId(); modMetadata.name = getModId();
} }
internalVersion = (String)descriptor.get("version"); internalVersion = (String)descriptor.get("version");
@@ -235,18 +241,18 @@ public class FMLModContainer implements ModContainer
if (versionProps != null) if (versionProps != null)
{ {
internalVersion = versionProps.getProperty(getModId() + ".version"); internalVersion = versionProps.getProperty(getModId() + ".version");
FMLLog.log(getModId(), Level.DEBUG, "Found version %s for mod %s in version.properties, using", internalVersion, getModId()); modLog.debug("Found version {} for mod {} in version.properties, using", internalVersion, getModId());
} }
} }
if (Strings.isNullOrEmpty(internalVersion) && !Strings.isNullOrEmpty(modMetadata.version)) if (Strings.isNullOrEmpty(internalVersion) && !Strings.isNullOrEmpty(modMetadata.version))
{ {
FMLLog.log(getModId(), Level.WARN, "Mod %s is missing the required element 'version' and a version.properties file could not be found. Falling back to metadata version %s", getModId(), modMetadata.version); modLog.warn("Mod {} is missing the required element 'version' and a version.properties file could not be found. Falling back to metadata version {}", getModId(), modMetadata.version);
internalVersion = modMetadata.version; internalVersion = modMetadata.version;
} }
if (Strings.isNullOrEmpty(internalVersion)) if (Strings.isNullOrEmpty(internalVersion))
{ {
FMLLog.log(getModId(), Level.WARN, "Mod %s is missing the required element 'version' and no fallback can be found. Substituting '1.0'.", getModId()); modLog.warn("Mod {} is missing the required element 'version' and no fallback can be found. Substituting '1.0'.", getModId());
modMetadata.version = internalVersion = "1.0"; modMetadata.version = internalVersion = "1.0";
} }
@@ -277,7 +283,7 @@ public class FMLModContainer implements ModContainer
} }
catch (MalformedURLException e) catch (MalformedURLException e)
{ {
FMLLog.log(getModId(), Level.DEBUG, "Specified json URL invalid: %s", jsonURL); modLog.debug("Specified json URL invalid: {}", jsonURL);
} }
} }
} }
@@ -287,7 +293,7 @@ public class FMLModContainer implements ModContainer
{ {
try try
{ {
FMLLog.log(getModId(), Level.DEBUG, "Attempting to load the file version.properties from %s to locate a version number for %s", getSource().getName(), getModId()); modLog.debug("Attempting to load the file version.properties from {} to locate a version number for {}", getSource().getName(), getModId());
Properties version = null; Properties version = null;
if (getSource().isFile()) if (getSource().isFile())
{ {
@@ -330,7 +336,7 @@ public class FMLModContainer implements ModContainer
catch (Exception e) catch (Exception e)
{ {
Throwables.propagateIfPossible(e); Throwables.propagateIfPossible(e);
FMLLog.log(getModId(), Level.TRACE, "Failed to find a usable version.properties file"); modLog.trace("Failed to find a usable version.properties file");
return null; return null;
} }
} }
@@ -382,7 +388,7 @@ public class FMLModContainer implements ModContainer
{ {
if (this.enabled) if (this.enabled)
{ {
FMLLog.log(getModId(), Level.DEBUG, "Enabling mod %s", getModId()); modLog.debug("Enabling mod {}", getModId());
this.eventBus = bus; this.eventBus = bus;
this.controller = controller; this.controller = controller;
eventBus.register(this); eventBus.register(this);
@@ -412,7 +418,7 @@ public class FMLModContainer implements ModContainer
} }
else else
{ {
FMLLog.log(getModId(), Level.ERROR, "The mod %s appears to have an invalid event annotation %s. This annotation can only apply to methods with recognized event arguments - it will not be called", getModId(), a.annotationType().getSimpleName()); modLog.error("The mod {} appears to have an invalid event annotation {}. This annotation can only apply to methods with recognized event arguments - it will not be called", getModId(), a.annotationType().getSimpleName());
} }
} }
else if (a.annotationType().equals(Mod.InstanceFactory.class)) else if (a.annotationType().equals(Mod.InstanceFactory.class))
@@ -424,11 +430,11 @@ public class FMLModContainer implements ModContainer
} }
else if (!(Modifier.isStatic(m.getModifiers()) && m.getParameterTypes().length == 0)) else if (!(Modifier.isStatic(m.getModifiers()) && m.getParameterTypes().length == 0))
{ {
FMLLog.log(getModId(), Level.ERROR, "The InstanceFactory annotation can only apply to a static method, taking zero arguments - it will be ignored on %s(%s)", m.getName(), Arrays.asList(m.getParameterTypes())); modLog.error("The InstanceFactory annotation can only apply to a static method, taking zero arguments - it will be ignored on {}({})", m.getName(), Arrays.asList(m.getParameterTypes()));
} }
else if (factoryMethod != null) else if (factoryMethod != null)
{ {
FMLLog.log(getModId(), Level.ERROR, "The InstanceFactory annotation can only be used once, the application to %s(%s) will be ignored", m.getName(), Arrays.asList(m.getParameterTypes())); modLog.error("The InstanceFactory annotation can only be used once, the application to {}({}) will be ignored", m.getName(), Arrays.asList(m.getParameterTypes()));
} }
} }
} }
@@ -472,13 +478,13 @@ public class FMLModContainer implements ModContainer
owner = ASMDataTable.getOwnerModID(mods, targets); owner = ASMDataTable.getOwnerModID(mods, targets);
if (Strings.isNullOrEmpty(owner)) if (Strings.isNullOrEmpty(owner))
{ {
FMLLog.bigWarning("Could not determine owning mod for @%s on %s for mod %s", annotationClassName, targets.getClassName(), this.getModId()); FMLLog.bigWarning("Could not determine owning mod for @{} on {} for mod {}", annotationClassName, targets.getClassName(), this.getModId());
continue; continue;
} }
} }
if (!this.getModId().equals(owner)) if (!this.getModId().equals(owner))
{ {
FMLLog.fine("Skipping @%s injection for %s.%s since it is not for mod %s", annotationClassName, targets.getClassName(), targets.getObjectName(), this.getModId()); FMLLog.log.debug("Skipping @{} injection for {}.{} since it is not for mod {}", annotationClassName, targets.getClassName(), targets.getObjectName(), this.getModId());
continue; continue;
} }
Field f = null; Field f = null;
@@ -510,7 +516,7 @@ public class FMLModContainer implements ModContainer
catch (Exception e) catch (Exception e)
{ {
Throwables.propagateIfPossible(e); Throwables.propagateIfPossible(e);
FMLLog.log(getModId(), Level.WARN, e, "Attempting to load @%s in class %s for %s and failing", annotationName, targets.getClassName(), mc.getModId()); modLog.warn("Attempting to load @{} in class {} for {} and failing", annotationName, targets.getClassName(), mc.getModId(), e);
} }
} }
if (f != null) if (f != null)
@@ -521,7 +527,7 @@ public class FMLModContainer implements ModContainer
target = modInstance; target = modInstance;
if (!modInstance.getClass().equals(clz)) if (!modInstance.getClass().equals(clz))
{ {
FMLLog.log(getModId(), Level.WARN, "Unable to inject @%s in non-static field %s.%s for %s as it is NOT the primary mod instance", annotationName, targets.getClassName(), targets.getObjectName(), mc.getModId()); modLog.warn("Unable to inject @{} in non-static field {}.{} for {} as it is NOT the primary mod instance", annotationName, targets.getClassName(), targets.getObjectName(), mc.getModId());
continue; continue;
} }
} }
@@ -573,7 +579,7 @@ public class FMLModContainer implements ModContainer
{ {
warnLevel = Level.TRACE; warnLevel = Level.TRACE;
} }
FMLLog.log(getModId(), warnLevel, "The mod %s is expecting signature %s for source %s, however there is no signature matching that description", getModId(), expectedFingerprint, source.getName()); modLog.log(warnLevel, "The mod {} is expecting signature {} for source {}, however there is no signature matching that description", getModId(), expectedFingerprint, source.getName());
} }
else else
{ {
@@ -762,13 +768,13 @@ public class FMLModContainer implements ModContainer
if (clientSideOnly && side != Side.CLIENT) if (clientSideOnly && side != Side.CLIENT)
{ {
FMLLog.info("Disabling mod %s it is client side only.", getModId()); FMLLog.log.info("Disabling mod {} it is client side only.", getModId());
return false; return false;
} }
if (serverSideOnly && side != Side.SERVER) if (serverSideOnly && side != Side.SERVER)
{ {
FMLLog.info("Disabling mod %s it is server side only.", getModId()); FMLLog.log.info("Disabling mod {} it is server side only.", getModId());
return false; return false;
} }
@@ -74,7 +74,7 @@ public interface ILanguageAdapter {
catch (ClassNotFoundException e) catch (ClassNotFoundException e)
{ {
// Not a singleton, look for @Instance field as a fallback. // Not a singleton, look for @Instance field as a fallback.
FMLLog.log(Level.INFO, e, "An error occurred trying to load a proxy into %s.%s. Did you declare your mod as 'class' instead of 'object'?", proxyTarget.getSimpleName(), target.getName()); FMLLog.log.info("An error occurred trying to load a proxy into {}.{}. Did you declare your mod as 'class' instead of 'object'?", proxyTarget.getSimpleName(), target.getName(), e);
return; return;
} }
@@ -110,12 +110,12 @@ public interface ILanguageAdapter {
} }
catch (InvocationTargetException e) catch (InvocationTargetException e)
{ {
FMLLog.log(Level.ERROR, e, "An error occurred trying to load a proxy into %s.%s", proxyTarget.getSimpleName(), target.getName()); FMLLog.log.error("An error occurred trying to load a proxy into {}.{}", target.getName(), e);
throw new LoaderException(e); throw new LoaderException(e);
} }
// If we come here we could not find a setter for this proxy. // If we come here we could not find a setter for this proxy.
FMLLog.severe("Failed loading proxy into %s.%s, could not find setter function. Did you declare the field with 'val' instead of 'var'?", proxyTarget.getSimpleName(), target.getName()); FMLLog.log.fatal("Failed loading proxy into {}.{}, could not find setter function. Did you declare the field with 'val' instead of 'var'?", proxyTarget.getSimpleName(), target.getName());
throw new LoaderException(String.format("Failed loading proxy into %s.%s, could not find setter function. Did you declare the field with 'val' instead of 'var'?", proxyTarget.getSimpleName(), target.getName())); throw new LoaderException(String.format("Failed loading proxy into %s.%s, could not find setter function. Did you declare the field with 'val' instead of 'var'?", proxyTarget.getSimpleName(), target.getName()));
} }
@@ -160,14 +160,14 @@ public interface ILanguageAdapter {
if (!target.getType().isAssignableFrom(proxy.getClass())) if (!target.getType().isAssignableFrom(proxy.getClass()))
{ {
FMLLog.severe("Attempted to load a proxy type %s into %s.%s, but the types don't match", targetType, proxyTarget.getSimpleName(), target.getName()); FMLLog.log.fatal("Attempted to load a proxy type {} into {}.{}, but the types don't match", targetType, proxyTarget.getSimpleName(), target.getName());
throw new LoaderException(String.format("Attempted to load a proxy type %s into %s.%s, but the types don't match", targetType, proxyTarget.getSimpleName(), target.getName())); throw new LoaderException(String.format("Attempted to load a proxy type %s into %s.%s, but the types don't match", targetType, proxyTarget.getSimpleName(), target.getName()));
} }
setProxy(target, proxyTarget, proxy); setProxy(target, proxyTarget, proxy);
} }
catch (Exception e) { catch (Exception e) {
FMLLog.log(Level.ERROR, e, "An error occurred trying to load a proxy into %s.%s", proxyTarget.getSimpleName(), target.getName()); FMLLog.log.error("An error occurred trying to load a proxy into {}.{}", target.getName(), e);
throw new LoaderException(e); throw new LoaderException(e);
} }
} }
@@ -175,7 +175,7 @@ public interface ILanguageAdapter {
} }
else else
{ {
FMLLog.finer("Mod does not appear to be a singleton."); FMLLog.log.trace("Mod does not appear to be a singleton.");
} }
} }
} }
@@ -37,6 +37,7 @@ import net.minecraftforge.fml.common.functions.ArtifactVersionNameFunction;
import net.minecraftforge.fml.common.versioning.ArtifactVersion; import net.minecraftforge.fml.common.versioning.ArtifactVersion;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.ThreadContext; import org.apache.logging.log4j.ThreadContext;
import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ArrayListMultimap;
@@ -79,7 +80,7 @@ public class LoadController
@Override @Override
public void handleException(Throwable exception, SubscriberExceptionContext context) public void handleException(Throwable exception, SubscriberExceptionContext context)
{ {
FMLLog.log("FMLMainChannel", Level.ERROR, exception, "Could not dispatch event: %s to %s", context.getEvent(), context.getSubscriberMethod()); FMLLog.log.error("Could not dispatch event: {} to {}", context.getSubscriberMethod(), exception);
} }
}); });
this.masterChannel.register(this); this.masterChannel.register(this);
@@ -130,7 +131,7 @@ public class LoadController
} }
else else
{ {
FMLLog.log(mod.getModId(), Level.WARN, "Mod %s has been disabled through configuration", mod.getModId()); LogManager.getLogger(mod.getModId()).warn("Mod {} has been disabled through configuration", mod.getModId());
modStates.put(mod.getModId(), ModState.UNLOADED); modStates.put(mod.getModId(), ModState.UNLOADED);
modStates.put(mod.getModId(), ModState.DISABLED); modStates.put(mod.getModId(), ModState.DISABLED);
} }
@@ -152,7 +153,7 @@ public class LoadController
{ {
if (FMLCommonHandler.instance().isDisplayCloseRequested()) if (FMLCommonHandler.instance().isDisplayCloseRequested())
{ {
FMLLog.info("The game window is being closed by the player, exiting."); FMLLog.log.info("The game window is being closed by the player, exiting.");
FMLCommonHandler.instance().exitJava(0, false); FMLCommonHandler.instance().exitJava(0, false);
} }
@@ -161,18 +162,18 @@ public class LoadController
if (state != desiredState && !forceState) if (state != desiredState && !forceState)
{ {
Entry<String, Throwable> toThrow = null; Entry<String, Throwable> toThrow = null;
FMLLog.severe("Fatal errors were detected during the transition from %s to %s. Loading cannot continue", oldState, desiredState); FMLLog.log.fatal("Fatal errors were detected during the transition from {} to {}. Loading cannot continue", oldState, desiredState);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
printModStates(sb); printModStates(sb);
FMLLog.severe("%s", sb.toString()); FMLLog.log.fatal(sb.toString());
if (errors.size()>0) if (errors.size()>0)
{ {
FMLLog.severe("The following problems were captured during this phase"); FMLLog.log.fatal("The following problems were captured during this phase");
for (Entry<String, Throwable> error : errors.entries()) for (Entry<String, Throwable> error : errors.entries())
{ {
String modId = error.getKey(); String modId = error.getKey();
String modName = modNames.get(modId); String modName = modNames.get(modId);
FMLLog.log(Level.ERROR, error.getValue(), "Caught exception from %s (%s)", modName, modId); FMLLog.log.error("Caught exception from {} ({})", modId, error.getValue());
if (error.getValue() instanceof IFMLHandledException) if (error.getValue() instanceof IFMLHandledException)
{ {
toThrow = error; toThrow = error;
@@ -185,7 +186,7 @@ public class LoadController
} }
else else
{ {
FMLLog.severe("The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base class" + FMLLog.log.fatal("The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base class" +
"ForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside of" + "ForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside of" +
"ForgeModLoader, especially Optifine, to see if there are fixes available."); "ForgeModLoader, especially Optifine, to see if there are fixes available.");
throw new RuntimeException("The ForgeModLoader state engine is invalid"); throw new RuntimeException("The ForgeModLoader state engine is invalid");
@@ -200,7 +201,7 @@ public class LoadController
} }
else if (state != desiredState && forceState) else if (state != desiredState && forceState)
{ {
FMLLog.info("The state engine was in incorrect state %s and forced into state %s. Errors may have been discarded.", state, desiredState); FMLLog.log.info("The state engine was in incorrect state {} and forced into state {}. Errors may have been discarded.", state, desiredState);
forceState(desiredState); forceState(desiredState);
} }
@@ -240,7 +241,7 @@ public class LoadController
{ {
if (av.getLabel()!= null && requirements.contains(av.getLabel()) && modStates.containsEntry(av.getLabel(),ModState.ERRORED)) if (av.getLabel()!= null && requirements.contains(av.getLabel()) && modStates.containsEntry(av.getLabel(),ModState.ERRORED))
{ {
FMLLog.log(modId, Level.ERROR, "Skipping event %s and marking errored mod %s since required dependency %s has errored", stateEvent.getEventType(), modId, av.getLabel()); LogManager.getLogger(modId).error("Skipping event {} and marking errored mod {} since required dependency {} has errored", stateEvent.getEventType(), modId, av.getLabel());
modStates.put(modId, ModState.ERRORED); modStates.put(modId, ModState.ERRORED);
return; return;
} }
@@ -248,9 +249,9 @@ public class LoadController
activeContainer = mc; activeContainer = mc;
stateEvent.applyModContainer(mc); stateEvent.applyModContainer(mc);
ThreadContext.put("mod", modId); ThreadContext.put("mod", modId);
FMLLog.log(modId, Level.TRACE, "Sending event %s to mod %s", stateEvent.getEventType(), modId); LogManager.getLogger(modId).trace("Sending event {} to mod {}", stateEvent.getEventType(), modId);
eventChannels.get(modId).post(stateEvent); eventChannels.get(modId).post(stateEvent);
FMLLog.log(modId, Level.TRACE, "Sent event %s to mod %s", stateEvent.getEventType(), modId); LogManager.getLogger(modId).trace("Sent event {} to mod {}", stateEvent.getEventType(), modId);
ThreadContext.remove("mod"); ThreadContext.remove("mod");
activeContainer = null; activeContainer = null;
if (stateEvent instanceof FMLStateEvent) if (stateEvent instanceof FMLStateEvent)
@@ -282,7 +283,7 @@ public class LoadController
} }
if (mc.getMod()==null && !mc.isImmutable() && state!=LoaderState.CONSTRUCTING) if (mc.getMod()==null && !mc.isImmutable() && state!=LoaderState.CONSTRUCTING)
{ {
FMLLog.severe("There is a severe problem with %s - it appears not to have constructed correctly", mc.getModId()); FMLLog.log.fatal("There is a severe problem with {} - it appears not to have constructed correctly", mc.getModId());
if (state != LoaderState.CONSTRUCTING) if (state != LoaderState.CONSTRUCTING)
{ {
this.errorOccurred(mc, new RuntimeException()); this.errorOccurred(mc, new RuntimeException());
@@ -338,7 +339,7 @@ public class LoadController
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "An unexpected exception"); FMLLog.log.error("An unexpected exception", e);
throw new LoaderException(e); throw new LoaderException(e);
} }
} }
@@ -347,7 +348,7 @@ public class LoadController
{ {
if (modObjectList == null) if (modObjectList == null)
{ {
FMLLog.severe("Detected an attempt by a mod %s to perform game activity during mod construction. This is a serious programming error.", activeContainer); FMLLog.log.fatal("Detected an attempt by a mod {} to perform game activity during mod construction. This is a serious programming error.", activeContainer);
return buildModObjectList(); return buildModObjectList();
} }
return ImmutableBiMap.copyOf(modObjectList); return ImmutableBiMap.copyOf(modObjectList);
@@ -206,13 +206,13 @@ public class Loader
java8 = major > 7; java8 = major > 7;
if (!java8) if (!java8)
{ {
FMLLog.severe("The game is not running with Java 8. Forge recommends Java 8 for maximum compatibility with mods"); FMLLog.log.fatal("The game is not running with Java 8. Forge recommends Java 8 for maximum compatibility with mods");
} }
modClassLoader = new ModClassLoader(getClass().getClassLoader()); modClassLoader = new ModClassLoader(getClass().getClassLoader());
if (mccversion !=null && !mccversion.equals(MC_VERSION)) if (mccversion !=null && !mccversion.equals(MC_VERSION))
{ {
FMLLog.severe("This version of FML is built for Minecraft %s, we have detected Minecraft %s in your minecraft jar file", mccversion, MC_VERSION); FMLLog.log.fatal("This version of FML is built for Minecraft {}, we have detected Minecraft {} in your minecraft jar file", mccversion, MC_VERSION);
throw new LoaderException(String.format("This version of FML is built for Minecraft %s, we have detected Minecraft %s in your minecraft jar file", mccversion, MC_VERSION)); throw new LoaderException(String.format("This version of FML is built for Minecraft %s, we have detected Minecraft %s in your minecraft jar file", mccversion, MC_VERSION));
} }
@@ -235,7 +235,7 @@ public class Loader
*/ */
private void sortModList() private void sortModList()
{ {
FMLLog.finer("Verifying mod requirements are satisfied"); FMLLog.log.trace("Verifying mod requirements are satisfied");
List<WrongMinecraftVersionException> wrongMinecraftExceptions = new ArrayList<WrongMinecraftVersionException>(); List<WrongMinecraftVersionException> wrongMinecraftExceptions = new ArrayList<WrongMinecraftVersionException>();
List<MissingModsException> missingModsExceptions = new ArrayList<MissingModsException>(); List<MissingModsException> missingModsExceptions = new ArrayList<MissingModsException>();
try try
@@ -251,9 +251,9 @@ public class Loader
{ {
if (!mod.acceptableMinecraftVersionRange().containsVersion(minecraft.getProcessedVersion())) if (!mod.acceptableMinecraftVersionRange().containsVersion(minecraft.getProcessedVersion()))
{ {
FMLLog.severe("The mod %s does not wish to run in Minecraft version %s. You will have to remove it to play.", mod.getModId(), getMCVersionString()); FMLLog.log.fatal("The mod {} does not wish to run in Minecraft version {}. You will have to remove it to play.", mod.getModId(), getMCVersionString());
WrongMinecraftVersionException ret = new WrongMinecraftVersionException(mod, getMCVersionString()); WrongMinecraftVersionException ret = new WrongMinecraftVersionException(mod, getMCVersionString());
FMLLog.severe(ret.getMessage()); FMLLog.log.fatal(ret.getMessage());
wrongMinecraftExceptions.add(ret); wrongMinecraftExceptions.add(ret);
continue; continue;
} }
@@ -263,13 +263,13 @@ public class Loader
Set<String> missingMods = Sets.difference(names.keySet(), modVersions.keySet()); Set<String> missingMods = Sets.difference(names.keySet(), modVersions.keySet());
if (!missingMods.isEmpty()) if (!missingMods.isEmpty())
{ {
FMLLog.severe("The mod %s (%s) requires mods %s to be available", mod.getModId(), mod.getName(), missingMods); FMLLog.log.fatal("The mod {} ({}) requires mods {} to be available", mod.getModId(), mod.getName(), missingMods);
for (String modid : missingMods) for (String modid : missingMods)
{ {
versionMissingMods.add(names.get(modid)); versionMissingMods.add(names.get(modid));
} }
MissingModsException ret = new MissingModsException(versionMissingMods, mod.getModId(), mod.getName()); MissingModsException ret = new MissingModsException(versionMissingMods, mod.getModId(), mod.getName());
FMLLog.severe(ret.getMessage()); FMLLog.log.fatal(ret.getMessage());
missingModsExceptions.add(ret); missingModsExceptions.add(ret);
continue; continue;
} }
@@ -287,16 +287,16 @@ public class Loader
} }
if (!versionMissingMods.isEmpty()) if (!versionMissingMods.isEmpty())
{ {
FMLLog.severe("The mod %s (%s) requires mod versions %s to be available", mod.getModId(), mod.getName(), versionMissingMods); FMLLog.log.fatal("The mod {} ({}) requires mod versions {} to be available", mod.getModId(), mod.getName(), versionMissingMods);
MissingModsException ret = new MissingModsException(versionMissingMods, mod.getModId(), mod.getName()); MissingModsException ret = new MissingModsException(versionMissingMods, mod.getModId(), mod.getName());
FMLLog.severe(ret.toString()); FMLLog.log.fatal(ret.toString());
missingModsExceptions.add(ret); missingModsExceptions.add(ret);
} }
} }
if (wrongMinecraftExceptions.isEmpty() && missingModsExceptions.isEmpty()) if (wrongMinecraftExceptions.isEmpty() && missingModsExceptions.isEmpty())
{ {
FMLLog.finer("All mod requirements are satisfied"); FMLLog.log.trace("All mod requirements are satisfied");
} }
else if (missingModsExceptions.size()==1 && wrongMinecraftExceptions.isEmpty()) else if (missingModsExceptions.size()==1 && wrongMinecraftExceptions.isEmpty())
{ {
@@ -316,7 +316,7 @@ public class Loader
try try
{ {
FMLLog.finer("Sorting mods into an ordered list"); FMLLog.log.trace("Sorting mods into an ordered list");
List<ModContainer> sortedMods = sorter.sort(); List<ModContainer> sortedMods = sorter.sort();
// Reset active list to the sorted list // Reset active list to the sorted list
modController.getActiveModList().clear(); modController.getActiveModList().clear();
@@ -325,37 +325,37 @@ public class Loader
mods.removeAll(sortedMods); mods.removeAll(sortedMods);
sortedMods.addAll(mods); sortedMods.addAll(mods);
mods = sortedMods; mods = sortedMods;
FMLLog.finer("Mod sorting completed successfully"); FMLLog.log.trace("Mod sorting completed successfully");
} }
catch (ModSortingException sortException) catch (ModSortingException sortException)
{ {
FMLLog.severe("A dependency cycle was detected in the input mod set so an ordering cannot be determined"); FMLLog.log.fatal("A dependency cycle was detected in the input mod set so an ordering cannot be determined");
SortingExceptionData<ModContainer> exceptionData = sortException.getExceptionData(); SortingExceptionData<ModContainer> exceptionData = sortException.getExceptionData();
FMLLog.severe("The first mod in the cycle is %s", exceptionData.getFirstBadNode()); FMLLog.log.fatal("The first mod in the cycle is {}", exceptionData.getFirstBadNode());
FMLLog.severe("The mod cycle involves"); FMLLog.log.fatal("The mod cycle involves");
for (ModContainer mc : exceptionData.getVisitedNodes()) for (ModContainer mc : exceptionData.getVisitedNodes())
{ {
FMLLog.severe("%s : before: %s, after: %s", mc.toString(), mc.getDependants(), mc.getDependencies()); FMLLog.log.fatal("{} : before: {}, after: {}", mc.toString(), mc.getDependants(), mc.getDependencies());
} }
FMLLog.log(Level.ERROR, sortException, "The full error"); FMLLog.log.error("The full error", sortException);
throw sortException; throw sortException;
} }
} }
finally finally
{ {
FMLLog.fine("Mod sorting data"); FMLLog.log.debug("Mod sorting data");
int unprintedMods = mods.size(); int unprintedMods = mods.size();
for (ModContainer mod : getActiveModList()) for (ModContainer mod : getActiveModList())
{ {
if (!mod.isImmutable()) if (!mod.isImmutable())
{ {
FMLLog.fine("\t%s(%s:%s): %s (%s)", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName(), mod.getSortingRules()); FMLLog.log.debug("\t{}({}:{}): {} ({})", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName(), mod.getSortingRules());
unprintedMods--; unprintedMods--;
} }
} }
if (unprintedMods == mods.size()) if (unprintedMods == mods.size())
{ {
FMLLog.fine("No user mods found to sort"); FMLLog.log.debug("No user mods found to sort");
} }
} }
@@ -378,7 +378,7 @@ public class Loader
private ModDiscoverer identifyMods(List<String> additionalContainers) private ModDiscoverer identifyMods(List<String> additionalContainers)
{ {
injectedContainers.addAll(additionalContainers); injectedContainers.addAll(additionalContainers);
FMLLog.fine("Building injected Mod Containers %s", injectedContainers); FMLLog.log.debug("Building injected Mod Containers {}", injectedContainers);
mods.add(minecraft); mods.add(minecraft);
// Add in the MCP mod container // Add in the MCP mod container
mods.add(new InjectedModContainer(mcp,new File("minecraft.jar"))); mods.add(new InjectedModContainer(mcp,new File("minecraft.jar")));
@@ -391,30 +391,30 @@ public class Loader
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "A problem occurred instantiating the injected mod container %s", cont); FMLLog.log.error("A problem occurred instantiating the injected mod container {}", cont, e);
throw new LoaderException(e); throw new LoaderException(e);
} }
mods.add(new InjectedModContainer(mc,mc.getSource())); mods.add(new InjectedModContainer(mc,mc.getSource()));
} }
ModDiscoverer discoverer = new ModDiscoverer(); ModDiscoverer discoverer = new ModDiscoverer();
FMLLog.fine("Attempting to load mods contained in the minecraft jar file and associated classes"); FMLLog.log.debug("Attempting to load mods contained in the minecraft jar file and associated classes");
discoverer.findClasspathMods(modClassLoader); discoverer.findClasspathMods(modClassLoader);
FMLLog.fine("Minecraft jar mods loaded successfully"); FMLLog.log.debug("Minecraft jar mods loaded successfully");
FMLLog.getLogger().log(Level.INFO, "Found {} mods from the command line. Injecting into mod discoverer",ModListHelper.additionalMods.size()); FMLLog.log.info("Found {} mods from the command line. Injecting into mod discoverer", ModListHelper.additionalMods.size());
FMLLog.info("Searching %s for mods", canonicalModsDir.getAbsolutePath()); FMLLog.log.info("Searching {} for mods", canonicalModsDir.getAbsolutePath());
discoverer.findModDirMods(canonicalModsDir, ModListHelper.additionalMods.values().toArray(new File[0])); discoverer.findModDirMods(canonicalModsDir, ModListHelper.additionalMods.values().toArray(new File[0]));
File versionSpecificModsDir = new File(canonicalModsDir,mccversion); File versionSpecificModsDir = new File(canonicalModsDir,mccversion);
if (versionSpecificModsDir.isDirectory()) if (versionSpecificModsDir.isDirectory())
{ {
FMLLog.info("Also searching %s for mods", versionSpecificModsDir); FMLLog.log.info("Also searching {} for mods", versionSpecificModsDir);
discoverer.findModDirMods(versionSpecificModsDir); discoverer.findModDirMods(versionSpecificModsDir);
} }
mods.addAll(discoverer.identifyMods()); mods.addAll(discoverer.identifyMods());
identifyDuplicates(mods); identifyDuplicates(mods);
namedMods = Maps.uniqueIndex(mods, new ModIdFunction()); namedMods = Maps.uniqueIndex(mods, new ModIdFunction());
FMLLog.info("Forge Mod Loader has identified %d mod%s to load", mods.size(), mods.size() != 1 ? "s" : ""); FMLLog.log.info("Forge Mod Loader has identified {} mod{} to load", mods.size(), mods.size() != 1 ? "s" : "");
return discoverer; return discoverer;
} }
@@ -444,7 +444,7 @@ public class Loader
{ {
if (e.getCount() > 1) if (e.getCount() > 1)
{ {
FMLLog.severe("Found a duplicate mod %s at %s", e.getElement().getModId(), dupsearch.get(e.getElement())); FMLLog.log.fatal("Found a duplicate mod {} at {}", e.getElement().getModId(), dupsearch.get(e.getElement()));
dupes.putAll(e.getElement(),dupsearch.get(e.getElement())); dupes.putAll(e.getElement(),dupsearch.get(e.getElement()));
} }
} }
@@ -473,44 +473,44 @@ public class Loader
} }
catch (IOException ioe) catch (IOException ioe)
{ {
FMLLog.log(Level.ERROR, ioe, "Failed to resolve loader directories: mods : %s ; config %s", canonicalModsDir.getAbsolutePath(), FMLLog.log.error("Failed to resolve loader directories: mods : {} ; config {}", canonicalModsDir.getAbsolutePath(),
configDir.getAbsolutePath()); configDir.getAbsolutePath(), ioe);
throw new LoaderException(ioe); throw new LoaderException(ioe);
} }
if (!canonicalModsDir.exists()) if (!canonicalModsDir.exists())
{ {
FMLLog.info("No mod directory found, creating one: %s", canonicalModsPath); FMLLog.log.info("No mod directory found, creating one: {}", canonicalModsPath);
boolean dirMade = canonicalModsDir.mkdir(); boolean dirMade = canonicalModsDir.mkdir();
if (!dirMade) if (!dirMade)
{ {
FMLLog.severe("Unable to create the mod directory %s", canonicalModsPath); FMLLog.log.fatal("Unable to create the mod directory {}", canonicalModsPath);
throw new LoaderException(String.format("Unable to create the mod directory %s", canonicalModsPath)); throw new LoaderException(String.format("Unable to create the mod directory %s", canonicalModsPath));
} }
FMLLog.info("Mod directory created successfully"); FMLLog.log.info("Mod directory created successfully");
} }
if (!canonicalConfigDir.exists()) if (!canonicalConfigDir.exists())
{ {
FMLLog.fine("No config directory found, creating one: %s", canonicalConfigPath); FMLLog.log.debug("No config directory found, creating one: {}", canonicalConfigPath);
boolean dirMade = canonicalConfigDir.mkdir(); boolean dirMade = canonicalConfigDir.mkdir();
if (!dirMade) if (!dirMade)
{ {
FMLLog.severe("Unable to create the config directory %s", canonicalConfigPath); FMLLog.log.fatal("Unable to create the config directory {}", canonicalConfigPath);
throw new LoaderException(); throw new LoaderException();
} }
FMLLog.info("Config directory created successfully"); FMLLog.log.info("Config directory created successfully");
} }
if (!canonicalModsDir.isDirectory()) if (!canonicalModsDir.isDirectory())
{ {
FMLLog.severe("Attempting to load mods from %s, which is not a directory", canonicalModsPath); FMLLog.log.fatal("Attempting to load mods from {}, which is not a directory", canonicalModsPath);
throw new LoaderException(); throw new LoaderException();
} }
if (!configDir.isDirectory()) if (!configDir.isDirectory())
{ {
FMLLog.severe("Attempting to load configuration from %s, which is not a directory", canonicalConfigPath); FMLLog.log.fatal("Attempting to load configuration from {}, which is not a directory", canonicalConfigPath);
throw new LoaderException(); throw new LoaderException();
} }
@@ -564,14 +564,14 @@ public class Loader
{ {
if (nonMod.isFile()) if (nonMod.isFile())
{ {
FMLLog.info("FML has found a non-mod file %s in your mods directory. It will now be injected into your classpath. This could severe stability issues, it should be removed if possible.", nonMod.getName()); FMLLog.log.info("FML has found a non-mod file {} in your mods directory. It will now be injected into your classpath. This could severe stability issues, it should be removed if possible.", nonMod.getName());
try try
{ {
modClassLoader.addFile(nonMod); modClassLoader.addFile(nonMod);
} }
catch (MalformedURLException e) catch (MalformedURLException e)
{ {
FMLLog.log(Level.ERROR, e, "Encountered a weird problem with non-mod file injection : %s", nonMod.getName()); FMLLog.log.error("Encountered a weird problem with non-mod file injection : {}", nonMod.getName(), e);
} }
} }
} }
@@ -592,22 +592,22 @@ public class Loader
} }
}); });
FMLLog.fine("Mod signature data"); FMLLog.log.debug("Mod signature data");
FMLLog.fine(" \tValid Signatures:"); FMLLog.log.debug(" \tValid Signatures:");
for (ModContainer mod : getActiveModList()) for (ModContainer mod : getActiveModList())
{ {
if (mod.getSigningCertificate() != null) if (mod.getSigningCertificate() != null)
FMLLog.fine("\t\t(%s) %s\t(%s\t%s)\t%s", CertificateHelper.getFingerprint(mod.getSigningCertificate()), mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName()); FMLLog.log.debug("\t\t({}) {}\t({}\t{})\t{}", CertificateHelper.getFingerprint(mod.getSigningCertificate()), mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName());
} }
FMLLog.fine(" \tMissing Signatures:"); FMLLog.log.debug(" \tMissing Signatures:");
for (ModContainer mod : getActiveModList()) for (ModContainer mod : getActiveModList())
{ {
if (mod.getSigningCertificate() == null) if (mod.getSigningCertificate() == null)
FMLLog.fine("\t\t%s\t(%s\t%s)\t%s", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName()); FMLLog.log.debug("\t\t{}\t({}\t{})\t{}", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName());
} }
if (getActiveModList().isEmpty()) if (getActiveModList().isEmpty())
{ {
FMLLog.fine("No user mod signature data found"); FMLLog.log.debug("No user mod signature data found");
} }
progressBar.step("Initializing mods Phase 1"); progressBar.step("Initializing mods Phase 1");
modController.transition(LoaderState.PREINITIALIZATION, false); modController.transition(LoaderState.PREINITIALIZATION, false);
@@ -635,7 +635,7 @@ public class Loader
{ {
if (!modController.isInState(LoaderState.PREINITIALIZATION)) if (!modController.isInState(LoaderState.PREINITIALIZATION))
{ {
FMLLog.warning("There were errors previously. Not beginning mod initialization phase"); FMLLog.log.warn("There were errors previously. Not beginning mod initialization phase");
return; return;
} }
PersistentRegistryManager.fireCreateRegistryEvents(); PersistentRegistryManager.fireCreateRegistryEvents();
@@ -654,31 +654,31 @@ public class Loader
private void disableRequestedMods() private void disableRequestedMods()
{ {
String forcedModList = System.getProperty("fml.modStates", ""); String forcedModList = System.getProperty("fml.modStates", "");
FMLLog.finer("Received a system property request \'%s\'",forcedModList); FMLLog.log.trace("Received a system property request \'{}\'",forcedModList);
Map<String, String> sysPropertyStateList = Splitter.on(CharMatcher.anyOf(";:")) Map<String, String> sysPropertyStateList = Splitter.on(CharMatcher.anyOf(";:"))
.omitEmptyStrings().trimResults().withKeyValueSeparator("=") .omitEmptyStrings().trimResults().withKeyValueSeparator("=")
.split(forcedModList); .split(forcedModList);
FMLLog.finer("System property request managing the state of %d mods", sysPropertyStateList.size()); FMLLog.log.trace("System property request managing the state of {} mods", sysPropertyStateList.size());
Map<String, String> modStates = Maps.newHashMap(); Map<String, String> modStates = Maps.newHashMap();
forcedModFile = new File(canonicalConfigDir, "fmlModState.properties"); forcedModFile = new File(canonicalConfigDir, "fmlModState.properties");
Properties forcedModListProperties = new Properties(); Properties forcedModListProperties = new Properties();
if (forcedModFile.exists() && forcedModFile.isFile()) if (forcedModFile.exists() && forcedModFile.isFile())
{ {
FMLLog.finer("Found a mod state file %s", forcedModFile.getName()); FMLLog.log.trace("Found a mod state file {}", forcedModFile.getName());
try try
{ {
forcedModListProperties.load(new FileReader(forcedModFile)); forcedModListProperties.load(new FileReader(forcedModFile));
FMLLog.finer("Loaded states for %d mods from file", forcedModListProperties.size()); FMLLog.log.trace("Loaded states for {} mods from file", forcedModListProperties.size());
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.INFO, e, "An error occurred reading the fmlModState.properties file"); FMLLog.log.info("An error occurred reading the fmlModState.properties file", e);
} }
} }
modStates.putAll(Maps.fromProperties(forcedModListProperties)); modStates.putAll(Maps.fromProperties(forcedModListProperties));
modStates.putAll(sysPropertyStateList); modStates.putAll(sysPropertyStateList);
FMLLog.fine("After merging, found state information for %d mods", modStates.size()); FMLLog.log.debug("After merging, found state information for {} mods", modStates.size());
Map<String, Boolean> isEnabled = Maps.transformValues(modStates, new Function<String, Boolean>() Map<String, Boolean> isEnabled = Maps.transformValues(modStates, new Function<String, Boolean>()
{ {
@@ -693,7 +693,7 @@ public class Loader
{ {
if (namedMods.containsKey(entry.getKey())) if (namedMods.containsKey(entry.getKey()))
{ {
FMLLog.info("Setting mod %s to enabled state %b", entry.getKey(), entry.getValue()); FMLLog.log.info("Setting mod {} to enabled state {}", entry.getKey(), entry.getValue());
namedMods.get(entry.getKey()).setEnabledState(entry.getValue()); namedMods.get(entry.getKey()).setEnabledState(entry.getValue());
} }
} }
@@ -811,7 +811,7 @@ public class Loader
if (parseFailure) if (parseFailure)
{ {
FMLLog.log(Level.WARN, "Unable to parse dependency string %s", dependencyString); FMLLog.log.warn("Unable to parse dependency string {}", dependencyString);
throw new LoaderException(String.format("Unable to parse dependency string %s", dependencyString)); throw new LoaderException(String.format("Unable to parse dependency string %s", dependencyString));
} }
} }
@@ -835,7 +835,7 @@ public class Loader
modController.transition(LoaderState.AVAILABLE, false); modController.transition(LoaderState.AVAILABLE, false);
modController.distributeStateMessage(LoaderState.AVAILABLE); modController.distributeStateMessage(LoaderState.AVAILABLE);
PersistentRegistryManager.freezeData(); PersistentRegistryManager.freezeData();
FMLLog.info("Forge Mod Loader has successfully loaded %d mod%s", mods.size(), mods.size() == 1 ? "" : "s"); FMLLog.log.info("Forge Mod Loader has successfully loaded {} mod{}", mods.size(), mods.size() == 1 ? "" : "s");
progressBar.step("Completing Minecraft initialization"); progressBar.step("Completing Minecraft initialization");
} }
@@ -880,7 +880,7 @@ public class Loader
} }
catch (Throwable t) catch (Throwable t)
{ {
FMLLog.log(Level.ERROR, t, "A fatal exception occurred during the server starting event"); FMLLog.log.error("A fatal exception occurred during the server starting event", t);
return false; return false;
} }
return true; return true;
@@ -951,7 +951,7 @@ public class Loader
} }
catch (Throwable t) catch (Throwable t)
{ {
FMLLog.log(Level.ERROR, t, "A fatal exception occurred during the server about to start event"); FMLLog.log.error("A fatal exception occurred during the server about to start event", t);
return false; return false;
} }
return true; return true;
@@ -998,7 +998,7 @@ public class Loader
} }
if (difference.size() > 0) if (difference.size() > 0)
FMLLog.info("Attempting connection with missing mods %s at %s", difference, side); FMLLog.log.info("Attempting connection with missing mods {} at {}", difference, side);
return true; return true;
} }
@@ -1020,7 +1020,7 @@ public class Loader
return ImmutableList.of(); return ImmutableList.of();
} }
FMLLog.fine("There are %d mappings missing - attempting a mod remap", missingBlocks.size() + missingItems.size()); FMLLog.log.debug("There are {} mappings missing - attempting a mod remap", missingBlocks.size() + missingItems.size());
ArrayListMultimap<String, MissingMapping> missingMappings = ArrayListMultimap.create(); ArrayListMultimap<String, MissingMapping> missingMappings = ArrayListMultimap.create();
for (Map.Entry<ResourceLocation, Integer> mapping : missingBlocks.entrySet()) for (Map.Entry<ResourceLocation, Integer> mapping : missingBlocks.entrySet())
@@ -1047,11 +1047,11 @@ public class Loader
{ {
if (!didWarn) if (!didWarn)
{ {
FMLLog.severe("There are unidentified mappings in this world - we are going to attempt to process anyway"); FMLLog.log.fatal("There are unidentified mappings in this world - we are going to attempt to process anyway");
didWarn = true; didWarn = true;
} }
FMLLog.severe("Unidentified %s: %s, id %d", mapping.type == Type.BLOCK ? "block" : "item", mapping.name, mapping.id); FMLLog.log.fatal("Unidentified {}: {}, id {}", mapping.type == Type.BLOCK ? "block" : "item", mapping.name, mapping.id);
} }
} }
} }
@@ -1090,17 +1090,17 @@ public class Loader
Disableable disableable = mc.canBeDisabled(); Disableable disableable = mc.canBeDisabled();
if (disableable == Disableable.NEVER) if (disableable == Disableable.NEVER)
{ {
FMLLog.info("Cannot disable mod %s - it is never allowed to be disabled", modId); FMLLog.log.info("Cannot disable mod {} - it is never allowed to be disabled", modId);
return; return;
} }
if (disableable == Disableable.DEPENDENCIES) if (disableable == Disableable.DEPENDENCIES)
{ {
FMLLog.info("Cannot disable mod %s - there are dependent mods that require its presence", modId); FMLLog.log.info("Cannot disable mod {} - there are dependent mods that require its presence", modId);
return; return;
} }
if (disableable == Disableable.YES) if (disableable == Disableable.YES)
{ {
FMLLog.info("Runtime disabling mod %s", modId); FMLLog.log.info("Runtime disabling mod {}", modId);
modController.disableMod(mc); modController.disableMod(mc);
List<ModContainer> localmods = Lists.newArrayList(mods); List<ModContainer> localmods = Lists.newArrayList(mods);
localmods.remove(mc); localmods.remove(mc);
@@ -1116,7 +1116,7 @@ public class Loader
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.INFO, e, "An error occurred writing the fml mod states file, your disabled change won't persist"); FMLLog.log.info("An error occurred writing the fml mod states file, your disabled change won't persist", e);
} }
} }
@@ -1134,7 +1134,7 @@ public class Loader
File injectedDepFile = new File(getConfigDir(),"injectedDependencies.json"); File injectedDepFile = new File(getConfigDir(),"injectedDependencies.json");
if (!injectedDepFile.exists()) if (!injectedDepFile.exists())
{ {
FMLLog.getLogger().log(Level.DEBUG, "File {} not found. No dependencies injected", injectedDepFile.getAbsolutePath()); FMLLog.log.debug("File {} not found. No dependencies injected", injectedDepFile.getAbsolutePath());
return; return;
} }
JsonParser parser = new JsonParser(); JsonParser parser = new JsonParser();
@@ -1156,18 +1156,18 @@ public class Loader
} else if (type.equals("after")) { } else if (type.equals("after")) {
injectedAfter.put(modId, VersionParser.parseVersionReference(depObj.get("target").getAsString())); injectedAfter.put(modId, VersionParser.parseVersionReference(depObj.get("target").getAsString()));
} else { } else {
FMLLog.getLogger().log(Level.ERROR, "Invalid dependency type {}", type); FMLLog.log.error("Invalid dependency type {}", type);
throw new RuntimeException("Unable to parse type"); throw new RuntimeException("Unable to parse type");
} }
} }
} }
} catch (Exception e) } catch (Exception e)
{ {
FMLLog.getLogger().log(Level.ERROR, "Unable to parse {} - skipping", injectedDepFile); FMLLog.log.error("Unable to parse {} - skipping", injectedDepFile);
FMLLog.getLogger().throwing(Level.ERROR, e); FMLLog.log.throwing(Level.ERROR, e);
return; return;
} }
FMLLog.getLogger().log(Level.DEBUG, "Loaded {} injected dependencies on modIds: {}", injectedBefore.size(), injectedBefore.keySet()); FMLLog.log.debug("Loaded {} injected dependencies on modIds: {}", injectedBefore.size(), injectedBefore.keySet());
} }
List<ArtifactVersion> getInjectedBefore(String modId) List<ArtifactVersion> getInjectedBefore(String modId)
@@ -83,7 +83,7 @@ public class MetadataCollection
} }
catch (JsonParseException e) catch (JsonParseException e)
{ {
FMLLog.log(Level.ERROR, e, "The mcmod.info file in %s cannot be parsed as valid JSON. It will be ignored", sourceName); FMLLog.log.error("The mcmod.info file in {} cannot be parsed as valid JSON. It will be ignored", sourceName, e);
return new MetadataCollection(); return new MetadataCollection();
} }
catch (Exception e) catch (Exception e)
@@ -110,7 +110,7 @@ public class ModAPIManager {
public void validate(String providedAPI, String apiOwner, String apiVersion) public void validate(String providedAPI, String apiOwner, String apiVersion)
{ {
if (Loader.instance().getModClassLoader().containsSource(this.getSource())) { if (Loader.instance().getModClassLoader().containsSource(this.getSource())) {
FMLLog.bigWarning("The API %s from source %s is loaded from an incompatible classloader. THIS WILL NOT WORK!", providedAPI, this.getSource().getAbsolutePath()); FMLLog.bigWarning("The API {} from source {} is loaded from an incompatible classloader. THIS WILL NOT WORK!", providedAPI, this.getSource().getAbsolutePath());
} }
// TODO Compare this annotation data to the one we first found. Maybe barf if there is inconsistency? // TODO Compare this annotation data to the one we first found. Maybe barf if there is inconsistency?
} }
@@ -180,7 +180,7 @@ public class ModAPIManager {
{ {
continue; continue;
} }
FMLLog.fine("Found API %s (owned by %s providing %s) embedded in %s",apiPackage, apiOwner, providedAPI, embeddedIn); FMLLog.log.debug("Found API {} (owned by {} providing {}) embedded in {}",apiPackage, apiOwner, providedAPI, embeddedIn);
if (!embeddedIn.equals(apiOwner)) if (!embeddedIn.equals(apiOwner))
{ {
container.addAPIReference(embeddedIn); container.addAPIReference(embeddedIn);
@@ -198,7 +198,7 @@ public class ModAPIManager {
List<String> candidateIds = Lists.transform(candidate.getContainedMods(), new ModIdFunction()); List<String> candidateIds = Lists.transform(candidate.getContainedMods(), new ModIdFunction());
if (!candidateIds.contains(container.ownerMod.getLabel()) && !container.currentReferents.containsAll(candidateIds)) if (!candidateIds.contains(container.ownerMod.getLabel()) && !container.currentReferents.containsAll(candidateIds))
{ {
FMLLog.info("Found mod(s) %s containing declared API package %s (owned by %s) without associated API reference",candidateIds, pkg, container.ownerMod); FMLLog.log.info("Found mod(s) {} containing declared API package {} (owned by {}) without associated API reference",candidateIds, pkg, container.ownerMod);
container.addAPIReferences(candidateIds); container.addAPIReferences(candidateIds);
} }
} }
@@ -211,18 +211,18 @@ public class ModAPIManager {
APIContainer parent = apiContainers.get(owner.getLabel()); APIContainer parent = apiContainers.get(owner.getLabel());
if (parent == container) if (parent == container)
{ {
FMLLog.finer("APIContainer %s is it's own parent. skipping", owner); FMLLog.log.trace("APIContainer {} is it's own parent. skipping", owner);
container.markSelfReferenced(); container.markSelfReferenced();
break; break;
} }
FMLLog.finer("Removing upstream parent %s from %s", parent.ownerMod.getLabel(), container); FMLLog.log.trace("Removing upstream parent {} from {}", parent.ownerMod.getLabel(), container);
container.currentReferents.remove(parent.ownerMod.getLabel()); container.currentReferents.remove(parent.ownerMod.getLabel());
container.referredMods.remove(parent.ownerMod); container.referredMods.remove(parent.ownerMod);
owner = parent.ownerMod; owner = parent.ownerMod;
} }
while (apiContainers.containsKey(owner.getLabel())); while (apiContainers.containsKey(owner.getLabel()));
} }
FMLLog.fine("Creating API container dummy for API %s: owner: %s, dependents: %s", container.providedAPI, container.ownerMod, container.referredMods); FMLLog.log.debug("Creating API container dummy for API {}: owner: {}, dependents: {}", container.providedAPI, container.ownerMod, container.referredMods);
} }
} }
@@ -91,7 +91,7 @@ public class ModClassLoader extends URLClassLoader
} }
catch (URISyntaxException e) catch (URISyntaxException e)
{ {
FMLLog.log(Level.ERROR, e, "Unable to process our input to locate the minecraft code"); FMLLog.log.error("Unable to process our input to locate the minecraft code", e);
throw new LoaderException(e); throw new LoaderException(e);
} }
} }
@@ -56,7 +56,7 @@ public class ModContainerFactory
Constructor<? extends ModContainer> constructor = container.getConstructor(new Class<?>[] { String.class, ModCandidate.class, Map.class }); Constructor<? extends ModContainer> constructor = container.getConstructor(new Class<?>[] { String.class, ModCandidate.class, Map.class });
modTypes.put(type, constructor); modTypes.put(type, constructor);
} catch (Exception e) { } catch (Exception e) {
FMLLog.log(Level.ERROR, e, "Critical error : cannot register mod container type %s, it has an invalid constructor"); FMLLog.log.error("Critical error : cannot register mod container type {}, it has an invalid constructor", container.getName(), e);
Throwables.propagate(e); Throwables.propagate(e);
} }
} }
@@ -67,17 +67,17 @@ public class ModContainerFactory
String className = modParser.getASMType().getClassName(); String className = modParser.getASMType().getClassName();
if (modParser.isBaseMod(container.getRememberedBaseMods()) && modClass.matcher(className).find()) if (modParser.isBaseMod(container.getRememberedBaseMods()) && modClass.matcher(className).find())
{ {
FMLLog.severe("Found a BaseMod type mod %s", className); FMLLog.log.fatal("Found a BaseMod type mod {}", className);
FMLLog.severe("This will not be loaded and will be ignored. ModLoader mechanisms are no longer available."); FMLLog.log.fatal("This will not be loaded and will be ignored. ModLoader mechanisms are no longer available.");
} }
else if (modClass.matcher(className).find()) else if (modClass.matcher(className).find())
{ {
FMLLog.fine("Identified a class %s following modloader naming convention but not directly a BaseMod or currently seen subclass", className); FMLLog.log.debug("Identified a class {} following modloader naming convention but not directly a BaseMod or currently seen subclass", className);
container.rememberModCandidateType(modParser); container.rememberModCandidateType(modParser);
} }
else if (modParser.isBaseMod(container.getRememberedBaseMods())) else if (modParser.isBaseMod(container.getRememberedBaseMods()))
{ {
FMLLog.fine("Found a basemod %s of non-standard naming format", className); FMLLog.log.debug("Found a basemod {} of non-standard naming format", className);
container.rememberBaseModType(className); container.rememberBaseModType(className);
} }
@@ -85,17 +85,17 @@ public class ModContainerFactory
{ {
if (modTypes.containsKey(ann.getASMType())) if (modTypes.containsKey(ann.getASMType()))
{ {
FMLLog.fine("Identified a mod of type %s (%s) - loading", ann.getASMType(), className); FMLLog.log.debug("Identified a mod of type {} ({}) - loading", ann.getASMType(), className);
try { try {
ModContainer ret = modTypes.get(ann.getASMType()).newInstance(className, container, ann.getValues()); ModContainer ret = modTypes.get(ann.getASMType()).newInstance(className, container, ann.getValues());
if (!ret.shouldLoadInEnvironment()) if (!ret.shouldLoadInEnvironment())
{ {
FMLLog.fine("Skipping mod %s, container opted to not load.", className); FMLLog.log.debug("Skipping mod {}, container opted to not load.", className);
return null; return null;
} }
return ret; return ret;
} catch (Exception e) { } catch (Exception e) {
FMLLog.log(Level.ERROR, e, "Unable to construct %s container", ann.getASMType().getClassName()); FMLLog.log.error("Unable to construct {} container", ann.getASMType().getClassName(), e);
return null; return null;
} }
} }
@@ -43,7 +43,7 @@ public class ObfuscationReflectionHelper
} }
catch (UnableToAccessFieldException e) catch (UnableToAccessFieldException e)
{ {
FMLLog.log(Level.ERROR, e, "There was a problem getting field index %d from %s", fieldIndex, classToAccess.getName()); FMLLog.log.error("There was a problem getting field index {} from {}", classToAccess.getName(), e);
throw e; throw e;
} }
} }
@@ -68,12 +68,12 @@ public class ObfuscationReflectionHelper
} }
catch (UnableToFindFieldException e) catch (UnableToFindFieldException e)
{ {
FMLLog.log(Level.ERROR,e,"Unable to locate any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName()); FMLLog.log.error("Unable to locate any field {} on type {}", Arrays.toString(fieldNames), classToAccess.getName(), e);
throw e; throw e;
} }
catch (UnableToAccessFieldException e) catch (UnableToAccessFieldException e)
{ {
FMLLog.log(Level.ERROR, e, "Unable to access any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName()); FMLLog.log.error("Unable to access any field {} on type {}", classToAccess.getName(), e);
throw e; throw e;
} }
} }
@@ -86,7 +86,7 @@ public class ObfuscationReflectionHelper
} }
catch (UnableToAccessFieldException e) catch (UnableToAccessFieldException e)
{ {
FMLLog.log(Level.ERROR, e, "There was a problem setting field index %d on type %s", fieldIndex, classToAccess.getName()); FMLLog.log.error("There was a problem setting field index {} on type {}", classToAccess.getName(), e);
throw e; throw e;
} }
} }
@@ -99,12 +99,12 @@ public class ObfuscationReflectionHelper
} }
catch (UnableToFindFieldException e) catch (UnableToFindFieldException e)
{ {
FMLLog.log(Level.ERROR, e, "Unable to locate any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName()); FMLLog.log.error("Unable to locate any field {} on type {}", classToAccess.getName(), e);
throw e; throw e;
} }
catch (UnableToAccessFieldException e) catch (UnableToAccessFieldException e)
{ {
FMLLog.log(Level.ERROR, e, "Unable to set any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName()); FMLLog.log.error("Unable to set any field {} on type {}", classToAccess.getName(), e);
throw e; throw e;
} }
} }
@@ -71,11 +71,11 @@ public class ProgressManager
{ {
long newTime = System.nanoTime(); long newTime = System.nanoTime();
if (bar.timeEachStep) if (bar.timeEachStep)
FMLLog.fine("Bar Step: %s - %s took %.3fs", bar.getTitle(), bar.getMessage(), ((float)(newTime - bar.lastTime) / 1000000 / 1000)); FMLLog.log.debug(String.format("Bar Step: %s - %s took %.3fs", bar.getTitle(), bar.getMessage(), ((float)(newTime - bar.lastTime) / 1000000 / 1000)));
if (bar.getSteps() == 1) if (bar.getSteps() == 1)
FMLLog.fine("Bar Finished: %s - %s took %.3fs", bar.getTitle(), bar.getMessage(), ((float)(newTime - bar.startTime) / 1000000 / 1000)); FMLLog.log.debug(String.format("Bar Finished: %s - %s took %.3fs", bar.getTitle(), bar.getMessage(), ((float)(newTime - bar.startTime) / 1000000 / 1000)));
else else
FMLLog.fine("Bar Finished: %s took %.3fs", bar.getTitle(), ((float)(newTime - bar.startTime) / 1000000 / 1000)); FMLLog.log.debug(String.format("Bar Finished: %s took %.3fs", bar.getTitle(), ((float)(newTime - bar.startTime) / 1000000 / 1000)));
} }
FMLCommonHandler.instance().processWindowMessages(); FMLCommonHandler.instance().processWindowMessages();
} }
@@ -120,7 +120,7 @@ public class ProgressManager
if (timeEachStep && step != 0) if (timeEachStep && step != 0)
{ {
long newTime = System.nanoTime(); long newTime = System.nanoTime();
FMLLog.fine("Bar Step: %s - %s took %.3fs", getTitle(), getMessage(), ((float)(newTime - lastTime) / 1000000 / 1000)); FMLLog.log.debug(String.format("Bar Step: %s - %s took %.3fs", getTitle(), getMessage(), ((float)(newTime - lastTime) / 1000000 / 1000)));
lastTime = newTime; lastTime = newTime;
} }
step++; step++;
@@ -40,7 +40,7 @@ public class ProxyInjector
{ {
public static void inject(ModContainer mod, ASMDataTable data, Side side, ILanguageAdapter languageAdapter) public static void inject(ModContainer mod, ASMDataTable data, Side side, ILanguageAdapter languageAdapter)
{ {
FMLLog.fine("Attempting to inject @SidedProxy classes into %s", mod.getModId()); FMLLog.log.debug("Attempting to inject @SidedProxy classes into {}", mod.getModId());
SetMultimap<String, ASMData> modData = data.getAnnotationsFor(mod); SetMultimap<String, ASMData> modData = data.getAnnotationsFor(mod);
Set<ASMData> mods = modData.get(Mod.class.getName()); Set<ASMData> mods = modData.get(Mod.class.getName());
Set<ASMData> targets = modData.get(SidedProxy.class.getName()); Set<ASMData> targets = modData.get(SidedProxy.class.getName());
@@ -56,13 +56,13 @@ public class ProxyInjector
amodid = ASMDataTable.getOwnerModID(mods, targ); amodid = ASMDataTable.getOwnerModID(mods, targ);
if (Strings.isNullOrEmpty(amodid)) if (Strings.isNullOrEmpty(amodid))
{ {
FMLLog.bigWarning("Could not determine owning mod for @SidedProxy on %s for mod %s", targ.getClassName(), mod.getModId()); FMLLog.bigWarning("Could not determine owning mod for @SidedProxy on {} for mod {}", targ.getClassName(), mod.getModId());
continue; continue;
} }
} }
if (!mod.getModId().equals(amodid)) if (!mod.getModId().equals(amodid))
{ {
FMLLog.fine("Skipping proxy injection for %s.%s since it is not for mod %s", targ.getClassName(), targ.getObjectName(), mod.getModId()); FMLLog.log.debug("Skipping proxy injection for {}.{} since it is not for mod {}", targ.getClassName(), targ.getObjectName(), mod.getModId());
continue; continue;
} }
@@ -71,7 +71,7 @@ public class ProxyInjector
if (target == null) if (target == null)
{ {
// Impossible? // Impossible?
FMLLog.severe("Attempted to load a proxy type into %s.%s but the field was not found", targ.getClassName(), targ.getObjectName()); FMLLog.log.fatal("Attempted to load a proxy type into {}.{} but the field was not found", targ.getClassName(), targ.getObjectName());
throw new LoaderException(String.format("Attempted to load a proxy type into %s.%s but the field was not found", targ.getClassName(), targ.getObjectName())); throw new LoaderException(String.format("Attempted to load a proxy type into %s.%s but the field was not found", targ.getClassName(), targ.getObjectName()));
} }
target.setAccessible(true); target.setAccessible(true);
@@ -86,19 +86,19 @@ public class ProxyInjector
if (languageAdapter.supportsStatics() && (target.getModifiers() & Modifier.STATIC) == 0 ) if (languageAdapter.supportsStatics() && (target.getModifiers() & Modifier.STATIC) == 0 )
{ {
FMLLog.severe("Attempted to load a proxy type %s into %s.%s, but the field is not static", targetType, targ.getClassName(), targ.getObjectName()); FMLLog.log.fatal("Attempted to load a proxy type {} into {}.{}, but the field is not static", targetType, targ.getClassName(), targ.getObjectName());
throw new LoaderException(String.format("Attempted to load a proxy type %s into %s.%s, but the field is not static", targetType, targ.getClassName(), targ.getObjectName())); throw new LoaderException(String.format("Attempted to load a proxy type %s into %s.%s, but the field is not static", targetType, targ.getClassName(), targ.getObjectName()));
} }
if (!target.getType().isAssignableFrom(proxy.getClass())) if (!target.getType().isAssignableFrom(proxy.getClass()))
{ {
FMLLog.severe("Attempted to load a proxy type %s into %s.%s, but the types don't match", targetType, targ.getClassName(), targ.getObjectName()); FMLLog.log.fatal("Attempted to load a proxy type {} into {}.{}, but the types don't match", targetType, targ.getClassName(), targ.getObjectName());
throw new LoaderException(String.format("Attempted to load a proxy type %s into %s.%s, but the types don't match", targetType, targ.getClassName(), targ.getObjectName())); throw new LoaderException(String.format("Attempted to load a proxy type %s into %s.%s, but the types don't match", targetType, targ.getClassName(), targ.getObjectName()));
} }
languageAdapter.setProxy(target, proxyTarget, proxy); languageAdapter.setProxy(target, proxyTarget, proxy);
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "An error occurred trying to load a proxy into %s.%s", targ.getAnnotationInfo(), targ.getClassName(), targ.getObjectName()); FMLLog.log.error("An error occurred trying to load a proxy into {}.{}", targ.getObjectName(), e);
throw new LoaderException(e); throw new LoaderException(e);
} }
} }
@@ -68,7 +68,7 @@ public class StartupQuery {
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {
FMLLog.warning("query interrupted"); FMLLog.log.warn("query interrupted");
abort(); abort();
} }
@@ -120,7 +120,7 @@ public class StartupQuery {
if (result != null && prop != null) if (result != null && prop != null)
{ {
FMLLog.info("Using fml.queryResult %s to answer the following query:\n%s", prop, text); FMLLog.log.info("Using fml.queryResult {} to answer the following query:\n{}", prop, text);
if (prop.equalsIgnoreCase("confirm")) if (prop.equalsIgnoreCase("confirm"))
{ {
@@ -133,7 +133,7 @@ public class StartupQuery {
return; return;
} }
FMLLog.warning("Invalid value for fml.queryResult: %s, expected confirm or cancel", prop); FMLLog.log.warn("Invalid value for fml.queryResult: {}, expected confirm or cancel", prop);
} }
synchronous = false; synchronous = false;
@@ -156,7 +156,7 @@ public class StartupQuery {
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {
FMLLog.warning("query interrupted"); FMLLog.log.warn("query interrupted");
abort(); abort();
} }
} }
@@ -40,12 +40,12 @@ public class TracingPrintStream extends PrintStream {
@Override @Override
public void println(Object o) { public void println(Object o) {
logger.info(getPrefix() + o); logger.info("{}{}", getPrefix(), o);
} }
@Override @Override
public void println(String s) { public void println(String s) {
logger.info(getPrefix() + s); logger.info("{}{}", getPrefix(), s);
} }
private String getPrefix() { private String getPrefix() {
@@ -102,10 +102,10 @@ public class ZipperUtil {
} }
catch (IOException e) catch (IOException e)
{ {
FMLLog.log(Level.WARN, e, "World backup failed."); FMLLog.log.warn("World backup failed.", e);
throw e; throw e;
} }
FMLLog.info("World backup created at %s.", zip.getCanonicalPath()); FMLLog.log.info("World backup created at {}.", zip.getCanonicalPath());
} }
} }
@@ -30,7 +30,6 @@ import java.util.jar.JarFile;
import net.minecraftforge.common.util.Java6Utils; import net.minecraftforge.common.util.Java6Utils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.Level;
import net.minecraft.launchwrapper.LaunchClassLoader; import net.minecraft.launchwrapper.LaunchClassLoader;
import net.minecraftforge.fml.common.CertificateHelper; import net.minecraftforge.fml.common.CertificateHelper;
@@ -38,13 +37,14 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
import net.minecraftforge.fml.common.patcher.ClassPatchManager; import net.minecraftforge.fml.common.patcher.ClassPatchManager;
import net.minecraftforge.fml.relauncher.FMLLaunchHandler; import net.minecraftforge.fml.relauncher.FMLLaunchHandler;
import net.minecraftforge.fml.relauncher.FMLRelaunchLog;
import net.minecraftforge.fml.relauncher.IFMLCallHook; import net.minecraftforge.fml.relauncher.IFMLCallHook;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import static net.minecraftforge.fml.common.FMLLog.log;
public class FMLSanityChecker implements IFMLCallHook public class FMLSanityChecker implements IFMLCallHook
{ {
private static final String FMLFINGERPRINT = "51:0A:FB:4C:AF:A4:A0:F2:F5:CF:C5:0E:B4:CC:3C:30:24:4A:E3:8E".toLowerCase().replace(":", ""); private static final String FMLFINGERPRINT = "51:0A:FB:4C:AF:A4:A0:F2:F5:CF:C5:0E:B4:CC:3C:30:24:4A:E3:8E".toLowerCase().replace(":", "");
@@ -72,17 +72,17 @@ public class FMLSanityChecker implements IFMLCallHook
String fingerprint = CertificateHelper.getFingerprint(cert); String fingerprint = CertificateHelper.getFingerprint(cert);
if (fingerprint.equals(FMLFINGERPRINT)) if (fingerprint.equals(FMLFINGERPRINT))
{ {
FMLRelaunchLog.info("Found valid fingerprint for FML. Certificate fingerprint %s", fingerprint); log.info("Found valid fingerprint for FML. Certificate fingerprint {}", fingerprint);
goodFML = true; goodFML = true;
} }
else if (fingerprint.equals(FORGEFINGERPRINT)) else if (fingerprint.equals(FORGEFINGERPRINT))
{ {
FMLRelaunchLog.info("Found valid fingerprint for Minecraft Forge. Certificate fingerprint %s", fingerprint); log.info("Found valid fingerprint for Minecraft Forge. Certificate fingerprint {}", fingerprint);
goodFML = true; goodFML = true;
} }
else else
{ {
FMLRelaunchLog.severe("Found invalid fingerprint for FML: %s", fingerprint); log.error("Found invalid fingerprint for FML: {}", fingerprint);
} }
} }
} }
@@ -134,7 +134,7 @@ public class FMLSanityChecker implements IFMLCallHook
String fingerprint = CertificateHelper.getFingerprint(cert); String fingerprint = CertificateHelper.getFingerprint(cert);
if (fingerprint.equals(MCFINGERPRINT)) if (fingerprint.equals(MCFINGERPRINT))
{ {
FMLRelaunchLog.info("Found valid fingerprint for Minecraft. Certificate fingerprint %s", fingerprint); log.info("Found valid fingerprint for Minecraft. Certificate fingerprint {}", fingerprint);
goodMC = true; goodMC = true;
} }
} }
@@ -142,7 +142,7 @@ public class FMLSanityChecker implements IFMLCallHook
} }
catch (Throwable e) catch (Throwable e)
{ {
FMLRelaunchLog.log(Level.ERROR, e, "A critical error occurred trying to read the minecraft jar file"); log.error("A critical error occurred trying to read the minecraft jar file", e);
} }
finally finally
{ {
@@ -155,11 +155,11 @@ public class FMLSanityChecker implements IFMLCallHook
} }
if (!goodMC) if (!goodMC)
{ {
FMLRelaunchLog.severe("The minecraft jar %s appears to be corrupt! There has been CRITICAL TAMPERING WITH MINECRAFT, it is highly unlikely minecraft will work! STOP NOW, get a clean copy and try again!",codeSource.getLocation().getFile()); log.error("The minecraft jar {} appears to be corrupt! There has been CRITICAL TAMPERING WITH MINECRAFT, it is highly unlikely minecraft will work! STOP NOW, get a clean copy and try again!", codeSource.getLocation().getFile());
if (!Boolean.parseBoolean(System.getProperty("fml.ignoreInvalidMinecraftCertificates","false"))) if (!Boolean.parseBoolean(System.getProperty("fml.ignoreInvalidMinecraftCertificates","false")))
{ {
FMLRelaunchLog.severe("For your safety, FML will not launch minecraft. You will need to fetch a clean version of the minecraft jar file"); log.error("For your safety, FML will not launch minecraft. You will need to fetch a clean version of the minecraft jar file");
FMLRelaunchLog.severe("Technical information: The class net.minecraft.client.ClientBrandRetriever should have been associated with the minecraft jar file, " + log.error("Technical information: The class net.minecraft.client.ClientBrandRetriever should have been associated with the minecraft jar file, " +
"and should have returned us a valid, intact minecraft jar location. This did not work. Either you have modified the minecraft jar file (if so " + "and should have returned us a valid, intact minecraft jar location. This did not work. Either you have modified the minecraft jar file (if so " +
"run the forge installer again), or you are using a base editing jar that is changing this class (and likely others too). If you REALLY " + "run the forge installer again), or you are using a base editing jar that is changing this class (and likely others too). If you REALLY " +
"want to run minecraft in this configuration, add the flag -Dfml.ignoreInvalidMinecraftCertificates=true to the 'JVM settings' in your launcher profile."); "want to run minecraft in this configuration, add the flag -Dfml.ignoreInvalidMinecraftCertificates=true to the 'JVM settings' in your launcher profile.");
@@ -167,13 +167,13 @@ public class FMLSanityChecker implements IFMLCallHook
} }
else else
{ {
FMLRelaunchLog.severe("FML has been ordered to ignore the invalid or missing minecraft certificate. This is very likely to cause a problem!"); log.error("FML has been ordered to ignore the invalid or missing minecraft certificate. This is very likely to cause a problem!");
FMLRelaunchLog.severe("Technical information: ClientBrandRetriever was at %s, there were %d certificates for it", codeSource.getLocation(), certCount); log.error("Technical information: ClientBrandRetriever was at {}, there were {} certificates for it", codeSource.getLocation(), certCount);
} }
} }
if (!goodFML) if (!goodFML)
{ {
FMLRelaunchLog.severe("FML appears to be missing any signature data. This is not a good thing"); log.error("FML appears to be missing any signature data. This is not a good thing");
} }
return null; return null;
} }
@@ -19,6 +19,7 @@
package net.minecraftforge.fml.common.asm.transformers; package net.minecraftforge.fml.common.asm.transformers;
import net.minecraftforge.fml.common.FMLLog;
import static org.objectweb.asm.Opcodes.ACC_FINAL; import static org.objectweb.asm.Opcodes.ACC_FINAL;
import static org.objectweb.asm.Opcodes.ACC_PRIVATE; import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
import static org.objectweb.asm.Opcodes.ACC_PROTECTED; import static org.objectweb.asm.Opcodes.ACC_PROTECTED;
@@ -43,7 +44,6 @@ import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import net.minecraft.launchwrapper.IClassTransformer; import net.minecraft.launchwrapper.IClassTransformer;
import net.minecraftforge.fml.relauncher.FMLRelaunchLog;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassReader;
@@ -125,7 +125,7 @@ public class AccessTransformer implements IClassTransformer
rulesResource = Resources.getResource(rulesFile); rulesResource = Resources.getResource(rulesFile);
} }
processATFile(Resources.asCharSource(rulesResource, Charsets.UTF_8)); processATFile(Resources.asCharSource(rulesResource, Charsets.UTF_8));
FMLRelaunchLog.fine("Loaded %d rules from AccessTransformer config file %s", modifiers.size(), rulesFile); FMLLog.log.debug("Loaded {} rules from AccessTransformer config file {}", modifiers.size(), rulesFile);
} }
protected void processATFile(CharSource rulesResource) throws IOException protected void processATFile(CharSource rulesResource) throws IOException
{ {
@@ -173,7 +173,7 @@ public class AccessTransformer implements IClassTransformer
} }
String className = parts.get(1).replace('/', '.'); String className = parts.get(1).replace('/', '.');
modifiers.put(className, m); modifiers.put(className, m);
if (DEBUG) FMLRelaunchLog.fine("AT RULE: %s %s %s (type %s)", toBinary(m.targetAccess), m.name, m.desc, className); if (DEBUG) FMLLog.log.debug("AT RULE: {} {} {} (type {})", toBinary(m.targetAccess), m.name, m.desc, className);
return true; return true;
} }
}); });
@@ -187,7 +187,7 @@ public class AccessTransformer implements IClassTransformer
if (DEBUG) if (DEBUG)
{ {
FMLRelaunchLog.fine("Considering all methods and fields on %s (%s)", transformedName, name); FMLLog.log.debug("Considering all methods and fields on {} ({})", transformedName, name);
} }
ClassNode classNode = new ClassNode(); ClassNode classNode = new ClassNode();
@@ -202,7 +202,7 @@ public class AccessTransformer implements IClassTransformer
classNode.access = getFixedAccess(classNode.access, m); classNode.access = getFixedAccess(classNode.access, m);
if (DEBUG) if (DEBUG)
{ {
FMLRelaunchLog.fine("Class: %s %s -> %s", name, toBinary(m.oldAccess), toBinary(m.newAccess)); FMLLog.log.debug("Class: {} {} -> {}", name, toBinary(m.oldAccess), toBinary(m.newAccess));
} }
continue; continue;
} }
@@ -215,7 +215,7 @@ public class AccessTransformer implements IClassTransformer
n.access = getFixedAccess(n.access, m); n.access = getFixedAccess(n.access, m);
if (DEBUG) if (DEBUG)
{ {
FMLRelaunchLog.fine("Field: %s.%s %s -> %s", name, n.name, toBinary(m.oldAccess), toBinary(m.newAccess)); FMLLog.log.debug("Field: {}.{} {} -> {}", name, n.name, toBinary(m.oldAccess), toBinary(m.newAccess));
} }
if (!m.name.equals("*")) if (!m.name.equals("*"))
@@ -251,7 +251,7 @@ public class AccessTransformer implements IClassTransformer
if (DEBUG) if (DEBUG)
{ {
FMLRelaunchLog.fine("Method: %s.%s%s %s -> %s", name, n.name, n.desc, toBinary(m.oldAccess), toBinary(m.newAccess)); FMLLog.log.debug("Method: {}.{}{} {} -> {}", name, n.name, n.desc, toBinary(m.oldAccess), toBinary(m.newAccess));
} }
if (!m.name.equals("*")) if (!m.name.equals("*"))
@@ -58,7 +58,7 @@ public class BlamingTransformer implements IClassTransformer
{ {
naughtyClasses.add(cls); naughtyClasses.add(cls);
naughtyMods.add(modId); naughtyMods.add(modId);
FMLLog.severe("Unsupported class format in mod %s: class %s", modId, cls); FMLLog.log.fatal("Unsupported class format in mod {}: class {}", modId, cls);
} }
public static class VersionVisitor extends ClassVisitor public static class VersionVisitor extends ClassVisitor
@@ -39,7 +39,7 @@ public class ItemStackTransformer implements IClassTransformer {
@Override @Override
public byte[] transform(String name, String transformedName, byte[] basicClass) { public byte[] transform(String name, String transformedName, byte[] basicClass) {
if (!"net.minecraft.item.ItemStack".equals(name)) if (!"net.minecraft.item.ItemStack".equals(transformedName))
return basicClass; return basicClass;
ClassNode classNode = new ClassNode(); ClassNode classNode = new ClassNode();
ClassReader classReader = new ClassReader(basicClass); ClassReader classReader = new ClassReader(basicClass);
@@ -26,11 +26,11 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import net.minecraft.launchwrapper.IClassTransformer; import net.minecraft.launchwrapper.IClassTransformer;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModAPIManager; import net.minecraftforge.fml.common.ModAPIManager;
import net.minecraftforge.fml.common.discovery.ASMDataTable; import net.minecraftforge.fml.common.discovery.ASMDataTable;
import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData; import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData;
import net.minecraftforge.fml.relauncher.FMLRelaunchLog;
import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter; import org.objectweb.asm.ClassWriter;
@@ -64,17 +64,17 @@ public class ModAPITransformer implements IClassTransformer {
ClassReader classReader = new ClassReader(basicClass); ClassReader classReader = new ClassReader(basicClass);
classReader.accept(classNode, 0); classReader.accept(classNode, 0);
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - found optionals for class %s - processing", name); if (logDebugInfo) FMLLog.log.trace("Optional removal - found optionals for class {} - processing", name);
for (ASMData optional : optionals.get(lookupName)) for (ASMData optional : optionals.get(lookupName))
{ {
String modId = (String) optional.getAnnotationInfo().get("modid"); String modId = (String) optional.getAnnotationInfo().get("modid");
if (Loader.isModLoaded(modId) || ModAPIManager.INSTANCE.hasAPI(modId)) if (Loader.isModLoaded(modId) || ModAPIManager.INSTANCE.hasAPI(modId))
{ {
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal skipped - mod present %s", modId); if (logDebugInfo) FMLLog.log.trace("Optional removal skipped - mod present {}", modId);
continue; continue;
} }
if (logDebugInfo) FMLRelaunchLog.finer("Optional on %s triggered - mod missing %s", name, modId); if (logDebugInfo) FMLLog.log.trace("Optional on {} triggered - mod missing {}", name, modId);
if (optional.getAnnotationInfo().containsKey("iface")) if (optional.getAnnotationInfo().containsKey("iface"))
{ {
@@ -88,7 +88,7 @@ public class ModAPITransformer implements IClassTransformer {
} }
} }
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - class %s processed", name); if (logDebugInfo) FMLLog.log.trace("Optional removal - class {} processed", name);
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS); ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
classNode.accept(writer); classNode.accept(writer);
@@ -109,11 +109,11 @@ public class ModAPITransformer implements IClassTransformer {
if (methodDescriptor.equals(method.name+method.desc)) if (methodDescriptor.equals(method.name+method.desc))
{ {
iterator.remove(); iterator.remove();
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - method %s removed", methodDescriptor); if (logDebugInfo) FMLLog.log.debug("Optional removal - method {} removed", methodDescriptor);
return; return;
} }
} }
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - method %s NOT removed - not found", methodDescriptor); if (logDebugInfo) FMLLog.log.debug("Optional removal - method {} NOT removed - not found", methodDescriptor);
} }
private void stripInterface(ClassNode classNode, String interfaceName, boolean stripRefs) private void stripInterface(ClassNode classNode, String interfaceName, boolean stripRefs)
@@ -126,28 +126,28 @@ public class ModAPITransformer implements IClassTransformer {
final RemovingSignatureWriter signatureWriter = new RemovingSignatureWriter(ifaceName); final RemovingSignatureWriter signatureWriter = new RemovingSignatureWriter(ifaceName);
sr.accept(signatureWriter); sr.accept(signatureWriter);
classNode.signature = signatureWriter.toString(); classNode.signature = signatureWriter.toString();
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s removed from type signature"); if (logDebugInfo) FMLLog.log.debug("Optional removal - interface {} removed from type signature", interfaceName);
} }
if (found && logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s removed", interfaceName); if (found && logDebugInfo) FMLLog.log.debug("Optional removal - interface {} removed", interfaceName);
if (!found && logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s NOT removed - not found", interfaceName); if (!found && logDebugInfo) FMLLog.log.debug("Optional removal - interface {} NOT removed - not found", interfaceName);
if (found && stripRefs) if (found && stripRefs)
{ {
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s - stripping method signature references", interfaceName); if (logDebugInfo) FMLLog.log.debug("Optional removal - interface {} - stripping method signature references", interfaceName);
for (Iterator<MethodNode> iterator = classNode.methods.iterator(); iterator.hasNext();) for (Iterator<MethodNode> iterator = classNode.methods.iterator(); iterator.hasNext();)
{ {
MethodNode node = iterator.next(); MethodNode node = iterator.next();
if (node.desc.contains(ifaceName)) if (node.desc.contains(ifaceName))
{ {
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s - stripping method containing reference %s", interfaceName, node.name); if (logDebugInfo) FMLLog.log.debug("Optional removal - interface {} - stripping method containing reference {}", interfaceName, node.name);
iterator.remove(); iterator.remove();
} }
} }
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s - all method signature references stripped", interfaceName); if (logDebugInfo) FMLLog.log.debug("Optional removal - interface {} - all method signature references stripped", interfaceName);
} }
else if (found) else if (found)
{ {
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s - NOT stripping method signature references", interfaceName); if (logDebugInfo) FMLLog.log.debug("Optional removal - interface {} - NOT stripping method signature references", interfaceName);
} }
} }
@@ -27,7 +27,7 @@ import java.util.jar.JarEntry;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import java.util.jar.Manifest; import java.util.jar.Manifest;
import net.minecraftforge.fml.relauncher.FMLRelaunchLog; import net.minecraftforge.fml.common.FMLLog;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
@@ -54,7 +54,7 @@ public class ModAccessTransformer extends AccessTransformer {
int added = getModifiers().size() - old_count; int added = getModifiers().size() - old_count;
if (added > 0) if (added > 0)
{ {
FMLRelaunchLog.fine("Loaded %d rules from AccessTransformer mod jar file %s\n", added, e.getKey()); FMLLog.log.debug("Loaded {} rules from AccessTransformer mod jar file {}\n", added, e.getKey());
} }
} }
} }
@@ -22,7 +22,7 @@ package net.minecraftforge.fml.common.asm.transformers;
import org.objectweb.asm.*; import org.objectweb.asm.*;
import net.minecraft.launchwrapper.IClassTransformer; import net.minecraft.launchwrapper.IClassTransformer;
import net.minecraftforge.fml.relauncher.FMLRelaunchLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.relauncher.FMLSecurityManager.ExitTrappedException; import net.minecraftforge.fml.relauncher.FMLSecurityManager.ExitTrappedException;
public class TerminalTransformer implements IClassTransformer public class TerminalTransformer implements IClassTransformer
@@ -81,11 +81,11 @@ public class TerminalTransformer implements IClassTransformer
{ {
if (warn) if (warn)
{ {
FMLRelaunchLog.warning("============================================================="); FMLLog.log.warn("=============================================================");
FMLRelaunchLog.warning("MOD HAS DIRECT REFERENCE System.exit() THIS IS NOT ALLOWED REROUTING TO FML!"); FMLLog.log.warn("MOD HAS DIRECT REFERENCE System.exit() THIS IS NOT ALLOWED REROUTING TO FML!");
FMLRelaunchLog.warning("Offender: %s.%s%s", ExitVisitor.this.clsName, mName, mDesc); FMLLog.log.warn("Offender: {}.{}{}", ExitVisitor.this.clsName, mName, mDesc);
FMLRelaunchLog.warning("Use FMLCommonHandler.exitJava instead"); FMLLog.log.warn("Use FMLCommonHandler.exitJava instead");
FMLRelaunchLog.warning("============================================================="); FMLLog.log.warn("=============================================================");
} }
owner = ExitVisitor.callbackOwner; owner = ExitVisitor.callbackOwner;
name = "systemExitCalled"; name = "systemExitCalled";
@@ -94,11 +94,11 @@ public class TerminalTransformer implements IClassTransformer
{ {
if (warn) if (warn)
{ {
FMLRelaunchLog.warning("============================================================="); FMLLog.log.warn("=============================================================");
FMLRelaunchLog.warning("MOD HAS DIRECT REFERENCE Runtime.exit() THIS IS NOT ALLOWED REROUTING TO FML!"); FMLLog.log.warn("MOD HAS DIRECT REFERENCE Runtime.exit() THIS IS NOT ALLOWED REROUTING TO FML!");
FMLRelaunchLog.warning("Offender: %s.%s%s", ExitVisitor.this.clsName, mName, mDesc); FMLLog.log.warn("Offender: {}.{}{}", ExitVisitor.this.clsName, mName, mDesc);
FMLRelaunchLog.warning("Use FMLCommonHandler.exitJava instead"); FMLLog.log.warn("Use FMLCommonHandler.exitJava instead");
FMLRelaunchLog.warning("============================================================="); FMLLog.log.warn("=============================================================");
} }
opcode = Opcodes.INVOKESTATIC; opcode = Opcodes.INVOKESTATIC;
owner = ExitVisitor.callbackOwner; owner = ExitVisitor.callbackOwner;
@@ -109,11 +109,11 @@ public class TerminalTransformer implements IClassTransformer
{ {
if (warn) if (warn)
{ {
FMLRelaunchLog.warning("============================================================="); FMLLog.log.warn("=============================================================");
FMLRelaunchLog.warning("MOD HAS DIRECT REFERENCE Runtime.halt() THIS IS NOT ALLOWED REROUTING TO FML!"); FMLLog.log.warn("MOD HAS DIRECT REFERENCE Runtime.halt() THIS IS NOT ALLOWED REROUTING TO FML!");
FMLRelaunchLog.warning("Offendor: %s.%s%s", ExitVisitor.this.clsName, mName, mDesc); FMLLog.log.warn("Offendor: {}.{}{}", ExitVisitor.this.clsName, mName, mDesc);
FMLRelaunchLog.warning("Use FMLCommonHandler.exitJava instead"); FMLLog.log.warn("Use FMLCommonHandler.exitJava instead");
FMLRelaunchLog.warning("============================================================="); FMLLog.log.warn("=============================================================");
} }
opcode = Opcodes.INVOKESTATIC; opcode = Opcodes.INVOKESTATIC;
owner = ExitVisitor.callbackOwner; owner = ExitVisitor.callbackOwner;
@@ -29,10 +29,10 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import net.minecraft.launchwrapper.LaunchClassLoader; import net.minecraft.launchwrapper.LaunchClassLoader;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.patcher.ClassPatchManager; import net.minecraftforge.fml.common.patcher.ClassPatchManager;
import net.minecraftforge.fml.relauncher.FMLRelaunchLog;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.message.Message;
import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassReader;
import org.objectweb.asm.commons.Remapper; import org.objectweb.asm.commons.Remapper;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
@@ -112,7 +112,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
} }
catch (IOException ioe) catch (IOException ioe)
{ {
FMLRelaunchLog.log(Level.ERROR, "An error occurred loading the deobfuscation map data", ioe); FMLLog.log.error("An error occurred loading the deobfuscation map data", ioe);
} }
methodNameMaps = Maps.newHashMapWithExpectedSize(rawMethodMaps.size()); methodNameMaps = Maps.newHashMapWithExpectedSize(rawMethodMaps.size());
fieldNameMaps = Maps.newHashMapWithExpectedSize(rawFieldMaps.size()); fieldNameMaps = Maps.newHashMapWithExpectedSize(rawFieldMaps.size());
@@ -133,12 +133,12 @@ public class FMLDeobfuscatingRemapper extends Remapper {
LZMAInputSupplier zis = new LZMAInputSupplier(classData); LZMAInputSupplier zis = new LZMAInputSupplier(classData);
CharSource srgSource = zis.asCharSource(Charsets.UTF_8); CharSource srgSource = zis.asCharSource(Charsets.UTF_8);
srgList = srgSource.readLines(); srgList = srgSource.readLines();
FMLRelaunchLog.fine("Loading deobfuscation resource %s with %d records", deobfFileName, srgList.size()); FMLLog.log.debug("Loading deobfuscation resource {} with {} records", deobfFileName, srgList.size());
} }
else else
{ {
srgList = Files.readLines(new File(gradleStartProp), Charsets.UTF_8); srgList = Files.readLines(new File(gradleStartProp), Charsets.UTF_8);
FMLRelaunchLog.fine("Loading deobfuscation resource %s with %d records", gradleStartProp, srgList.size()); FMLLog.log.debug("Loading deobfuscation resource {} with {} records", gradleStartProp, srgList.size());
} }
rawMethodMaps = Maps.newHashMap(); rawMethodMaps = Maps.newHashMap();
@@ -166,7 +166,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
} }
catch (IOException ioe) catch (IOException ioe)
{ {
FMLRelaunchLog.log(Level.ERROR, ioe, "An error occurred loading the deobfuscation map data"); FMLLog.log.error("An error occurred loading the deobfuscation map data", ioe);
} }
methodNameMaps = Maps.newHashMapWithExpectedSize(rawMethodMaps.size()); methodNameMaps = Maps.newHashMapWithExpectedSize(rawMethodMaps.size());
fieldNameMaps = Maps.newHashMapWithExpectedSize(rawFieldMaps.size()); fieldNameMaps = Maps.newHashMapWithExpectedSize(rawFieldMaps.size());
@@ -234,7 +234,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
} }
catch (IOException e) catch (IOException e)
{ {
FMLRelaunchLog.log(Level.ERROR,e, "A critical exception occurred reading a class file %s", owner); FMLLog.log.error("A critical exception occurred reading a class file {}", owner, e);
} }
return null; return null;
} }
@@ -390,7 +390,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
if (DUMP_FIELD_MAPS) if (DUMP_FIELD_MAPS)
{ {
FMLRelaunchLog.finer("Field map for %s : %s", className, fieldNameMaps.get(className)); FMLLog.log.trace("Field map for {} : {}", className, fieldNameMaps.get(className));
} }
} }
return fieldNameMaps.get(className); return fieldNameMaps.get(className);
@@ -407,7 +407,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
} }
if (DUMP_METHOD_MAPS) if (DUMP_METHOD_MAPS)
{ {
FMLRelaunchLog.finer("Method map for %s : %s", className, methodNameMaps.get(className)); FMLLog.log.trace("Method map for {} : {}", className, methodNameMaps.get(className));
} }
} }
Loaded 100 of 180 files, more files were not shown because too many files have changed in this diff. Show more