Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 83643f0

Browse files
committed
feat: 1.20.4 update, added Armor Trims hide flag, fixed unremovable lore bug
1 parent 829e582 commit 83643f0

25 files changed

+81
-57
lines changed

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ allprojects {
6666
}
6767

6868
githubRelease {
69-
setToken(findProperty("github_token") as String ?: System.getenv("GITHUB_TOKEN"))
69+
setToken(findProperty("github_token") as String ?: System.getenv("GITHUB_TOKEN") ?: "")
7070
setOwner("skyecodes")
7171
setRepo("IBE-Editor")
7272
setTagName("${version}+${rootProject.major_minecraft_version}")
73-
setTargetCommitish(findProperty("git_branch") as String ?: System.getenv("GIT_BRANCH"))
73+
setTargetCommitish(findProperty("git_branch") as String ?: System.getenv("GIT_BRANCH") ?: "")
7474
setReleaseName("IBE Editor v${version} for Minecraft ${rootProject.minecraft_version}")
7575
setBody(versionInfoChangelog)
7676
setPrerelease(versionInfoType == "alpha")

common/build.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ architectury {
88
common("fabric", "forge", "neoforge")
99
}
1010

11+
loom {
12+
accessWidenerPath = file("src/main/resources/ibeeditor.accesswidener")
13+
}
14+
1115
publishing {
1216
publications {
1317
mavenCommon(MavenPublication) {

common/src/main/java/com/github/franckyi/guapi/base/theme/vanilla/delegate/AbstractVanillaListNodeSkinDelegate.java

+16-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import com.github.franckyi.guapi.api.node.ListNode;
1010
import com.github.franckyi.guapi.api.node.Node;
1111
import com.github.franckyi.guapi.api.util.ScreenEventType;
12-
import com.mojang.blaze3d.vertex.PoseStack;
1312
import net.minecraft.client.Minecraft;
1413
import net.minecraft.client.gui.GuiGraphics;
1514
import net.minecraft.client.gui.components.AbstractSelectionList;
@@ -25,7 +24,7 @@ public abstract class AbstractVanillaListNodeSkinDelegate<N extends ListNode<E>,
2524
protected boolean shouldChangeFocus = false;
2625

2726
public AbstractVanillaListNodeSkinDelegate(N node) {
28-
super(Minecraft.getInstance(), 0, 0, 0, 0, node.getItemHeight());
27+
super(Minecraft.getInstance(), 0, 0, 0, node.getItemHeight());
2928
this.node = node;
3029
Runnable rs = this::shouldRefreshSize;
3130
node.xProperty().addListener(rs);
@@ -42,7 +41,7 @@ public AbstractVanillaListNodeSkinDelegate(N node) {
4241
}
4342

4443
@Override
45-
public void updateNarration(NarrationElementOutput narrationElementOutput) {
44+
protected void updateWidgetNarration(NarrationElementOutput narrationElementOutput) {
4645
}
4746

4847
public N getNode() {
@@ -130,15 +129,23 @@ protected void shouldChangeFocus() {
130129
}
131130

132131
protected void refreshSize() {
133-
width = node.getFullWidth();
134-
height = node.getFullHeight();
135-
x0 = node.getLeft();
136-
x1 = node.getRight();
137-
y0 = node.getTop();
138-
y1 = node.getBottom();
132+
width = node.getWidth();
133+
height = node.getHeight();
134+
setX(node.getX());
135+
setY(node.getY());
139136
shouldRefreshSize = false;
140137
}
141138

139+
@Override
140+
public int getRight() {
141+
return node.getRight();
142+
}
143+
144+
@Override
145+
public int getBottom() {
146+
return node.getBottom();
147+
}
148+
142149
protected void refreshList() {
143150
clearEntries();
144151
createList();

common/src/main/java/com/github/franckyi/guapi/base/theme/vanilla/delegate/VanillaCheckBoxSkinDelegate.java

+1-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.github.franckyi.guapi.api.node.CheckBox;
44
import com.mojang.blaze3d.platform.GlStateManager;
55
import com.mojang.blaze3d.systems.RenderSystem;
6-
import com.mojang.blaze3d.vertex.PoseStack;
76
import net.minecraft.client.Minecraft;
87
import net.minecraft.client.gui.GuiGraphics;
98
import net.minecraft.client.gui.components.Checkbox;
@@ -15,7 +14,7 @@ public class VanillaCheckBoxSkinDelegate extends Checkbox implements VanillaWidg
1514
protected final CheckBox node;
1615

1716
public VanillaCheckBoxSkinDelegate(CheckBox node) {
18-
super(node.getX(), node.getY(), node.getWidth(), node.getHeight(), node.getLabel(), node.isChecked());
17+
super(node.getX(), node.getY(), node.getLabel(), Minecraft.getInstance().font, node.isChecked(), (c, b) -> node.setChecked(b));
1918
this.node = node;
2019
initLabeledWidget(node);
2120
node.checkedProperty().addListener(this::onModelChange);
@@ -27,12 +26,6 @@ private void onModelChange() {
2726
}
2827
}
2928

30-
@Override
31-
public void onPress() {
32-
super.onPress();
33-
node.setChecked(selected());
34-
}
35-
3629
@Override
3730
public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float delta) {
3831
Minecraft mc = Minecraft.getInstance();

common/src/main/java/com/github/franckyi/guapi/base/theme/vanilla/delegate/VanillaListViewSkinDelegate.java

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.github.franckyi.guapi.api.node.ListView;
44
import com.github.franckyi.guapi.api.node.Node;
5-
import com.mojang.blaze3d.vertex.PoseStack;
65
import net.minecraft.client.gui.GuiGraphics;
76

87
public class VanillaListViewSkinDelegate<E> extends AbstractVanillaListNodeSkinDelegate<ListView<E>, E, VanillaListViewSkinDelegate.NodeEntry<E>> {

common/src/main/java/com/github/franckyi/guapi/base/theme/vanilla/delegate/VanillaTreeViewSkinDelegate.java

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.github.franckyi.guapi.api.node.Node;
44
import com.github.franckyi.guapi.api.node.TexturedButton;
55
import com.github.franckyi.guapi.api.node.TreeView;
6-
import com.mojang.blaze3d.vertex.PoseStack;
76
import net.minecraft.client.gui.GuiGraphics;
87
import net.minecraft.resources.ResourceLocation;
98

common/src/main/java/com/github/franckyi/ibeeditor/client/screen/controller/selection/color/TextColorSelectionScreenController.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import net.minecraft.ChatFormatting;
66
import net.minecraft.network.chat.TextColor;
77

8-
import static com.github.franckyi.guapi.api.GuapiHelper.*;
8+
import static com.github.franckyi.guapi.api.GuapiHelper.text;
99

1010
public class TextColorSelectionScreenController extends ColorSelectionScreenController<TextColorSelectionScreenView> {
1111
public TextColorSelectionScreenController(ColorSelectionScreenModel model, TextColorSelectionScreenView view) {
@@ -17,8 +17,8 @@ protected void updateExample() {
1717
super.updateExample();
1818
var text = text("Test ")
1919
.append(text("Test").withStyle(ChatFormatting.BOLD))
20-
.append(text(" Test").withStyle(ChatFormatting.ITALIC))
21-
.withStyle(style -> style.withColor(TextColor.parseColor(model.getHexValue())));
20+
.append(text(" Test").withStyle(ChatFormatting.ITALIC));
21+
TextColor.parseColor(model.getHexValue()).result().ifPresent(color -> text.withStyle(style -> style.withColor(color)));
2222
view.getExampleLabel().setLabel(text);
2323
view.getExampleLabel().getTooltip().setAll(text);
2424
}

common/src/main/java/com/github/franckyi/ibeeditor/client/screen/model/category/item/ItemDisplayCategoryModel.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import net.minecraft.nbt.Tag;
1212
import net.minecraft.network.chat.Component;
1313
import net.minecraft.network.chat.MutableComponent;
14-
import net.minecraft.network.chat.contents.LiteralContents;
14+
import net.minecraft.network.chat.contents.PlainTextContents;
1515
import net.minecraft.world.item.ItemStack;
1616

1717
public class ItemDisplayCategoryModel extends ItemEditorCategoryModel {
@@ -58,7 +58,7 @@ public void apply() {
5858
super.apply();
5959
if (!newLore.isEmpty()) {
6060
getOrCreateDisplay().put("Lore", newLore);
61-
} else if (getOrCreateTag().contains("Lore")) {
61+
} else if (getOrCreateDisplay().contains("Lore")) {
6262
getOrCreateDisplay().remove("Lore");
6363
}
6464
if (getDisplay().isEmpty()) {
@@ -73,7 +73,7 @@ private MutableComponent getItemName() {
7373

7474
private void setItemName(MutableComponent value) {
7575
if (!value.getString().isEmpty()) {
76-
if (!value.getSiblings().isEmpty() && value.getContents() instanceof LiteralContents lc && lc.text().isEmpty()) {
76+
if (!value.getSiblings().isEmpty() && value.getContents() instanceof PlainTextContents lc && lc.text().isEmpty()) {
7777
value.withStyle(style -> style.withItalic(false));
7878
}
7979
getOrCreateDisplay().putString(ItemStack.TAG_DISPLAY_NAME, Component.Serializer.toJson(value));
@@ -83,7 +83,7 @@ private void setItemName(MutableComponent value) {
8383
}
8484

8585
private void addLore(MutableComponent value) {
86-
if (!value.getString().isEmpty() && value.getContents() instanceof LiteralContents lc && lc.text().isEmpty() && !value.getSiblings().isEmpty()) {
86+
if (!value.getString().isEmpty() && value.getContents() instanceof PlainTextContents lc && lc.text().isEmpty() && !value.getSiblings().isEmpty()) {
8787
value.withStyle(style -> style.withItalic(false).withColor(ChatFormatting.WHITE));
8888
}
8989
newLore.add(StringTag.valueOf(Component.Serializer.toJson(value)));

common/src/main/java/com/github/franckyi/ibeeditor/client/screen/model/category/item/ItemHideFlagsCategoryModel.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private void setFlag(HideFlag flag, boolean value) {
4141
}
4242

4343
public enum HideFlag {
44-
ENCHANTMENTS, ATTRIBUTE_MODIFIERS, UNBREAKABLE, CAN_DESTROY, CAN_PLACE_ON, OTHER, DYED;
44+
ENCHANTMENTS, ATTRIBUTE_MODIFIERS, UNBREAKABLE, CAN_DESTROY, CAN_PLACE_ON, OTHER, DYED, ARMOR_TRIMS;
4545

4646
public MutableComponent getName() {
4747
return ModTexts.gui(name().toLowerCase(Locale.ROOT));

common/src/main/java/com/github/franckyi/ibeeditor/client/util/texteditor/ColorFormatting.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void setColor(String color) {
2323

2424
@Override
2525
public void apply(MutableComponent text) {
26-
text.withStyle(style -> style.withColor(TextColor.parseColor(color)));
26+
TextColor.parseColor(color).result().ifPresent(color -> text.withStyle(style -> style.withColor(color)));
2727
}
2828

2929
@Override

common/src/main/java/com/github/franckyi/ibeeditor/client/util/texteditor/TextEditorInputParser.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.github.franckyi.ibeeditor.client.util.texteditor;
22

33
import net.minecraft.network.chat.MutableComponent;
4-
import net.minecraft.network.chat.contents.LiteralContents;
4+
import net.minecraft.network.chat.contents.PlainTextContents;
55

66
import java.util.ArrayList;
77
import java.util.List;
@@ -13,7 +13,7 @@ public class TextEditorInputParser {
1313
private int index;
1414

1515
public void parse(MutableComponent text) {
16-
if (text.getContents() instanceof LiteralContents lc) {
16+
if (text.getContents() instanceof PlainTextContents lc) {
1717
int length = lc.text().length();
1818
if (text.getStyle().isBold()) {
1919
addStyleFormatting(new StyleFormatting(index, index + length, StyleType.BOLD));

common/src/main/java/com/github/franckyi/ibeeditor/common/ModTexts.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import net.minecraft.network.chat.MutableComponent;
55
import net.minecraft.network.chat.TextColor;
66

7-
import static com.github.franckyi.guapi.api.GuapiHelper.*;
7+
import static com.github.franckyi.guapi.api.GuapiHelper.text;
8+
import static com.github.franckyi.guapi.api.GuapiHelper.translated;
89

910
public final class ModTexts {
1011
public static final MutableComponent ADD = translated("ibeeditor.gui.add").withStyle(ChatFormatting.GREEN);
@@ -134,7 +135,9 @@ public static MutableComponent choose(MutableComponent with) {
134135
}
135136

136137
public static MutableComponent addTag(String color, String with) {
137-
return translated("ibeeditor.gui.add_tag", text(with)).withStyle(style -> style.withColor(TextColor.parseColor(color)));
138+
var text = translated("ibeeditor.gui.add_tag", text(with));
139+
TextColor.parseColor(color).result().ifPresent(c -> text.withStyle(style -> style.withColor(c)));
140+
return text;
138141
}
139142

140143
public static MutableComponent editorTitle(MutableComponent type) {

common/src/main/java/com/github/franckyi/ibeeditor/mixin/AbstractSelectionListMixin.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515

1616
@Mixin(AbstractSelectionList.class)
1717
public abstract class AbstractSelectionListMixin<E> {
18-
@Shadow
19-
protected int y0;
20-
2118
@Shadow
2219
protected int headerHeight;
2320

@@ -45,7 +42,7 @@ private void getEntryAtPositionFix(double x, double y, CallbackInfoReturnable<E>
4542
ListNode<?> node = AbstractVanillaListNodeSkinDelegate.class.cast(this).getNode();
4643
int k = node.getLeft();
4744
int l = node.getRight();
48-
int m = Mth.floor(y - (double) y0) - this.headerHeight + (int) getScrollAmount() - 4;
45+
int m = Mth.floor(y - (double) node.getY()) - this.headerHeight + (int) getScrollAmount() - 4;
4946
int n = m / itemHeight;
5047
cir.setReturnValue(x < (double) getScrollbarPosition() && x >= (double) k && x <= (double) l && n >= 0 && m >= 0 && n < getItemCount() ? children().get(n) : null);
5148
}

common/src/main/resources/assets/ibeeditor/lang/en_us.json

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"ibeeditor.gui.can_place_on": "Can Place On",
8787
"ibeeditor.gui.other": "Other",
8888
"ibeeditor.gui.dyed": "Dyed",
89+
"ibeeditor.gui.armor_trims": "Armor Trims",
8990
"ibeeditor.gui.hide_other_tooltip.0": "Hides:",
9091
"ibeeditor.gui.hide_other_tooltip.1": "- Potion effects",
9192
"ibeeditor.gui.hide_other_tooltip.2": "- Shield pattern",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
accessWidener v1 named
2+
3+
mutable field net/minecraft/client/gui/components/MultilineTextField width I
4+
accessible method net/minecraft/client/gui/components/Checkbox <init> (IILnet/minecraft/network/chat/Component;Lnet/minecraft/client/gui/Font;ZLnet/minecraft/client/gui/components/Checkbox$OnValueChange;)V
5+
extendable method net/minecraft/client/gui/components/AbstractWidget render (Lnet/minecraft/client/gui/GuiGraphics;IIF)V

fabric/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jar {
6262
sourcesJar {
6363
def commonSources = project(":common").sourcesJar
6464
dependsOn commonSources
65+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
6566
from commonSources.archiveFile.map { zipTree(it) }
6667
}
6768

fabric/src/main/resources/fabric.mod.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"depends": {
3535
"fabricloader": ">=0.14",
3636
"fabric": "*",
37-
"minecraft": ">=1.20.2",
37+
"minecraft": ">=1.20.4",
3838
"java": ">=17"
3939
},
4040
"custom": {
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
accessWidener v1 named
22

3-
mutable field net/minecraft/client/gui/components/MultilineTextField width I
3+
mutable field net/minecraft/client/gui/components/MultilineTextField width I
4+
accessible method net/minecraft/client/gui/components/Checkbox <init> (IILnet/minecraft/network/chat/Component;Lnet/minecraft/client/gui/Font;ZLnet/minecraft/client/gui/components/Checkbox$OnValueChange;)V
5+
extendable method net/minecraft/client/gui/components/AbstractWidget render (Lnet/minecraft/client/gui/GuiGraphics;IIF)V
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
public-f net.minecraft.client.gui.components.MultilineTextField f_238603_ # width
1+
public-f net.minecraft.client.gui.components.MultilineTextField f_238603_ # width
2+
public net.minecraft.client.gui.components.Checkbox <init>(IILnet/minecraft/network/chat/Component;Lnet/minecraft/client/gui/Font;ZLnet/minecraft/client/gui/components/Checkbox$OnValueChange;)V
3+
public-f net.minecraft.client.gui.components.AbstractWidget m_88315_(Lnet/minecraft/client/gui/GuiGraphics;IIF)V # render

forge/src/main/resources/META-INF/mods.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
modLoader = "javafml"
2-
loaderVersion = "[48,)"
2+
loaderVersion = "[49,)"
33
license = "MIT"
44
issueTrackerURL = "https://github.com/skyecodes/IBE-Editor/issues"
55
logoFile = "logo.png"
@@ -17,13 +17,13 @@ description = "Simple GUI Mod to edit an item, a block or an entity in your curr
1717
[[dependencies.ibeeditor]]
1818
modId = "forge"
1919
mandatory = true
20-
versionRange = "[48,)"
20+
versionRange = "[49,)"
2121
ordering = "NONE"
2222
side = "BOTH"
2323

2424
[[dependencies.ibeeditor]]
2525
modId = "minecraft"
2626
mandatory = true
27-
versionRange = "[1.20.2,)"
27+
versionRange = "[1.20.4,)"
2828
ordering = "NONE"
2929
side = "BOTH"

forge_update.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"1.20.1-latest": "2.2.3",
77
"1.20.1-recommended": "2.2.3",
88
"1.20.2-latest": "2.2.6",
9-
"1.20.2-recommended": "2.2.6"
9+
"1.20.2-recommended": "2.2.6",
10+
"1.20.4-latest": "2.2.7",
11+
"1.20.4-recommended": "2.2.7"
1012
}
1113
}

gradle.properties

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
org.gradle.jvmargs=-Xmx4G
33
org.gradle.daemon=false
44
# IBE Editor
5-
minecraft_version=1.20.2
5+
minecraft_version=1.20.4
66
archives_base_name=IBEEditor
7-
mod_version=2.2.6
7+
mod_version=2.2.7
88
maven_group=com.github.franckyi.ibeeditor
99
# Fabric https://fabricmc.net/develop/
10-
fabric_loader_version=0.14.24
11-
fabric_api_version=0.90.7+1.20.2
12-
modmenu_version=8.0.0
10+
fabric_loader_version=0.15.2
11+
fabric_api_version=0.91.2+1.20.4
12+
modmenu_version=9.0.0-pre.1
1313
# Forge https://files.minecraftforge.net/
14-
forge_version=48.0.40
14+
forge_version=49.0.9
1515
# NeoForge https://neoforged.net/
16-
neoforge_version=20.2.62-beta
16+
neoforge_version=20.4.24-beta
1717
# Build and release info
1818
java_version=17
19-
major_minecraft_version=1.20.2
20-
compatible_minecraft_versions=["1.20.2"]
19+
major_minecraft_version=1.20.4
20+
compatible_minecraft_versions=["1.20.4"]
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
public-f net.minecraft.client.gui.components.MultilineTextField f_238603_ # width
1+
public-f net.minecraft.client.gui.components.MultilineTextField width
2+
public net.minecraft.client.gui.components.Checkbox <init>(IILnet/minecraft/network/chat/Component;Lnet/minecraft/client/gui/Font;ZLnet/minecraft/client/gui/components/Checkbox$OnValueChange;)V
3+
public-f net.minecraft.client.gui.components.AbstractWidget render(Lnet/minecraft/client/gui/GuiGraphics;IIF)V

0 commit comments

Comments
 (0)