Fix Recipe Toast crash when granted more than 5000 recipes (#4124)

This commit is contained in:
mezz committed 2017-07-07 23:47:58 -07:00
1 parent 3847a2cf5d
commit 02ef4155c8
1 file changed
+11
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/gui/toasts/RecipeToast.java
+++ ../src-work/minecraft/net/minecraft/client/gui/toasts/RecipeToast.java
@@ -43,7 +43,7 @@
p_193653_1_.func_192989_b().field_71466_p.func_78276_b(I18n.func_135052_a("recipe.toast.title"), 30, 7, -11534256);
p_193653_1_.func_192989_b().field_71466_p.func_78276_b(I18n.func_135052_a("recipe.toast.description"), 30, 18, -16777216);
RenderHelper.func_74520_c();
- p_193653_1_.func_192989_b().func_175599_af().func_184391_a((EntityLivingBase)null, this.field_193666_c.get((int)(p_193653_2_ / (5000L / (long)this.field_193666_c.size()) % (long)this.field_193666_c.size())), 8, 8);
+ p_193653_1_.func_192989_b().func_175599_af().func_184391_a((EntityLivingBase)null, this.field_193666_c.get((int)(p_193653_2_ * (long)this.field_193666_c.size() / 5000L % (long)this.field_193666_c.size())), 8, 8); //Forge: fix math so that it doesn't divide by 0 when there are more than 5000 recipes
return p_193653_2_ - this.field_193667_d >= 5000L ? IToast.Visibility.HIDE : IToast.Visibility.SHOW;
}
}