package info.u_team.u_team_core.gui.elements;

import net.minecraft.util.ResourceLocation;

public class ToggleImageButton extends ImageButton {
	
	protected ResourceLocation defaultResource;
	protected ResourceLocation toggleResource;
	
	protected boolean toggled;
	
	public ToggleImageButton(int x, int y, int width, int height, ResourceLocation defaultResource, ResourceLocation toggleResource) {
		this(x, y, width, height, defaultResource, toggleResource, EMTPY_PRESSABLE);
	}
	
	public ToggleImageButton(int x, int y, int width, int height, ResourceLocation defaultResource, ResourceLocation toggleResource, IPressable pressable) {
		super(x, y, width, height, defaultResource, pressable);
		this.defaultResource = defaultResource;
		this.toggleResource = toggleResource;
	}
	
	public ResourceLocation getDefaultResource() {
		return defaultResource;
	}
	
	public void setDefaultResource(ResourceLocation defaultResource) {
		this.defaultResource = defaultResource;
	}
	
	public ResourceLocation getToggleResource() {
		return toggleResource;
	}
	
	public void setToggleResource(ResourceLocation toggleResource) {
		this.toggleResource = toggleResource;
	}
	
	public boolean isToggled() {
		return toggled;
	}
	
	public void toggle() {
		toggle(!toggled);
	}
	
	public void toggle(boolean value) {
		toggled = value;
		setResource(toggled ? toggleResource : defaultResource);
	}
	
	@Override
	public void onPress() {
		toggle();
		super.onPress();
	}
}

@@ -1404,23 +1404,30 @@
 ic void 
-onPress
+func_230930_b_
 () %7B%0A%09%09t
@@ -1447,15 +1447,22 @@
 per.
-onPress
+func_230930_b_
 ();%0A

Fix toggle image button