Jared пре 5 година
родитељ
комит
4ee5b3da6b

+ 10 - 4
build.gradle

@@ -36,8 +36,14 @@ archivesBaseName = 'Controlling'
 
 sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
 
+repositories {
+    maven {
+        url 'https://dogforce-games.com/maven'
+    }
+}
+
 minecraft {
-    mappings channel: 'snapshot', version: '20200409-1.15.1'
+    mappings channel: 'snapshot', version: '20200712-1.16.1'
     accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
 
     runs {
@@ -71,7 +77,7 @@ task genGitChangelog() {
     String repoLink = "https://github.com/jaredlll08/Controlling/commit/"
     // was having issues with grep and spaces in the regex
     exec {
-        commandLine 'git', 'log', '-i', '--grep=version\\spush', '--grep=open\\sbeta\\sspecific\\scode', '--pretty=tformat:%H', '--date=local', firstCommit + '..@{1}'
+        commandLine 'git', 'log', '-i', '--grep=version\\spush', '--grep=open\\sbeta\\sspecific\\scode', '--pretty=tformat:%H', '--date=local', firstCommit + '..@{0}'
         standardOutput = stdout
     }
     if (stdout.toString().trim().indexOf("\n") >= 0) {
@@ -90,7 +96,7 @@ task genGitChangelog() {
 }
 
 dependencies {
-    minecraft 'net.minecraftforge:forge:1.15.2-31.1.43'
+    minecraft 'net.minecraftforge:forge:1.16.1-32.0.63'
 }
 
 jar {
@@ -201,7 +207,7 @@ task updateVersionTracker {
         def body = [
                 'author'        : "${project.findProperty('versionTrackerAuthor')}",
                 'projectName'   : "controlling",
-                'gameVersion'   : "1.15.2",
+                'gameVersion'   : "1.16.1",
                 'projectVersion': "${version}",
                 'homepage'      : "${project.findProperty('versionTrackerHomepage')}",
                 'uid'           : "${project.findProperty('versionTrackerKey')}"

+ 1 - 1
src/main/java/com/blamejared/controlling/Controlling.java

@@ -28,7 +28,7 @@ public class Controlling {
                 URLConnection urlConnection = url.openConnection();
                 urlConnection.setConnectTimeout(15000);
                 urlConnection.setReadTimeout(15000);
-                urlConnection.setRequestProperty("User-Agent", "Controlling|1.15.2");
+                urlConnection.setRequestProperty("User-Agent", "Controlling|1.16.1");
                 try(BufferedReader reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()))) {
                     PATRON_LIST = reader.lines().filter(s -> !s.isEmpty()).collect(Collectors.toSet());
                 }

+ 6 - 4
src/main/java/com/blamejared/controlling/client/gui/GuiCheckBox.java

@@ -1,9 +1,11 @@
 package com.blamejared.controlling.client.gui;
 
+import com.mojang.blaze3d.matrix.MatrixStack;
 import com.mojang.blaze3d.platform.GlStateManager;
 import com.mojang.blaze3d.systems.RenderSystem;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.widget.button.Button;
+import net.minecraft.util.text.StringTextComponent;
 import net.minecraftforge.fml.client.gui.GuiUtils;
 import org.lwjgl.opengl.*;
 
@@ -16,7 +18,7 @@ public class GuiCheckBox extends Button {
     private int boxWidth;
     
     public GuiCheckBox(int xPos, int yPos, String displayString, boolean isChecked) {
-        super(xPos, yPos, Minecraft.getInstance().fontRenderer.getStringWidth(displayString) + 2 + 11, 11, displayString, b -> {
+        super(xPos, yPos, Minecraft.getInstance().fontRenderer.getStringWidth(displayString) + 2 + 11, 11, new StringTextComponent(displayString), b -> {
         });
         this.isChecked = isChecked;
         this.boxWidth = 11;
@@ -25,7 +27,7 @@ public class GuiCheckBox extends Button {
     }
     
     @Override
-    public void renderButton(int mouseX, int mouseY, float partial) {
+    public void renderButton(MatrixStack stack, int mouseX, int mouseY, float partial) {
         if(this.visible) {
             Minecraft mc = Minecraft.getInstance();
             this.isHovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
@@ -44,8 +46,8 @@ public class GuiCheckBox extends Button {
             }
             
             if(this.isChecked)
-                this.drawCenteredString(mc.fontRenderer, "x", this.x + this.boxWidth / 2 + 1, this.y + 1, 14737632);
-            mc.fontRenderer.drawString(getMessage(), this.x + this.boxWidth + 2, this.y + 2, color);
+                this.drawCenteredString(stack, mc.fontRenderer, "x", this.x + this.boxWidth / 2 + 1, this.y + 1, 14737632);
+            mc.fontRenderer.func_238407_a_(stack, getMessage(), this.x + this.boxWidth + 2, this.y + 2, color);
         }
     }
     

+ 141 - 135
src/main/java/com/blamejared/controlling/client/gui/GuiNewControls.java

@@ -1,107 +1,117 @@
 package com.blamejared.controlling.client.gui;
 
 import com.blamejared.controlling.Controlling;
+import com.mojang.blaze3d.matrix.MatrixStack;
 import com.mojang.blaze3d.platform.GlStateManager;
-import net.minecraft.client.*;
+import net.minecraft.client.AbstractOption;
+import net.minecraft.client.GameSettings;
+import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.IGuiEventListener;
-import net.minecraft.client.gui.screen.*;
+import net.minecraft.client.gui.screen.ControlsScreen;
+import net.minecraft.client.gui.screen.MouseSettingsScreen;
+import net.minecraft.client.gui.screen.Screen;
 import net.minecraft.client.gui.widget.TextFieldWidget;
 import net.minecraft.client.gui.widget.button.Button;
 import net.minecraft.client.gui.widget.list.KeyBindingList;
-import net.minecraft.client.resources.I18n;
-import net.minecraft.client.settings.*;
+import net.minecraft.client.settings.KeyBinding;
 import net.minecraft.client.util.InputMappings;
 import net.minecraft.util.Util;
-import net.minecraftforge.api.distmarker.*;
+import net.minecraft.util.text.ITextComponent;
+import net.minecraft.util.text.StringTextComponent;
+import net.minecraft.util.text.TranslationTextComponent;
+import net.minecraftforge.api.distmarker.Dist;
+import net.minecraftforge.api.distmarker.OnlyIn;
 import org.lwjgl.glfw.GLFW;
 
-import java.util.*;
+import java.util.LinkedHashSet;
+import java.util.Random;
+import java.util.Set;
 import java.util.function.Predicate;
 
 @OnlyIn(Dist.CLIENT)
 public class GuiNewControls extends ControlsScreen {
-    
+
     private Button buttonReset;
     private final Screen parentScreen;
     private final GameSettings options;
-    
+
     private String lastSearch;
     private TextFieldWidget search;
-    
+
     private DisplayMode displayMode;
     private SearchType searchType;
     private SortOrder sortOrder;
-    
+
     private Button buttonNone;
     private Button buttonConflicting;
     private GuiCheckBox buttonKey;
     private GuiCheckBox buttonCat;
     private Button patreonButton;
     private boolean confirmingReset = false;
-    
+
     private String name;
-    
+
     public GuiNewControls(Screen screen, GameSettings settings) {
         super(screen, settings);
         this.parentScreen = screen;
         this.options = settings;
     }
-    
+
     /**
      * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
      * window resizes, the buttonList is cleared beforehand.
      */
     protected void init() {
-        
-        this.addButton(new Button(this.width / 2 - 155, 18, 150, 20, I18n.format("options.mouse_settings"), (p_213126_1_) -> {
+
+        this.addButton(new Button(this.width / 2 - 155, 18, 150, 20, new TranslationTextComponent("options.mouse_settings"), (p_213126_1_) -> {
             this.minecraft.displayGuiScreen(new MouseSettingsScreen(this, options));
         }));
         this.addButton(AbstractOption.AUTO_JUMP.createWidget(this.minecraft.gameSettings, this.width / 2 - 155 + 160, 18, 150));
-        
+
         this.keyBindingList = new GuiNewKeyBindingList(this, this.minecraft);
         this.children.add(this.keyBindingList);
         this.setFocused(this.keyBindingList);
-        this.addButton(new Button(this.width / 2 - 155 + 160, this.height - 29, 150, 20, I18n.format("gui.done"), (p_213126_1_) -> GuiNewControls.this.minecraft.displayGuiScreen(GuiNewControls.this.parentScreen)));
-        
-        this.buttonReset = this.addButton(new Button(this.width / 2 - 155, this.height - 29, 150, 20, I18n.format("controls.resetAll"), (p_213126_1_) -> {
-            
-            if(!confirmingReset) {
+        this.addButton(new Button(this.width / 2 - 155 + 160, this.height - 29, 150, 20, new TranslationTextComponent("gui.done"), (p_213126_1_) -> GuiNewControls.this.minecraft.displayGuiScreen(GuiNewControls.this.parentScreen)));
+
+        this.buttonReset = this.addButton(new Button(this.width / 2 - 155, this.height - 29, 150, 20, new TranslationTextComponent("controls.resetAll"), (p_213126_1_) -> {
+
+            if (!confirmingReset) {
                 confirmingReset = true;
-                p_213126_1_.setMessage(I18n.format("options.confirmReset"));
+                p_213126_1_.setMessage(new TranslationTextComponent("options.confirmReset"));
                 return;
             }
             confirmingReset = false;
-            p_213126_1_.setMessage(I18n.format("controls.resetAll"));
-            for(KeyBinding keybinding : GuiNewControls.this.minecraft.gameSettings.keyBindings) {
+            p_213126_1_.setMessage(new TranslationTextComponent("controls.resetAll"));
+            for (KeyBinding keybinding : GuiNewControls.this.minecraft.gameSettings.keyBindings) {
                 keybinding.setToDefault();
             }
-            
+
             KeyBinding.resetKeyBindingArrayAndHash();
         }));
-        this.buttonNone = this.addButton(new Button(this.width / 2 - 155 + 160 + 76, this.height - 29 - 24, 150 / 2, 20, I18n.format("options.showNone"), (p_213126_1_) -> {
-            if(displayMode == DisplayMode.NONE) {
-                buttonNone.setMessage(I18n.format("options.showNone"));
+        this.buttonNone = this.addButton(new Button(this.width / 2 - 155 + 160 + 76, this.height - 29 - 24, 150 / 2, 20, new TranslationTextComponent("options.showNone"), (p_213126_1_) -> {
+            if (displayMode == DisplayMode.NONE) {
+                buttonNone.setMessage(new TranslationTextComponent("options.showNone"));
                 displayMode = DisplayMode.ALL;
             } else {
                 displayMode = DisplayMode.NONE;
-                buttonNone.setMessage(I18n.format("options.showAll"));
-                buttonConflicting.setMessage(I18n.format("options.showConflicts"));
+                buttonNone.setMessage(new TranslationTextComponent("options.showAll"));
+                buttonConflicting.setMessage(new TranslationTextComponent("options.showConflicts"));
             }
             filterKeys();
         }));
-        this.buttonConflicting = this.addButton(new Button(this.width / 2 - 155 + 160, this.height - 29 - 24, 150 / 2, 20, I18n.format("options.showConflicts"), (p_213126_1_) -> {
-            if(displayMode == DisplayMode.CONFLICTING) {
-                buttonConflicting.setMessage(I18n.format("options.showConflicts"));
+        this.buttonConflicting = this.addButton(new Button(this.width / 2 - 155 + 160, this.height - 29 - 24, 150 / 2, 20, new TranslationTextComponent("options.showConflicts"), (p_213126_1_) -> {
+            if (displayMode == DisplayMode.CONFLICTING) {
+                buttonConflicting.setMessage(new TranslationTextComponent("options.showConflicts"));
                 displayMode = DisplayMode.ALL;
             } else {
                 displayMode = DisplayMode.CONFLICTING;
-                buttonConflicting.setMessage(I18n.format("options.showAll"));
-                buttonNone.setMessage(I18n.format("options.showNone"));
+                buttonConflicting.setMessage(new TranslationTextComponent("options.showAll"));
+                buttonNone.setMessage(new TranslationTextComponent("options.showNone"));
             }
             filterKeys();
         }));
-        search = new TextFieldWidget(font, this.width / 2 - 154, this.height - 29 - 23, 148, 18, "");
-        this.buttonKey = this.addButton(new GuiCheckBox(this.width / 2 - (155 / 2), this.height - 29 - 37, I18n.format("options.key"), false) {
+        search = new TextFieldWidget(font, this.width / 2 - 154, this.height - 29 - 23, 148, 18, new StringTextComponent(""));
+        this.buttonKey = this.addButton(new GuiCheckBox(this.width / 2 - (155 / 2), this.height - 29 - 37, new TranslationTextComponent("options.key").getString(), false) {
             @Override
             public void onPress() {
                 super.onPress();
@@ -110,8 +120,8 @@ public class GuiNewControls extends ControlsScreen {
                 filterKeys();
             }
         });
-        this.buttonCat = this.addButton(new GuiCheckBox(this.width / 2 - (155 / 2), this.height - 29 - 50, I18n.format("options.category"), false) {
-            
+        this.buttonCat = this.addButton(new GuiCheckBox(this.width / 2 - (155 / 2), this.height - 29 - 50, new TranslationTextComponent("options.category").getString(), false) {
+
             @Override
             public void onPress() {
                 super.onPress();
@@ -121,18 +131,18 @@ public class GuiNewControls extends ControlsScreen {
             }
         });
         name = Controlling.PATRON_LIST.stream().skip(Controlling.PATRON_LIST.isEmpty() ? 0 : new Random().nextInt(Controlling.PATRON_LIST.size())).findFirst().orElse("");
-        patreonButton = this.addButton(new Button(this.width / 2 - 155 + 160, this.height - 29 - 24 - 24, 150 / 2, 20, "Patreon", p_onPress_1_ -> {
+        patreonButton = this.addButton(new Button(this.width / 2 - 155 + 160, this.height - 29 - 24 - 24, 150 / 2, 20, new StringTextComponent("Patreon"), p_onPress_1_ -> {
             Util.getOSType().openURI("https://patreon.com/jaredlll08?s=controllingmod");
         }) {
             private boolean wasHovered;
-            
+
             @Override
-            public void render(int p_render_1_, int p_render_2_, float p_render_3_) {
-                if(this.visible) {
+            public void render(MatrixStack stack, int p_render_1_, int p_render_2_, float p_render_3_) {
+                if (this.visible) {
                     this.isHovered = p_render_1_ >= this.x && p_render_2_ >= this.y && p_render_1_ < this.x + this.width && p_render_2_ < this.y + this.height;
-                    if(this.wasHovered != this.isHovered()) {
-                        if(this.isHovered()) {
-                            if(this.isFocused()) {
+                    if (this.wasHovered != this.isHovered()) {
+                        if (this.isHovered()) {
+                            if (this.isFocused()) {
                                 this.nextNarration = Util.milliTime() + 200L;
                             } else {
                                 this.nextNarration = Util.milliTime() + 750L;
@@ -141,95 +151,95 @@ public class GuiNewControls extends ControlsScreen {
                             this.nextNarration = Long.MAX_VALUE;
                         }
                     }
-                    
-                    if(this.visible) {
-                        this.renderButton(p_render_1_, p_render_2_, p_render_3_);
+
+                    if (this.visible) {
+                        this.renderButton(stack, p_render_1_, p_render_2_, p_render_3_);
                     }
-                    
+
                     this.narrate();
                     this.wasHovered = this.isHovered();
                 }
             }
         });
         sortOrder = SortOrder.NONE;
-        Button buttonSort = this.addButton(new Button(this.width / 2 - 155 + 160 + 76, this.height - 29 - 24 - 24, 150 / 2, 20, I18n.format("options.sort") + ": " + sortOrder.getName(), (p_213126_1_) -> {
+        Button buttonSort = this.addButton(new Button(this.width / 2 - 155 + 160 + 76, this.height - 29 - 24 - 24, 150 / 2, 20, new TranslationTextComponent("options.sort").appendString(": " + sortOrder.getName()), (p_213126_1_) -> {
             sortOrder = sortOrder.cycle();
-            p_213126_1_.setMessage(I18n.format("options.sort") + ": " + sortOrder.getName());
+            p_213126_1_.setMessage(new TranslationTextComponent("options.sort").appendString(": " + sortOrder.getName()));
             filterKeys();
         }));
         lastSearch = "";
         displayMode = DisplayMode.ALL;
         searchType = SearchType.NAME;
-        
+
     }
-    
+
     @Override
     public boolean charTyped(char var1, int var2) {
         return search.charTyped(var1, var2);
     }
-    
+
     public void tick() {
         this.search.tick();
-        if(!lastSearch.equals(search.getText())) {
+        if (!lastSearch.equals(search.getText())) {
             filterKeys();
         }
     }
-    
+
     public void filterKeys() {
-        
+
         lastSearch = search.getText();
         keyBindingList.children().clear();
-        if(lastSearch.isEmpty() && displayMode == DisplayMode.ALL && sortOrder == SortOrder.NONE) {
+        if (lastSearch.isEmpty() && displayMode == DisplayMode.ALL && sortOrder == SortOrder.NONE) {
             keyBindingList.children().addAll(((GuiNewKeyBindingList) keyBindingList).getAllEntries());
             return;
         }
         this.keyBindingList.setScrollAmount(0);
         Predicate<GuiNewKeyBindingList.KeyEntry> filters = displayMode.getPredicate();
-        
-        
-        switch(searchType) {
+
+
+        switch (searchType) {
             case NAME:
                 filters = filters.and(keyEntry -> keyEntry.getKeyDesc().toLowerCase().contains(lastSearch.toLowerCase()));
                 break;
             case CATEGORY:
-                filters = filters.and(keyEntry -> I18n.format(keyEntry.getKeybinding().getKeyCategory()).toLowerCase().contains(lastSearch.toLowerCase()));
+                filters = filters.and(keyEntry -> new TranslationTextComponent(keyEntry.getKeybinding().getKeyCategory()).getString().toLowerCase().contains(lastSearch.toLowerCase()));
                 break;
             case KEY:
-                filters = filters.and(keyEntry -> keyEntry.getKeybinding().getLocalizedName().toLowerCase().contains(lastSearch.toLowerCase()));
+                filters = filters.and(keyEntry -> keyEntry.getKeybinding().func_238171_j_().getString().toLowerCase().contains(lastSearch.toLowerCase()));
                 break;
         }
-        
-        for(GuiNewKeyBindingList.Entry entry : ((GuiNewKeyBindingList) keyBindingList).getAllEntries()) {
-            if(searchType == SearchType.CATEGORY && sortOrder == SortOrder.NONE && displayMode == DisplayMode.ALL) {
-                if(entry instanceof GuiNewKeyBindingList.KeyEntry) {
+
+        for (GuiNewKeyBindingList.Entry entry : ((GuiNewKeyBindingList) keyBindingList).getAllEntries()) {
+            if (searchType == SearchType.CATEGORY && sortOrder == SortOrder.NONE && displayMode == DisplayMode.ALL) {
+                if (entry instanceof GuiNewKeyBindingList.KeyEntry) {
                     GuiNewKeyBindingList.KeyEntry keyEntry = (GuiNewKeyBindingList.KeyEntry) entry;
-                    if(filters.test(keyEntry)) {
+                    if (filters.test(keyEntry)) {
                         keyBindingList.children().add(entry);
                     }
-                } else  {
+                } else {
                     keyBindingList.children().add(entry);
                 }
             } else {
-                if(entry instanceof GuiNewKeyBindingList.KeyEntry) {
+                if (entry instanceof GuiNewKeyBindingList.KeyEntry) {
                     GuiNewKeyBindingList.KeyEntry keyEntry = (GuiNewKeyBindingList.KeyEntry) entry;
-                    if(filters.test(keyEntry)) {
+                    if (filters.test(keyEntry)) {
                         keyBindingList.children().add(entry);
                     }
                 }
             }
-            
+
         }
-        if(searchType == SearchType.CATEGORY  && sortOrder == SortOrder.NONE && displayMode == DisplayMode.ALL) {
+        if (searchType == SearchType.CATEGORY && sortOrder == SortOrder.NONE && displayMode == DisplayMode.ALL) {
             Set<GuiNewKeyBindingList.CategoryEntry> categories = new LinkedHashSet<>();
-            
-            for(KeyBindingList.Entry entry : keyBindingList.children()) {
-                if(entry instanceof GuiNewKeyBindingList.CategoryEntry) {
+
+            for (KeyBindingList.Entry entry : keyBindingList.children()) {
+                if (entry instanceof GuiNewKeyBindingList.CategoryEntry) {
                     GuiNewKeyBindingList.CategoryEntry centry = (GuiNewKeyBindingList.CategoryEntry) entry;
                     categories.add(centry);
-                    for(KeyBindingList.Entry child : keyBindingList.children()) {
-                        if(child instanceof GuiNewKeyBindingList.KeyEntry) {
+                    for (KeyBindingList.Entry child : keyBindingList.children()) {
+                        if (child instanceof GuiNewKeyBindingList.KeyEntry) {
                             GuiNewKeyBindingList.KeyEntry childEntry = (GuiNewKeyBindingList.KeyEntry) child;
-                            if(childEntry.getKeybinding().getKeyCategory().equals(centry.getName())) {
+                            if (childEntry.getKeybinding().getKeyCategory().equals(centry.getName())) {
                                 categories.remove(centry);
                             }
                         }
@@ -239,129 +249,125 @@ public class GuiNewControls extends ControlsScreen {
             keyBindingList.children().removeAll(categories);
         }
         sortOrder.sort(keyBindingList.children());
-        
-        
+
+
     }
-    
+
     /**
      * Draws the screen and all the components in it.
      */
-    public void render(int mouseX, int mouseY, float partialTicks) {
-        this.renderBackground();
-        this.keyBindingList.render(mouseX, mouseY, partialTicks);
-        this.drawCenteredString(this.font, this.title.getFormattedText(), this.width / 2, 8, 16777215);
+    public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
+        this.renderBackground(stack);
+        this.keyBindingList.render(stack, mouseX, mouseY, partialTicks);
+        this.drawCenteredString(stack, this.font, this.title.getString(), this.width / 2, 8, 16777215);
         boolean flag = false;
-        
-        for(KeyBinding keybinding : this.options.keyBindings) {
-            if(!keybinding.isDefault()) {
+
+        for (KeyBinding keybinding : this.options.keyBindings) {
+            if (!keybinding.isDefault()) {
                 flag = true;
                 break;
             }
         }
-        search.render(mouseX, mouseY, partialTicks);
+        search.render(stack, mouseX, mouseY, partialTicks);
         this.buttonReset.active = flag;
-        if(!flag) {
+        if (!flag) {
             confirmingReset = false;
-            buttonReset.setMessage(I18n.format("controls.resetAll"));
+            buttonReset.setMessage(new TranslationTextComponent("controls.resetAll"));
         }
-        for(int i = 0; i < this.buttons.size(); ++i) {
-            this.buttons.get(i).render(mouseX, mouseY, partialTicks);
+        for (int i = 0; i < this.buttons.size(); ++i) {
+            this.buttons.get(i).render(stack, mouseX, mouseY, partialTicks);
         }
-        
-        String text = I18n.format("options.search");
-        GlStateManager.disableLighting();
-        font.drawString(text, this.width / 2 - (155 / 2) - (font.getStringWidth(text)) - 5, this.height - 29 - 42, 16777215);
-        GlStateManager.enableLighting();
-        
-        if(patreonButton.isHovered()) {
-            GlStateManager.disableLighting();
+
+        ITextComponent text = new TranslationTextComponent("options.search");
+        font.func_238407_a_(stack, text, this.width / 2f - (155 / 2f) - (font.getStringWidth(text.getString())) - 5, this.height - 29 - 42, 16777215);
+
+        if (patreonButton.isHovered()) {
             String str = "Join " + name + " and other patrons!";
-            renderTooltip(str, mouseX, mouseY);
-            GlStateManager.enableLighting();
+            renderTooltip(stack, new StringTextComponent(str), mouseX, mouseY);
         }
     }
-    
+
     public boolean mouseClicked(double mx, double my, int mb) {
         boolean valid;
-        if(this.buttonId != null) {
+        if (this.buttonId != null) {
             this.options.setKeyBindingCode(this.buttonId, InputMappings.Type.MOUSE.getOrMakeInput(mb));
             this.buttonId = null;
             KeyBinding.resetKeyBindingArrayAndHash();
             valid = true;
             search.setFocused2(false);
-        } else if(mb == 0 && this.keyBindingList.mouseClicked(mx, my, mb)) {
+        } else if (mb == 0 && this.keyBindingList.mouseClicked(mx, my, mb)) {
             this.setDragging(true);
             this.setFocused(this.keyBindingList);
             valid = true;
             search.setFocused2(false);
         } else {
             valid = search.mouseClicked(mx, my, mb);
-            if(!valid && search.isFocused() && mb == 1) {
+            if (!valid && search.isFocused() && mb == 1) {
                 search.setText("");
                 valid = true;
             }
         }
-        
-        if(!valid) {
-            
-            for(IGuiEventListener iguieventlistener : this.children()) {
-                if(iguieventlistener.mouseClicked(mx, my, mb)) {
+
+        if (!valid) {
+
+            for (IGuiEventListener iguieventlistener : this.children()) {
+                if (iguieventlistener.mouseClicked(mx, my, mb)) {
                     this.setFocused(iguieventlistener);
-                    if(mb == 0) {
+                    if (mb == 0) {
                         this.setDragging(true);
                     }
-                    
+
                     return true;
                 }
             }
-            
+
             valid = true;
         }
-        
-        
+
+
         return valid;
     }
-    
+
     public boolean mouseReleased(double mx, double my, int mb) {
-        if(mb == 0 && this.keyBindingList.mouseReleased(mx, my, mb)) {
+        if (mb == 0 && this.keyBindingList.mouseReleased(mx, my, mb)) {
             this.setDragging(false);
             return true;
-        } else if(search.isFocused()) {
+        } else if (search.isFocused()) {
             return search.mouseReleased(mx, my, mb);
         } else {
             this.setDragging(false);
             return false;
         }
     }
-    
+
     public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) {
-        if(!search.isFocused() && this.buttonId == null) {
-            if(hasControlDown()) {
-                if(InputMappings.isKeyDown(Minecraft.getInstance().getMainWindow().getHandle(), GLFW.GLFW_KEY_F)) {
+        if (!search.isFocused() && this.buttonId == null) {
+            if (hasControlDown()) {
+                if (InputMappings.isKeyDown(Minecraft.getInstance().getMainWindow().getHandle(), GLFW.GLFW_KEY_F)) {
                     search.setFocused2(true);
                     return true;
                 }
             }
         }
-        if(search.keyPressed(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_)) {
+        if (search.keyPressed(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_)) {
             return true;
         }
-        if(search.isFocused()) {
-            if(p_keyPressed_1_ == 256) {
+        if (search.isFocused()) {
+            if (p_keyPressed_1_ == 256) {
                 search.setFocused2(false);
                 return true;
             }
         }
-        if(this.buttonId != null) {
-            if(p_keyPressed_1_ == 256) {
+        if (this.buttonId != null) {
+            if (p_keyPressed_1_ == 256) {
                 this.buttonId.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputMappings.INPUT_INVALID);
                 this.options.setKeyBindingCode(this.buttonId, InputMappings.INPUT_INVALID);
             } else {
                 this.buttonId.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputMappings.getInputByCode(p_keyPressed_1_, p_keyPressed_2_));
                 this.options.setKeyBindingCode(this.buttonId, InputMappings.getInputByCode(p_keyPressed_1_, p_keyPressed_2_));
             }
-            
-            if(!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.buttonId.getKey()))
+
+            if (!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.buttonId.getKey()))
                 this.buttonId = null;
             this.time = Util.milliTime();
             KeyBinding.resetKeyBindingArrayAndHash();
@@ -370,6 +376,6 @@ public class GuiNewControls extends ControlsScreen {
             return super.keyPressed(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_);
         }
     }
-    
-    
+
+
 }

+ 67 - 62
src/main/java/com/blamejared/controlling/client/gui/GuiNewKeyBindingList.java

@@ -1,6 +1,7 @@
 package com.blamejared.controlling.client.gui;
 
 import com.google.common.collect.ImmutableList;
+import com.mojang.blaze3d.matrix.MatrixStack;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.IGuiEventListener;
 import net.minecraft.client.gui.screen.ControlsScreen;
@@ -8,7 +9,7 @@ import net.minecraft.client.gui.widget.button.Button;
 import net.minecraft.client.gui.widget.list.KeyBindingList;
 import net.minecraft.client.resources.I18n;
 import net.minecraft.client.settings.KeyBinding;
-import net.minecraft.util.text.TextFormatting;
+import net.minecraft.util.text.*;
 import net.minecraftforge.api.distmarker.*;
 import org.apache.commons.lang3.ArrayUtils;
 
@@ -16,12 +17,12 @@ import java.util.*;
 
 @OnlyIn(Dist.CLIENT)
 public class GuiNewKeyBindingList extends KeyBindingList {
-    
+
     private final ControlsScreen controlsScreen;
     private final Minecraft mc;
     private int maxListLabelWidth;
     public List<Entry> allEntries;
-    
+
     public GuiNewKeyBindingList(ControlsScreen controls, Minecraft mcIn) {
         super(controls, mcIn);
         this.width = controls.width + 45;
@@ -36,75 +37,75 @@ public class GuiNewKeyBindingList extends KeyBindingList {
         KeyBinding[] akeybinding = ArrayUtils.clone(mcIn.gameSettings.keyBindings);
         Arrays.sort(akeybinding);
         String s = null;
-        
-        for(KeyBinding keybinding : akeybinding) {
+
+        for (KeyBinding keybinding : akeybinding) {
             String s1 = keybinding.getKeyCategory();
-            if(!s1.equals(s)) {
+            if (!s1.equals(s)) {
                 s = s1;
-                if(!s1.endsWith(".hidden")) {
+                if (!s1.endsWith(".hidden")) {
                     add(new GuiNewKeyBindingList.CategoryEntry(s1));
                 }
             }
-            
+
             int i = mcIn.fontRenderer.getStringWidth(I18n.format(keybinding.getKeyDescription()));
-            if(i > this.maxListLabelWidth) {
+            if (i > this.maxListLabelWidth) {
                 this.maxListLabelWidth = i;
             }
-            if(!s1.endsWith(".hidden")) {
+            if (!s1.endsWith(".hidden")) {
                 add(new GuiNewKeyBindingList.KeyEntry(keybinding));
             }
         }
-        
+
     }
-    
-    
+
+
     public List<Entry> getAllEntries() {
         return allEntries;
     }
-    
+
     public void add(Entry ent) {
         children().add(ent);
         allEntries.add(ent);
     }
-    
+
     protected int getScrollbarPosition() {
         return super.getScrollbarPosition() + 15 + 20;
     }
-    
+
     public int getRowWidth() {
         return super.getRowWidth() + 32;
     }
-    
+
     @OnlyIn(Dist.CLIENT)
     public class CategoryEntry extends KeyBindingList.Entry {
-        
+
         private final String labelText;
         private final int labelWidth;
         private final String name;
-        
+
         public CategoryEntry(String name) {
             this.labelText = I18n.format(name);
             this.labelWidth = GuiNewKeyBindingList.this.mc.fontRenderer.getStringWidth(this.labelText);
             this.name = name;
         }
-    
+
         public String getName() {
             return name;
         }
-    
+
         @Override
         public List<? extends IGuiEventListener> children() {
             return ImmutableList.of();
         }
-        
-        public void render(int p_render_1_, int p_render_2_, int p_render_3_, int p_render_4_, int p_render_5_, int p_render_6_, int p_render_7_, boolean p_render_8_, float p_render_9_) {
-            GuiNewKeyBindingList.this.minecraft.fontRenderer.drawString(this.labelText, (float) (GuiNewKeyBindingList.this.minecraft.currentScreen.width / 2 - this.labelWidth / 2), (float) (p_render_2_ + p_render_5_ - 9 - 1), 16777215);
+
+        public void render(MatrixStack stack, int p_render_1_, int p_render_2_, int p_render_3_, int p_render_4_, int p_render_5_, int p_render_6_, int p_render_7_, boolean p_render_8_, float p_render_9_) {
+            GuiNewKeyBindingList.this.minecraft.fontRenderer.drawString(stack, this.labelText, (float) (GuiNewKeyBindingList.this.minecraft.currentScreen.width / 2 - this.labelWidth / 2), (float) (p_render_2_ + p_render_5_ - 9 - 1), 16777215);
         }
     }
-    
+
     @OnlyIn(Dist.CLIENT)
     public class KeyEntry extends KeyBindingList.Entry {
-        
+
         /**
          * The keybinding specified for this KeyEntry
          */
@@ -115,95 +116,99 @@ public class GuiNewKeyBindingList extends KeyBindingList {
         private final String keyDesc;
         private final Button btnChangeKeyBinding;
         private final Button btnResetKeyBinding;
-        
-        
+
+
         private KeyEntry(final KeyBinding name) {
             this.keybinding = name;
             this.keyDesc = I18n.format(name.getKeyDescription());
-            this.btnChangeKeyBinding = new Button(0, 0, 75 + 20 /*Forge: add space*/, 20, this.keyDesc, (p_214386_2_) -> {
+            this.btnChangeKeyBinding = new Button(0, 0, 75 + 20 /*Forge: add space*/, 20, new StringTextComponent(this.keyDesc), (p_214386_2_) -> {
                 GuiNewKeyBindingList.this.controlsScreen.buttonId = name;
             }) {
-                protected String getNarrationMessage() {
-                    return name.isInvalid() ? I18n.format("narrator.controls.unbound", GuiNewKeyBindingList.KeyEntry.this.keyDesc) : I18n.format("narrator.controls.bound", GuiNewKeyBindingList.KeyEntry.this.keyDesc, super.getNarrationMessage());
+                protected IFormattableTextComponent getNarrationMessage() {
+                    return name.isInvalid() ? new TranslationTextComponent("narrator.controls.unbound", GuiNewKeyBindingList.KeyEntry.this.keyDesc) : new TranslationTextComponent("narrator.controls.bound", GuiNewKeyBindingList.KeyEntry.this.keyDesc, super.getNarrationMessage());
                 }
             };
-            this.btnResetKeyBinding = new Button(0, 0, 50, 20, I18n.format("controls.reset"), (p_214387_2_) -> {
+            this.btnResetKeyBinding = new Button(0, 0, 50, 20, new TranslationTextComponent("controls.reset"), (p_214387_2_) -> {
                 keybinding.setToDefault();
                 GuiNewKeyBindingList.this.minecraft.gameSettings.setKeyBindingCode(name, name.getDefault());
                 KeyBinding.resetKeyBindingArrayAndHash();
             }) {
-                protected String getNarrationMessage() {
-                    return I18n.format("narrator.controls.reset", GuiNewKeyBindingList.KeyEntry.this.keyDesc);
+                protected IFormattableTextComponent getNarrationMessage() {
+                    return new TranslationTextComponent("narrator.controls.reset", GuiNewKeyBindingList.KeyEntry.this.keyDesc);
                 }
             };
         }
-        
+
         @Override
-        public void render(int slotIndex, int y, int x, int p_render_4_, int p_render_5_, int mouseX, int mouseY, boolean p_render_8_, float p_render_9_) {
+        public void render(MatrixStack stack, int slotIndex, int y, int x, int p_render_4_, int p_render_5_, int mouseX, int mouseY, boolean p_render_8_, float p_render_9_) {
             int i = y;
             int j = x;
             boolean flag = GuiNewKeyBindingList.this.controlsScreen.buttonId == this.keybinding;
-            GuiNewKeyBindingList.this.mc.fontRenderer.drawString(this.keyDesc, (float) (j + 90 - GuiNewKeyBindingList.this.maxListLabelWidth), (float) (y + p_render_5_ / 2 - 9 / 2), 16777215);
+            GuiNewKeyBindingList.this.mc.fontRenderer.drawString(stack, this.keyDesc, (float) (j + 90 - GuiNewKeyBindingList.this.maxListLabelWidth), (float) (y + p_render_5_ / 2 - 9 / 2), 16777215);
             this.btnResetKeyBinding.x = x + 190 + 20;
             this.btnResetKeyBinding.y = y;
             this.btnResetKeyBinding.active = !this.keybinding.isDefault();
-            this.btnResetKeyBinding.render(mouseX, mouseY, p_render_9_);
-            
-            
+            this.btnResetKeyBinding.render(stack, mouseX, mouseY, p_render_9_);
+
+
             this.btnChangeKeyBinding.x = j + 105;
             this.btnChangeKeyBinding.y = i;
-            this.btnChangeKeyBinding.setMessage(this.keybinding.getLocalizedName());
-            
+            this.btnChangeKeyBinding.setMessage(this.keybinding.func_238171_j_());
+
             boolean flag1 = false;
             boolean keyCodeModifierConflict = true; // less severe form of conflict, like SHIFT conflicting with SHIFT+G
-            if(!this.keybinding.isInvalid()) {
-                for(KeyBinding keybinding : GuiNewKeyBindingList.this.mc.gameSettings.keyBindings) {
-                    if(keybinding != this.keybinding && this.keybinding.conflicts(keybinding)) {
+            if (!this.keybinding.isInvalid()) {
+                for (KeyBinding keybinding : GuiNewKeyBindingList.this.mc.gameSettings.keyBindings) {
+                    if (keybinding != this.keybinding && this.keybinding.conflicts(keybinding)) {
                         flag1 = true;
                         keyCodeModifierConflict &= keybinding.hasKeyCodeModifierConflict(this.keybinding);
                     }
                 }
             }
-            if(flag) {
-                this.btnChangeKeyBinding.setMessage(TextFormatting.WHITE + "> " + TextFormatting.YELLOW + this.btnChangeKeyBinding.getMessage() + TextFormatting.WHITE + " <");
-            } else if(flag1) {
-                this.btnChangeKeyBinding.setMessage((keyCodeModifierConflict ? TextFormatting.GOLD : TextFormatting.RED) + this.btnChangeKeyBinding.getMessage());
+            ITextComponent message = this.btnChangeKeyBinding.getMessage();
+            if (flag) {
+                this.btnChangeKeyBinding.setMessage(new StringTextComponent(TextFormatting.WHITE + "> " + TextFormatting.YELLOW + message.getString() + TextFormatting.WHITE + " <"));
+            } else if (flag1) {
+                IFormattableTextComponent modConflict = TextComponentUtils.func_240648_a_(message.copyRaw(), message.getStyle().setColor(Color.func_240743_a_(16755200)));
+                IFormattableTextComponent keyConflict = TextComponentUtils.func_240648_a_(message.copyRaw(), message.getStyle().setColor(Color.func_240743_a_(16755200)));
+
+                this.btnChangeKeyBinding.setMessage(keyCodeModifierConflict ? modConflict : keyConflict);
             }
-            
-            this.btnChangeKeyBinding.render(mouseX, mouseY, p_render_9_);
-            if(mouseY >= y && mouseY <= y + p_render_5_) {
-                mc.fontRenderer.drawString(I18n.format(keybinding.getKeyCategory()), mouseX + 10, mouseY, 0xFFFFFF);
+
+            this.btnChangeKeyBinding.render(stack, mouseX, mouseY, p_render_9_);
+            if (mouseY >= y && mouseY <= y + p_render_5_) {
+                mc.fontRenderer.drawString(stack, I18n.format(keybinding.getKeyCategory()), mouseX + 10, mouseY, 0xFFFFFF);
             }
         }
-        
+
         public List<? extends IGuiEventListener> children() {
             return ImmutableList.of(this.btnChangeKeyBinding, this.btnResetKeyBinding);
         }
-        
+
         public boolean mouseClicked(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_) {
-            if(this.btnChangeKeyBinding.mouseClicked(p_mouseClicked_1_, p_mouseClicked_3_, p_mouseClicked_5_)) {
+            if (this.btnChangeKeyBinding.mouseClicked(p_mouseClicked_1_, p_mouseClicked_3_, p_mouseClicked_5_)) {
                 return true;
             } else {
                 return this.btnResetKeyBinding.mouseClicked(p_mouseClicked_1_, p_mouseClicked_3_, p_mouseClicked_5_);
             }
         }
-        
+
         public boolean mouseReleased(double p_mouseReleased_1_, double p_mouseReleased_3_, int p_mouseReleased_5_) {
             return this.btnChangeKeyBinding.mouseReleased(p_mouseReleased_1_, p_mouseReleased_3_, p_mouseReleased_5_);
         }
-        
+
         public KeyBinding getKeybinding() {
             return keybinding;
         }
-        
+
         public String getKeyDesc() {
             return keyDesc;
         }
-        
+
         public Button getBtnChangeKeyBinding() {
             return btnChangeKeyBinding;
         }
-        
-        
+
+
     }
 }

+ 2 - 14
src/main/resources/META-INF/mods.toml

@@ -1,5 +1,5 @@
 modLoader="javafml" #mandatory
-loaderVersion="[31,)" #mandatory
+loaderVersion="[32,)" #mandatory
 issueTrackerURL="https://github.com/jaredlll08/Controlling/issues" #optional
 displayURL="https://minecraft.curseforge.com/projects/controlling" #optional
 authors="Jaredlll08" #optional
@@ -7,19 +7,7 @@ authors="Jaredlll08" #optional
 modId="controlling" #mandatory
 version="${file.jarVersion}" #mandatory
 displayName="Controlling" #mandatory
-updateJSONURL="https://updates.blamejared.com/get?n=controlling&gv=1.15.2"
+updateJSONURL="https://updates.blamejared.com/get?n=controlling&gv=1.16.1"
 description='''
 Adds the ability to search for keybinds using their name in the KeyBinding menu, this allows players to easily find a key binding in the menu.
 '''
-
-[[dependencies.controlling]] #optional
-    # the modid of the dependency
-    modId="forge" #mandatory
-    # Does this dependency have to exist - if not, ordering below must be specified
-    mandatory=true #mandatory
-    # The version range of the dependency
-    versionRange="[31,)" #mandatory
-    # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
-    ordering="NONE"
-    # Side this dependency is applied on - BOTH, CLIENT or SERVER
-    side="BOTH"

+ 1 - 1
src/main/resources/pack.mcmeta

@@ -1,7 +1,7 @@
 {
     "pack": {
         "description": "controlling resources",
-        "pack_format": 4,
+        "pack_format": 5,
         "_comment": "A pack_format of 4 requires json lang files. Note: we require v4 pack meta for all mods."
     }
 }