mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 11:29:15 +00:00
1 parent
80eb12e59d
commit
ca2ed1ff7a
139 files changed
+1034
-4067
No files matched your search
@@ -225,72 +225,6 @@ public class GuiScreenEvent extends Event
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated // Remove in 1.16
|
||||
public static class ActionPerformedEvent extends GuiScreenEvent
|
||||
{
|
||||
private Button button;
|
||||
private List<Button> buttonList;
|
||||
|
||||
public ActionPerformedEvent(Screen gui, Button button, List<Button> buttonList)
|
||||
{
|
||||
super(gui);
|
||||
this.setButton(button);
|
||||
this.setButtonList(new ArrayList<Button>(buttonList));
|
||||
}
|
||||
|
||||
/**
|
||||
* The button that was clicked.
|
||||
*/
|
||||
public Button getButton()
|
||||
{
|
||||
return button;
|
||||
}
|
||||
|
||||
public void setButton(Button button)
|
||||
{
|
||||
this.button = button;
|
||||
}
|
||||
|
||||
/**
|
||||
* A COPY of the {@link #buttonList} field from the GuiScreen referenced by {@link #gui}.
|
||||
*/
|
||||
public List<Button> getButtonList()
|
||||
{
|
||||
return buttonList;
|
||||
}
|
||||
|
||||
public void setButtonList(List<Button> buttonList)
|
||||
{
|
||||
this.buttonList = buttonList;
|
||||
}
|
||||
|
||||
/**
|
||||
* This event fires once it has been determined that a GuiButton object has been clicked.
|
||||
* Cancel this event to bypass {@link GuiScreen#actionPerformed(GuiButton)}.
|
||||
* Replace button with a different button from buttonList to have that button's action executed.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class Pre extends ActionPerformedEvent
|
||||
{
|
||||
public Pre(Screen gui, Button button, List<Button> buttonList)
|
||||
{
|
||||
super(gui, button, buttonList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This event fires after {@link GuiScreen#actionPerformed(GuiButton)} provided that the active
|
||||
* screen has not been changed as a result of {@link GuiScreen#actionPerformed(GuiButton)}.
|
||||
*/
|
||||
public static class Post extends ActionPerformedEvent
|
||||
{
|
||||
public Post(Screen gui, Button button, List<Button> buttonList)
|
||||
{
|
||||
super(gui, button, buttonList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class MouseInputEvent extends GuiScreenEvent
|
||||
{
|
||||
private final double mouseX;
|
||||
|
||||
@@ -28,6 +28,8 @@ import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.InputMappings;
|
||||
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public enum KeyModifier {
|
||||
@@ -53,11 +55,10 @@ public enum KeyModifier {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedComboName(InputMappings.Input key, Supplier<String> defaultLogic)
|
||||
public ITextComponent getCombinedName(InputMappings.Input key, Supplier<ITextComponent> defaultLogic)
|
||||
{
|
||||
String keyName = defaultLogic.get();
|
||||
String localizationFormatKey = Minecraft.IS_RUNNING_ON_MAC ? "forge.controlsgui.control.mac" : "forge.controlsgui.control";
|
||||
return I18n.format(localizationFormatKey, keyName);
|
||||
return new TranslationTextComponent(localizationFormatKey).func_240702_b_(" + ").func_230529_a_(defaultLogic.get());
|
||||
}
|
||||
},
|
||||
SHIFT {
|
||||
@@ -74,9 +75,9 @@ public enum KeyModifier {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedComboName(InputMappings.Input key, Supplier<String> defaultLogic)
|
||||
public ITextComponent getCombinedName(InputMappings.Input key, Supplier<ITextComponent> defaultLogic)
|
||||
{
|
||||
return I18n.format("forge.controlsgui.shift", defaultLogic.get());
|
||||
return new TranslationTextComponent("forge.controlsgui.shift").func_240702_b_(" + ").func_230529_a_(defaultLogic.get());
|
||||
}
|
||||
},
|
||||
ALT {
|
||||
@@ -93,9 +94,9 @@ public enum KeyModifier {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedComboName(InputMappings.Input keyCode, Supplier<String> defaultLogic)
|
||||
public ITextComponent getCombinedName(InputMappings.Input keyCode, Supplier<ITextComponent> defaultLogic)
|
||||
{
|
||||
return I18n.format("forge.controlsgui.alt", defaultLogic.get());
|
||||
return new TranslationTextComponent("forge.controlsgui.alt").func_240702_b_(" + ").func_230529_a_(defaultLogic.get());
|
||||
}
|
||||
},
|
||||
NONE {
|
||||
@@ -122,7 +123,7 @@ public enum KeyModifier {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedComboName(InputMappings.Input key, Supplier<String> defaultLogic)
|
||||
public ITextComponent getCombinedName(InputMappings.Input key, Supplier<ITextComponent> defaultLogic)
|
||||
{
|
||||
return defaultLogic.get();
|
||||
}
|
||||
@@ -170,5 +171,5 @@ public enum KeyModifier {
|
||||
|
||||
public abstract boolean isActive(@Nullable IKeyConflictContext conflictContext);
|
||||
|
||||
public abstract String getLocalizedComboName(InputMappings.Input key, Supplier<String> defaultLogic);
|
||||
public abstract ITextComponent getCombinedName(InputMappings.Input key, Supplier<ITextComponent> defaultLogic);
|
||||
}
|
||||
Reference in new issue
Block a user