Add Ability to Override PotionEffect Default Sort Order (#4172)

This commit is contained in:
Samuel-Harbord authored and LexManos committed 2017-08-09 15:22:09 -05:00
1 parent ee449e427c
commit ffb71dce8c
2 files changed
+21 -1

No files matched your search

@@ -20,7 +20,7 @@
public boolean func_76398_f()
{
return this.field_76418_K;
@@ -293,7 +292,74 @@
@@ -293,7 +292,85 @@
return p_111183_2_.func_111164_d() * (double)(p_111183_1_ + 1);
}
@@ -88,6 +88,17 @@
+ ret.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.field_151117_aB));
+ return ret;
+ }
+
+ /**
+ * Used for determining {@code PotionEffect} sort order in GUIs.
+ * Defaults to the {@code PotionEffect}'s liquid color.
+ * @param potionEffect the {@code PotionEffect} instance containing the potion
+ * @return a value used to sort {@code PotionEffect}s in GUIs
+ */
+ public int getGuiSortColor(PotionEffect potionEffect)
+ {
+ return this.func_76401_j();
+ }
+
+ /* ======================================== FORGE END =====================================*/
+
@@ -41,6 +41,15 @@
}
}
@@ -232,7 +236,7 @@
public int compareTo(PotionEffect p_compareTo_1_)
{
int i = 32147;
- return (this.func_76459_b() <= 32147 || p_compareTo_1_.func_76459_b() <= 32147) && (!this.func_82720_e() || !p_compareTo_1_.func_82720_e()) ? ComparisonChain.start().compare(Boolean.valueOf(this.func_82720_e()), Boolean.valueOf(p_compareTo_1_.func_82720_e())).compare(this.func_76459_b(), p_compareTo_1_.func_76459_b()).compare(this.func_188419_a().func_76401_j(), p_compareTo_1_.func_188419_a().func_76401_j()).result() : ComparisonChain.start().compare(Boolean.valueOf(this.func_82720_e()), Boolean.valueOf(p_compareTo_1_.func_82720_e())).compare(this.func_188419_a().func_76401_j(), p_compareTo_1_.func_188419_a().func_76401_j()).result();
+ return (this.func_76459_b() <= 32147 || p_compareTo_1_.func_76459_b() <= 32147) && (!this.func_82720_e() || !p_compareTo_1_.func_82720_e()) ? ComparisonChain.start().compare(Boolean.valueOf(this.func_82720_e()), Boolean.valueOf(p_compareTo_1_.func_82720_e())).compare(this.func_76459_b(), p_compareTo_1_.func_76459_b()).compare(this.func_188419_a().getGuiSortColor(this), p_compareTo_1_.func_188419_a().getGuiSortColor(p_compareTo_1_)).result() : ComparisonChain.start().compare(Boolean.valueOf(this.func_82720_e()), Boolean.valueOf(p_compareTo_1_.func_82720_e())).compare(this.func_188419_a().getGuiSortColor(this), p_compareTo_1_.func_188419_a().getGuiSortColor(p_compareTo_1_)).result();
}
@SideOnly(Side.CLIENT)
@@ -240,4 +244,85 @@
{
return this.field_100013_f;