Files
MinecraftForge/patches/minecraft/net/minecraft/potion/Potion.java.patch
T

85 lines
3.3 KiB
Diff

--- ../src-base/minecraft/net/minecraft/potion/Potion.java
+++ ../src-work/minecraft/net/minecraft/potion/Potion.java
@@ -21,9 +21,9 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class Potion
+public class Potion extends net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl<Potion>
{
- public static final RegistryNamespaced<ResourceLocation, Potion> field_188414_b = new RegistryNamespaced();
+ public static final RegistryNamespaced<ResourceLocation, Potion> field_188414_b = net.minecraftforge.fml.common.registry.GameData.getPotionRegistry();
private final Map<IAttribute, AttributeModifier> field_111188_I = Maps.<IAttribute, AttributeModifier>newHashMap();
private final boolean field_76418_K;
private final int field_76414_N;
@@ -195,7 +195,6 @@
return this.field_76417_J;
}
- @SideOnly(Side.CLIENT)
public boolean func_76398_f()
{
return this.field_76418_K;
@@ -266,7 +265,61 @@
return p_111183_2_.func_111164_d() * (double)(p_111183_1_ + 1);
}
+ /* ======================================== FORGE START =====================================*/
+
+ /**
+ * 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
+ */
@SideOnly(Side.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
+ */
+ @SideOnly(Side.CLIENT)
+ public void renderHUDEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc, float alpha) { }
+
+ /* ======================================== FORGE END =====================================*/
+
+ @SideOnly(Side.CLIENT)
public boolean func_188408_i()
{
return this.field_188415_h;