|
19 | 19 |
|
20 | 20 | import java.awt.Color; |
21 | 21 |
|
| 22 | +//? if >=1.21.9 { |
| 23 | +import net.minecraft.client.input.CharacterEvent; |
| 24 | +import net.minecraft.client.input.KeyEvent; |
| 25 | +import net.minecraft.client.input.MouseButtonEvent; |
| 26 | +//?} |
| 27 | + |
22 | 28 | public abstract class AbstractWidget implements GuiEventListener, Renderable, NarratableEntry { |
23 | 29 | protected final Minecraft client = Minecraft.getInstance(); |
24 | 30 | protected final Font textRenderer = client.font; |
@@ -123,4 +129,95 @@ protected int multiplyColor(int hex, float amount) { |
123 | 129 | public void playDownSound() { |
124 | 130 | Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); |
125 | 131 | } |
| 132 | + |
| 133 | + //? if >=1.21.9 { |
| 134 | + @Override |
| 135 | + public final boolean mouseClicked(MouseButtonEvent mouseButtonEvent, boolean doubleClick) { |
| 136 | + return this.onMouseClicked(mouseButtonEvent.x(), mouseButtonEvent.y(), mouseButtonEvent.button()); |
| 137 | + } |
| 138 | + //?} else { |
| 139 | + /*@Override |
| 140 | + public final boolean mouseClicked(double mouseX, double mouseY, int button) { |
| 141 | + return this.onMouseClicked(mouseX, mouseY, button); |
| 142 | + } |
| 143 | + *///?} |
| 144 | + public boolean onMouseClicked(double mouseX, double mouseY, int button) { |
| 145 | + return false; |
| 146 | + } |
| 147 | + |
| 148 | + //? if >=1.21.9 { |
| 149 | + @Override |
| 150 | + public final boolean mouseReleased(MouseButtonEvent mouseButtonEvent) { |
| 151 | + return this.onMouseReleased(mouseButtonEvent.x(), mouseButtonEvent.y(), mouseButtonEvent.button()); |
| 152 | + } |
| 153 | + //?} else { |
| 154 | + /*@Override |
| 155 | + public final boolean mouseReleased(double mouseX, double mouseY, int button) { |
| 156 | + return this.onMouseReleased(mouseX, mouseY, button); |
| 157 | + } |
| 158 | + *///?} |
| 159 | + public boolean onMouseReleased(double mouseX, double mouseY, int button) { |
| 160 | + return false; |
| 161 | + } |
| 162 | + |
| 163 | + //? if >=1.21.9 { |
| 164 | + @Override |
| 165 | + public final boolean mouseDragged(MouseButtonEvent mouseButtonEvent, double dx, double dy) { |
| 166 | + return this.onMouseDragged(mouseButtonEvent.x(), mouseButtonEvent.y(), mouseButtonEvent.button(), dx, dy); |
| 167 | + } |
| 168 | + //?} else { |
| 169 | + /*@Override |
| 170 | + public final boolean mouseDragged(double mouseX, double mouseY, int button, double dx, double dy) { |
| 171 | + return this.onMouseDragged(mouseX, mouseY, button, dx, dy); |
| 172 | + } |
| 173 | + *///?} |
| 174 | + public boolean onMouseDragged(double mouseX, double mouseY, int button, double dx, double dy) { |
| 175 | + return false; |
| 176 | + } |
| 177 | + |
| 178 | + //? if >=1.21.9 { |
| 179 | + @Override |
| 180 | + public final boolean keyPressed(KeyEvent keyEvent) { |
| 181 | + return this.onKeyPressed(keyEvent.key(), keyEvent.scancode(), keyEvent.modifiers()); |
| 182 | + } |
| 183 | + //?} else { |
| 184 | + /*@Override |
| 185 | + public final boolean keyPressed(int keycode, int scancode, int modifiers) { |
| 186 | + return this.onKeyPressed(keycode, scancode, modifiers); |
| 187 | + } |
| 188 | + *///?} |
| 189 | + public boolean onKeyPressed(int key, int scancode, int modifiers) { |
| 190 | + return false; |
| 191 | + } |
| 192 | + |
| 193 | + //? if >=1.21.9 { |
| 194 | + @Override |
| 195 | + public final boolean keyReleased(KeyEvent keyEvent) { |
| 196 | + return this.onKeyReleased(keyEvent.key(), keyEvent.scancode(), keyEvent.modifiers()); |
| 197 | + } |
| 198 | + //?} else { |
| 199 | + /*@Override |
| 200 | + public final boolean keyReleased(int keycode, int scancode, int modifiers) { |
| 201 | + return this.onKeyReleased(keycode, scancode, modifiers); |
| 202 | + } |
| 203 | + *///?} |
| 204 | + public boolean onKeyReleased(int key, int scancode, int modifiers) { |
| 205 | + return false; |
| 206 | + } |
| 207 | + |
| 208 | + //? if >=1.21.9 { |
| 209 | + @Override |
| 210 | + public final boolean charTyped(CharacterEvent characterEvent) { |
| 211 | + return this.onCharTyped((char) characterEvent.codepoint(), characterEvent.codepointAsString(), characterEvent.modifiers()); |
| 212 | + } |
| 213 | + //?} else { |
| 214 | + /*@Override |
| 215 | + public final boolean charTyped(char codePoint, int modifiers) { |
| 216 | + return this.onCharTyped(codePoint, Character.toString(codePoint), modifiers); |
| 217 | + } |
| 218 | + *///?} |
| 219 | + public boolean onCharTyped(char ch, String cpStr, int modifiers) { |
| 220 | + return false; |
| 221 | + } |
| 222 | + |
126 | 223 | } |
0 commit comments