Files
CatServer/patches/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch
2019-02-24 22:29:41 +08:00

41 lines
2.0 KiB
Diff

--- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java
@@ -28,13 +28,19 @@
protected void updateActivePotionEffects()
{
- if (this.mc.player.getActivePotionEffects().isEmpty())
+ boolean hasVisibleEffect = false;
+ for(PotionEffect potioneffect : this.mc.player.getActivePotionEffects()) {
+ Potion potion = potioneffect.getPotion();
+ if(potion.shouldRender(potioneffect)) { hasVisibleEffect = true; break; }
+ }
+ if (this.mc.player.getActivePotionEffects().isEmpty() || !hasVisibleEffect)
{
this.guiLeft = (this.width - this.xSize) / 2;
this.hasActivePotionEffects = false;
}
else
{
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.PotionShiftEvent(this))) this.guiLeft = (this.width - this.xSize) / 2; else
this.guiLeft = 160 + (this.width - this.xSize - 200) / 2;
this.hasActivePotionEffects = true;
}
@@ -71,6 +77,7 @@
for (PotionEffect potioneffect : Ordering.natural().sortedCopy(collection))
{
Potion potion = potioneffect.getPotion();
+ if(!potion.shouldRender(potioneffect)) continue;
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(INVENTORY_BACKGROUND);
this.drawTexturedModalRect(i, j, 0, 166, 140, 32);
@@ -81,6 +88,8 @@
this.drawTexturedModalRect(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18);
}
+ potion.renderInventoryEffect(i, j, potioneffect, mc);
+ if (!potion.shouldRenderInvText(potioneffect)) { j += l; continue; }
String s1 = I18n.format(potion.getName());
if (potioneffect.getAmplifier() == 1)