-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also sort the shrinked directories to the top of the suggestion list (like in file viewers) 46b changed the exact code I am modifying so this one doesn't work on 46a Signed-off-by: liach <[email protected]>
- Loading branch information
Showing
13 changed files
with
70 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/com/github/liachmodded/pathsuggestion/RefreshableCommandSuggestor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.github.liachmodded.pathsuggestion; | ||
|
||
public interface RefreshableCommandSuggestor { | ||
|
||
void refresh(); | ||
|
||
} |
12 changes: 0 additions & 12 deletions
12
src/main/java/com/github/liachmodded/pathsuggestion/mixin/ChatScreenAccessor.java
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
src/main/java/com/github/liachmodded/pathsuggestion/mixin/ChatScreenMixin.java
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
...ain/java/com/github/liachmodded/pathsuggestion/mixin/ChatScreenSuggestionWindowMixin.java
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
src/main/java/com/github/liachmodded/pathsuggestion/mixin/CommandScreenAccessor.java
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
src/main/java/com/github/liachmodded/pathsuggestion/mixin/CommandScreenMixin.java
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
src/main/java/com/github/liachmodded/pathsuggestion/mixin/CommandSuggestorMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.github.liachmodded.pathsuggestion.mixin; | ||
|
||
import com.github.liachmodded.pathsuggestion.PathSuggestion; | ||
import com.github.liachmodded.pathsuggestion.RefreshableCommandSuggestor; | ||
import com.mojang.brigadier.suggestion.Suggestions; | ||
import net.minecraft.client.gui.screen.CommandSuggestor; | ||
import org.spongepowered.asm.mixin.Implements; | ||
import org.spongepowered.asm.mixin.Interface; | ||
import org.spongepowered.asm.mixin.Intrinsic; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||
|
||
@Mixin(CommandSuggestor.class) | ||
@Implements(@Interface(iface = RefreshableCommandSuggestor.class, prefix = "refreshable$")) | ||
public abstract class CommandSuggestorMixin { | ||
|
||
@Shadow | ||
public abstract void refresh(); | ||
|
||
@Inject(method = "showSuggestions(Z)V", at = @At(value = "INVOKE", target = "Lcom/mojang/brigadier/suggestion/Suggestions;isEmpty()Z", remap = false), locals = LocalCapture.CAPTURE_FAILHARD) | ||
public void onCreatingSuggestionWindow(boolean showFirstSuggestion, CallbackInfo ci, Suggestions suggestions) { | ||
if (!suggestions.isEmpty()) { | ||
PathSuggestion.shrinkSuggestions(suggestions); | ||
} | ||
} | ||
|
||
@Intrinsic | ||
public void refreshable$refresh() { | ||
this.refresh(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters