Skip to content

Commit

Permalink
Fix acquired morphs desync in survival when keepMorphs is false
Browse files Browse the repository at this point in the history
  • Loading branch information
asanetargoss committed Feb 28, 2021
1 parent 2b54cef commit 184b4ac
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package mchorse.metamorph.client.gui.survival;

import java.io.IOException;
import java.util.List;

import org.lwjgl.input.Keyboard;

import mchorse.mclib.client.gui.framework.GuiBase;
import mchorse.mclib.client.gui.framework.elements.GuiElement;
import mchorse.mclib.client.gui.framework.elements.GuiScrollElement;
import mchorse.mclib.client.gui.framework.elements.buttons.GuiButtonElement;
import mchorse.mclib.client.gui.framework.elements.buttons.GuiToggleElement;
import mchorse.mclib.client.gui.framework.elements.input.GuiKeybindElement;
import mchorse.mclib.client.gui.framework.elements.utils.GuiDraw;
import mchorse.mclib.client.gui.utils.Elements;
import mchorse.mclib.client.gui.utils.GuiUtils;
import mchorse.mclib.client.gui.utils.keys.IKey;
import mchorse.metamorph.ClientProxy;
Expand All @@ -27,10 +31,6 @@
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;

import java.io.IOException;

import org.lwjgl.input.Keyboard;

/**
* Survival morph menu GUI
*
Expand Down Expand Up @@ -105,8 +105,11 @@ public void setupSections()
EntityPlayer player = Minecraft.getMinecraft().player;
boolean creative = player.isCreative();
boolean allowed = Metamorph.allowMorphingIntoCategoryMorphs.get();
IMorphing cap = Morphing.get(player);
List<AbstractMorph> capAcquiredMorphs = cap == null ? null : cap.getAcquiredMorphs();

if (this.creative != creative || this.allowed != allowed || creative || this.morphs.sections.isEmpty())
if (this.creative != creative || this.allowed != allowed || creative || this.morphs.sections.isEmpty() ||
(this.morphs == null || this.morphs.acquired == null || this.morphs.acquired.getMorphs() != capAcquiredMorphs))
{
this.creative = creative;
this.allowed = allowed;
Expand Down

0 comments on commit 184b4ac

Please sign in to comment.