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

109 lines
4.3 KiB
Diff

--- ../src-base/minecraft/net/minecraft/potion/Potion.java
+++ ../src-work/minecraft/net/minecraft/potion/Potion.java
@@ -22,9 +22,9 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class Potion
+public class Potion extends net.minecraftforge.registries.IForgeRegistryEntry.Impl<Potion>
{
- public static final RegistryNamespaced<ResourceLocation, Potion> field_188414_b = new RegistryNamespaced<ResourceLocation, 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;
@@ -222,7 +222,6 @@
return this.field_76417_J;
}
- @SideOnly(Side.CLIENT)
public boolean func_76398_f()
{
return this.field_76418_K;
@@ -293,7 +292,85 @@
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) { }
+
+ /**
+ * 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();
+ }
+
+ /* ======================================== FORGE END =====================================*/
+
+ @SideOnly(Side.CLIENT)
public boolean func_188408_i()
{
return this.field_188415_h;