mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 14:34:28 +00:00
Update to 1.17
Update to Official classnames Patchwork Make the game compile and run Merge in the new HUD overlay API Merge in the new render properties API PEEL Use Gradle 7.2 snapshot to fix eclipse integration bug in 7.1, Would use 7.0 but FG needs 7.1 for some reason. New FML installer Update to 1.17.1 Co-authored-by: LexManos <[email protected]> Co-authored-by: SizableShrimp <[email protected]> Co-authored-by: cpw <[email protected]> Co-authored-by: Curle <[email protected]> Co-authored-by: Unnoen <[email protected]> Co-authored-by: covers1624 <[email protected]> Co-authored-by: DaemonUmbra <[email protected]> Co-authored-by: gigaherz <[email protected]> Signed-off-by: SizableShrimp <[email protected]>
This commit is contained in:
1 parent
064ae6961b
commit
be5446b91c
1990 files changed
+35661
-37544
No files matched your search
@@ -19,8 +19,6 @@
|
||||
|
||||
package net.minecraftforge.client.settings;
|
||||
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
|
||||
/**
|
||||
* Defines the context that a {@link KeyBinding} is used.
|
||||
* Key conflicts occur when a {@link KeyBinding} has the same {@link IKeyConflictContext} and has conflicting modifiers and keyCodes.
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
package net.minecraftforge.client.settings;
|
||||
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.client.util.InputMappings;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
@@ -32,7 +32,7 @@ import java.util.Map;
|
||||
|
||||
public class KeyBindingMap
|
||||
{
|
||||
private static final EnumMap<KeyModifier, Map<InputMappings.Input, Collection<KeyBinding>>> map = new EnumMap<>(KeyModifier.class);
|
||||
private static final EnumMap<KeyModifier, Map<InputConstants.Key, Collection<KeyMapping>>> map = new EnumMap<>(KeyModifier.class);
|
||||
static
|
||||
{
|
||||
for (KeyModifier modifier : KeyModifier.values())
|
||||
@@ -42,12 +42,12 @@ public class KeyBindingMap
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public KeyBinding lookupActive(InputMappings.Input keyCode)
|
||||
public KeyMapping lookupActive(InputConstants.Key keyCode)
|
||||
{
|
||||
KeyModifier activeModifier = KeyModifier.getActiveModifier();
|
||||
if (!activeModifier.matches(keyCode))
|
||||
{
|
||||
KeyBinding binding = getBinding(keyCode, activeModifier);
|
||||
KeyMapping binding = getBinding(keyCode, activeModifier);
|
||||
if (binding != null)
|
||||
{
|
||||
return binding;
|
||||
@@ -57,12 +57,12 @@ public class KeyBindingMap
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private KeyBinding getBinding(InputMappings.Input keyCode, KeyModifier keyModifier)
|
||||
private KeyMapping getBinding(InputConstants.Key keyCode, KeyModifier keyModifier)
|
||||
{
|
||||
Collection<KeyBinding> bindings = map.get(keyModifier).get(keyCode);
|
||||
Collection<KeyMapping> bindings = map.get(keyModifier).get(keyCode);
|
||||
if (bindings != null)
|
||||
{
|
||||
for (KeyBinding binding : bindings)
|
||||
for (KeyMapping binding : bindings)
|
||||
{
|
||||
if (binding.isActiveAndMatches(keyCode))
|
||||
{
|
||||
@@ -73,12 +73,12 @@ public class KeyBindingMap
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<KeyBinding> lookupAll(InputMappings.Input keyCode)
|
||||
public List<KeyMapping> lookupAll(InputConstants.Key keyCode)
|
||||
{
|
||||
List<KeyBinding> matchingBindings = new ArrayList<KeyBinding>();
|
||||
for (Map<InputMappings.Input, Collection<KeyBinding>> bindingsMap : map.values())
|
||||
List<KeyMapping> matchingBindings = new ArrayList<KeyMapping>();
|
||||
for (Map<InputConstants.Key, Collection<KeyMapping>> bindingsMap : map.values())
|
||||
{
|
||||
Collection<KeyBinding> bindings = bindingsMap.get(keyCode);
|
||||
Collection<KeyMapping> bindings = bindingsMap.get(keyCode);
|
||||
if (bindings != null)
|
||||
{
|
||||
matchingBindings.addAll(bindings);
|
||||
@@ -87,25 +87,25 @@ public class KeyBindingMap
|
||||
return matchingBindings;
|
||||
}
|
||||
|
||||
public void addKey(InputMappings.Input keyCode, KeyBinding keyBinding)
|
||||
public void addKey(InputConstants.Key keyCode, KeyMapping keyBinding)
|
||||
{
|
||||
KeyModifier keyModifier = keyBinding.getKeyModifier();
|
||||
Map<InputMappings.Input, Collection<KeyBinding>> bindingsMap = map.get(keyModifier);
|
||||
Collection<KeyBinding> bindingsForKey = bindingsMap.get(keyCode);
|
||||
Map<InputConstants.Key, Collection<KeyMapping>> bindingsMap = map.get(keyModifier);
|
||||
Collection<KeyMapping> bindingsForKey = bindingsMap.get(keyCode);
|
||||
if (bindingsForKey == null)
|
||||
{
|
||||
bindingsForKey = new ArrayList<KeyBinding>();
|
||||
bindingsForKey = new ArrayList<KeyMapping>();
|
||||
bindingsMap.put(keyCode, bindingsForKey);
|
||||
}
|
||||
bindingsForKey.add(keyBinding);
|
||||
}
|
||||
|
||||
public void removeKey(KeyBinding keyBinding)
|
||||
public void removeKey(KeyMapping keyBinding)
|
||||
{
|
||||
KeyModifier keyModifier = keyBinding.getKeyModifier();
|
||||
InputMappings.Input keyCode = keyBinding.getKey();
|
||||
Map<InputMappings.Input, Collection<KeyBinding>> bindingsMap = map.get(keyModifier);
|
||||
Collection<KeyBinding> bindingsForKey = bindingsMap.get(keyCode);
|
||||
InputConstants.Key keyCode = keyBinding.getKey();
|
||||
Map<InputConstants.Key, Collection<KeyMapping>> bindingsMap = map.get(keyModifier);
|
||||
Collection<KeyMapping> bindingsForKey = bindingsMap.get(keyCode);
|
||||
if (bindingsForKey != null)
|
||||
{
|
||||
bindingsForKey.remove(keyBinding);
|
||||
@@ -118,7 +118,7 @@ public class KeyBindingMap
|
||||
|
||||
public void clearMap()
|
||||
{
|
||||
for (Map<InputMappings.Input, Collection<KeyBinding>> bindings : map.values())
|
||||
for (Map<InputConstants.Key, Collection<KeyMapping>> bindings : map.values())
|
||||
{
|
||||
bindings.clear();
|
||||
}
|
||||
|
||||
@@ -24,18 +24,17 @@ import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.InputMappings;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public enum KeyModifier {
|
||||
CONTROL {
|
||||
@Override
|
||||
public boolean matches(InputMappings.Input key)
|
||||
public boolean matches(InputConstants.Key key)
|
||||
{
|
||||
int keyCode = key.getValue();
|
||||
if (Minecraft.ON_OSX)
|
||||
@@ -55,15 +54,15 @@ public enum KeyModifier {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getCombinedName(InputMappings.Input key, Supplier<ITextComponent> defaultLogic)
|
||||
public Component getCombinedName(InputConstants.Key key, Supplier<Component> defaultLogic)
|
||||
{
|
||||
String localizationFormatKey = Minecraft.ON_OSX ? "forge.controlsgui.control.mac" : "forge.controlsgui.control";
|
||||
return new TranslationTextComponent(localizationFormatKey, defaultLogic.get());
|
||||
return new TranslatableComponent(localizationFormatKey, defaultLogic.get());
|
||||
}
|
||||
},
|
||||
SHIFT {
|
||||
@Override
|
||||
public boolean matches(InputMappings.Input key)
|
||||
public boolean matches(InputConstants.Key key)
|
||||
{
|
||||
return key.getValue() == GLFW.GLFW_KEY_LEFT_SHIFT || key.getValue() == GLFW.GLFW_KEY_RIGHT_SHIFT;
|
||||
}
|
||||
@@ -75,14 +74,14 @@ public enum KeyModifier {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getCombinedName(InputMappings.Input key, Supplier<ITextComponent> defaultLogic)
|
||||
public Component getCombinedName(InputConstants.Key key, Supplier<Component> defaultLogic)
|
||||
{
|
||||
return new TranslationTextComponent("forge.controlsgui.shift", defaultLogic.get());
|
||||
return new TranslatableComponent("forge.controlsgui.shift", defaultLogic.get());
|
||||
}
|
||||
},
|
||||
ALT {
|
||||
@Override
|
||||
public boolean matches(InputMappings.Input key)
|
||||
public boolean matches(InputConstants.Key key)
|
||||
{
|
||||
return key.getValue() == GLFW.GLFW_KEY_LEFT_ALT || key.getValue() == GLFW.GLFW_KEY_RIGHT_ALT;
|
||||
}
|
||||
@@ -94,14 +93,14 @@ public enum KeyModifier {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getCombinedName(InputMappings.Input keyCode, Supplier<ITextComponent> defaultLogic)
|
||||
public Component getCombinedName(InputConstants.Key keyCode, Supplier<Component> defaultLogic)
|
||||
{
|
||||
return new TranslationTextComponent("forge.controlsgui.alt", defaultLogic.get());
|
||||
return new TranslatableComponent("forge.controlsgui.alt", defaultLogic.get());
|
||||
}
|
||||
},
|
||||
NONE {
|
||||
@Override
|
||||
public boolean matches(InputMappings.Input key)
|
||||
public boolean matches(InputConstants.Key key)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -123,7 +122,7 @@ public enum KeyModifier {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getCombinedName(InputMappings.Input key, Supplier<ITextComponent> defaultLogic)
|
||||
public Component getCombinedName(InputConstants.Key key, Supplier<Component> defaultLogic)
|
||||
{
|
||||
return defaultLogic.get();
|
||||
}
|
||||
@@ -143,7 +142,7 @@ public enum KeyModifier {
|
||||
return NONE;
|
||||
}
|
||||
|
||||
public static boolean isKeyCodeModifier(InputMappings.Input key)
|
||||
public static boolean isKeyCodeModifier(InputConstants.Key key)
|
||||
{
|
||||
for (KeyModifier keyModifier : MODIFIER_VALUES)
|
||||
{
|
||||
@@ -167,9 +166,9 @@ public enum KeyModifier {
|
||||
}
|
||||
}
|
||||
|
||||
public abstract boolean matches(InputMappings.Input key);
|
||||
public abstract boolean matches(InputConstants.Key key);
|
||||
|
||||
public abstract boolean isActive(@Nullable IKeyConflictContext conflictContext);
|
||||
|
||||
public abstract ITextComponent getCombinedName(InputMappings.Input key, Supplier<ITextComponent> defaultLogic);
|
||||
public abstract Component getCombinedName(InputConstants.Key key, Supplier<Component> defaultLogic);
|
||||
}
|
||||
Reference in new issue
Block a user