ForgePatch/patches/minecraft/net/minecraft/potion/Potion.java.patch

93 lines
4.0 KiB
Diff

--- a/net/minecraft/potion/Potion.java
+++ b/net/minecraft/potion/Potion.java
@@ -23,8 +23,8 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class Potion {
- public static final RegistryNamespaced<ResourceLocation, Potion> field_188414_b = new RegistryNamespaced<ResourceLocation, Potion>();
+public class Potion extends net.minecraftforge.registries.ForgeRegistryEntry<Potion> {
+ public static final RegistryNamespaced<ResourceLocation, Potion> field_188414_b = net.minecraftforge.registries.GameData.getWrapper(Potion.class);
private final Map<IAttribute, AttributeModifier> field_111188_I = Maps.<IAttribute, AttributeModifier>newHashMap();
private final boolean field_76418_K;
private final int field_76414_N;
@@ -162,7 +162,6 @@
return this.field_76417_J;
}
- @OnlyIn(Dist.CLIENT)
public boolean func_76398_f() {
return this.field_76418_K;
}
@@ -259,4 +258,70 @@
private static void func_210759_a(int p_210759_0_, String p_210759_1_, Potion p_210759_2_) {
field_188414_b.func_177775_a(p_210759_0_, new ResourceLocation(p_210759_1_), p_210759_2_);
}
+
+ /**
+ * If the Potion effect should be displayed in the players inventory
+ * @param effect the active PotionEffect
+ * @return true to display it (default), false to hide it.
+ */
+ public boolean shouldRender(PotionEffect effect) { return true; }
+
+ /**
+ * If the standard PotionEffect text (name and duration) should be drawn when this potion is active.
+ * @param effect the active PotionEffect
+ * @return true to draw the standard text
+ */
+ public boolean shouldRenderInvText(PotionEffect effect) { return true; }
+
+ /**
+ * If the Potion effect should be displayed in the player's ingame HUD
+ * @param effect the active PotionEffect
+ * @return true to display it (default), false to hide it.
+ */
+ public boolean shouldRenderHUD(PotionEffect effect) { return true; }
+
+ /**
+ * Called to draw the this Potion onto the player's inventory when it's active.
+ * This can be used to e.g. render Potion icons from your own texture.
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @param effect the active PotionEffect
+ * @param mc the Minecraft instance, for convenience
+ */
+ @OnlyIn(Dist.CLIENT)
+ public void renderInventoryEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc) { }
+
+ /**
+ * Called to draw the this Potion onto the player's ingame HUD when it's active.
+ * This can be used to e.g. render Potion icons from your own texture.
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @param effect the active PotionEffect
+ * @param mc the Minecraft instance, for convenience
+ * @param alpha the alpha value, blinks when the potion is about to run out
+ */
+ @OnlyIn(Dist.CLIENT)
+ public void renderHUDEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc, float alpha) { }
+
+ /**
+ * Get a fresh list of items that can cure this Potion.
+ * All new PotionEffects created from this Potion will call this to initialize the default curative items
+ * @see PotionEffect#getCurativeItems
+ * @return A list of items that can cure this Potion
+ */
+ public java.util.List<net.minecraft.item.ItemStack> getCurativeItems() {
+ java.util.ArrayList<net.minecraft.item.ItemStack> ret = new java.util.ArrayList<net.minecraft.item.ItemStack>();
+ 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();
+ }
}