Skip to content

Commit

Permalink
Properly Refresh Renames in Adv Mem Card
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Dec 25, 2024
1 parent f2d6af4 commit 7283ea2
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import kotlin.jvm.functions.Function0;

/**
* Trims text before renaming, handles add as input/output.
* Trims text before renaming, handles add as input/output, properly refreshes renames in gui.
*/
@Mixin(value = WidgetP2PColumn.class, remap = false)
public class WidgetP2PColumnMixin {
Expand All @@ -42,6 +42,15 @@ private void trimText(CallbackInfo ci) {
renameBar.setText(renameBar.getText().trim());
}

@Inject(method = "finishRename",
at = @At(value = "INVOKE",
target = "Lnet/minecraftforge/fml/common/network/simpleimpl/SimpleNetworkWrapper;sendToServer(Lnet/minecraftforge/fml/common/network/simpleimpl/IMessage;)V",
shift = At.Shift.AFTER),
require = 1)
private void refreshRenameInGui(CallbackInfo ci) {
renameBar.info.setName(renameBar.getText());
}

@Inject(method = "onBindButtonClicked", at = @At("HEAD"), cancellable = true)
private void handleAddAs(InfoWrapper info, CallbackInfo ci) {
if (infos.getSelectedInfo() == null) return;
Expand Down

0 comments on commit 7283ea2

Please sign in to comment.