Merge pull request #2239 from bonii-xx/potionhiding
Add shouldRender() to Potions that allows to hide them completely in …
This commit is contained in:
commit
c6d64cd94a
3 changed files with 60 additions and 2 deletions
|
@ -1,6 +1,28 @@
|
|||
--- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java
|
||||
+++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java
|
||||
@@ -80,6 +80,8 @@
|
||||
@@ -27,7 +27,12 @@
|
||||
|
||||
protected void func_175378_g()
|
||||
{
|
||||
- if (!this.field_146297_k.field_71439_g.func_70651_bq().isEmpty())
|
||||
+ boolean hasVisibleEffect = false;
|
||||
+ for(PotionEffect potioneffect : this.field_146297_k.field_71439_g.func_70651_bq()) {
|
||||
+ Potion potion = Potion.field_76425_a[potioneffect.func_76456_a()];
|
||||
+ if(potion.shouldRender(potioneffect)) { hasVisibleEffect = true; break; }
|
||||
+ }
|
||||
+ if (!this.field_146297_k.field_71439_g.func_70651_bq().isEmpty() && hasVisibleEffect)
|
||||
{
|
||||
this.field_147003_i = 160 + (this.field_146294_l - this.field_146999_f - 200) / 2;
|
||||
this.field_147045_u = true;
|
||||
@@ -70,6 +75,7 @@
|
||||
for (PotionEffect potioneffect : this.field_146297_k.field_71439_g.func_70651_bq())
|
||||
{
|
||||
Potion potion = Potion.field_76425_a[potioneffect.func_76456_a()];
|
||||
+ if(!potion.shouldRender(potioneffect)) continue;
|
||||
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.field_146297_k.func_110434_K().func_110577_a(field_147001_a);
|
||||
this.func_73729_b(i, j, 0, 166, 140, 32);
|
||||
@@ -80,6 +86,8 @@
|
||||
this.func_73729_b(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
public boolean func_76398_f()
|
||||
{
|
||||
return this.field_76418_K;
|
||||
@@ -310,4 +313,27 @@
|
||||
@@ -310,4 +313,34 @@
|
||||
{
|
||||
return p_111183_2_.func_111164_d() * (double)(p_111183_1_ + 1);
|
||||
}
|
||||
|
@ -59,6 +59,13 @@
|
|||
+ /* ======================================== 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
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package net.minecraftforge.debug;
|
||||
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
@Mod( modid = NoPotionEffectRenderTest.modID, name = "No Potion Effect Render Test", version = "0.0.0" )
|
||||
public class NoPotionEffectRenderTest {
|
||||
public static final String modID = "nopotioneffect";
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
TestPotion INSTANCE = new TestPotion(30, new ResourceLocation(modID, "test_potion"), false, 0xff00ff);
|
||||
}
|
||||
|
||||
public static class TestPotion extends Potion {
|
||||
|
||||
public TestPotion(int potionID, ResourceLocation location, boolean badEffect, int potionColor) {
|
||||
super(potionID, location, badEffect, potionColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender(PotionEffect effect) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue