Skip to content

Commit f9305bf

Browse files
committed
warn when aspect ratio cant be applied
1 parent b94603e commit f9305bf

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • src/main/java/com/cleanroommc/modularui/drawable

src/main/java/com/cleanroommc/modularui/drawable/Icon.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.cleanroommc.modularui.drawable;
22

3+
import com.cleanroommc.modularui.ModularUI;
34
import com.cleanroommc.modularui.api.IJsonSerializable;
45
import com.cleanroommc.modularui.api.drawable.IDrawable;
56
import com.cleanroommc.modularui.api.drawable.IIcon;
@@ -9,6 +10,7 @@
910
import com.cleanroommc.modularui.utils.JsonHelper;
1011
import com.cleanroommc.modularui.widget.sizer.Box;
1112

13+
import net.minecraftforge.fml.relauncher.FMLLaunchHandler;
1214
import net.minecraftforge.fml.relauncher.Side;
1315
import net.minecraftforge.fml.relauncher.SideOnly;
1416

@@ -79,6 +81,10 @@ public void draw(GuiContext context, int x, int y, int width, int height, Widget
7981
} else if (this.height <= 0) {
8082
// width is set, so adjust height to width
8183
height = (int) (width / this.aspectRatio);
84+
} else if (FMLLaunchHandler.isDeobfuscatedEnvironment()) {
85+
ModularUI.LOGGER.error("Aspect ration in Icon can't be applied when width and height are specified");
86+
// remove aspect ratio to avoid log spamming, it does nothing in the current state anyway
87+
this.aspectRatio = 0;
8288
}
8389
}
8490
// apply alignment

0 commit comments

Comments
 (0)