Skip to content

Commit

Permalink
23w46a
Browse files Browse the repository at this point in the history
  • Loading branch information
zml2008 committed Nov 16, 2023
1 parent c28f188 commit bbd4963
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 20 deletions.
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ ansi = "1.0.3"
autoService = "1.1.1"
checkstyle = "10.12.4"
examination = "1.3.0"
fabricApi = "0.90.1+1.20.3"
fabricLoader = "0.14.23"
fabricApi = "0.90.9+1.20.3"
fabricLoader = "0.14.24"
indra = "3.1.3"
junit = "5.10.0"
minecraft = "23w41a"
minecraft = "23w46a"
parchment = "1.20.2:2023.10.08"
vineflower = "1.9.3"
spotless = "6.21.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.kyori.adventure.platform.fabric.impl.accessor.minecraft.network.chat;
package net.kyori.adventure.platform.fabric.impl.accessor.minecraft.commands;

import com.google.gson.stream.JsonReader;
import net.minecraft.network.chat.Component;
import net.minecraft.commands.ParserUtils;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(Component.Serializer.class)
public interface Component_SerializerAccess {
@Mixin(ParserUtils.class)
public interface ParserUtilsAccess {
// @formatter:off
@Invoker("getPos") static int getPos(final JsonReader reader) {
throw new AssertionError();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"minecraft.network.ConnectionAccess",
"minecraft.network.ServerCommonPacketListenerImplAccess",
"minecraft.network.ServerGamePacketListenerImplAccess",
"minecraft.network.chat.Component_SerializerAccess",
"minecraft.commands.ParserUtilsAccess",
"minecraft.world.level.LevelAccess"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import java.util.List;
import net.kyori.adventure.Adventure;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.platform.fabric.impl.accessor.minecraft.network.chat.Component_SerializerAccess;
import net.kyori.adventure.platform.fabric.impl.accessor.minecraft.commands.ParserUtilsAccess;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
Expand Down Expand Up @@ -170,7 +170,7 @@ public enum Format {
ReadResult parse(final String allInput) throws Exception {
try (final JsonReader json = new JsonReader(new java.io.StringReader(allInput))) {
final Component ret = GsonComponentSerializer.gson().serializer().fromJson(json, Component.class);
return new ReadResult(ret, Component_SerializerAccess.getPos(json));
return new ReadResult(ret, ParserUtilsAccess.getPos(json));
}
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of adventure-platform-fabric, licensed under the MIT License.
*
* Copyright (c) 2020-2022 KyoriPowered
* Copyright (c) 2020-2023 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -82,15 +82,10 @@ public static Checkbox checkbox(final Component label, final BooleanConsumer whe
*/
public static Checkbox checkbox(final Component label, final boolean initialState, final BooleanConsumer whenPressed) {
final net.minecraft.network.chat.Component mcComponent = FabricClientAudiences.of().toNative(label);
final int textWidth = Minecraft.getInstance().font.width(mcComponent);
return new Checkbox(0, 0, IN_GROUP_SPACING * 2 + textWidth + BUTTON_SIZE /* checkbox width */, BUTTON_SIZE, mcComponent, initialState) {
@Override
public void onPress() {
super.onPress();

whenPressed.accept(this.selected());
}
};
return Checkbox.builder(mcComponent, Minecraft.getInstance().font)
.selected(initialState)
.onValueChange((checkbox, bl) -> whenPressed.accept(bl))
.build();
}

private Widgets() {
Expand Down

0 comments on commit bbd4963

Please sign in to comment.