Update StationScreen to use InputConstants

Updates the StationScreen class to use the Mojang InputConstants instead of numbers for the ENTER keypress detection
This commit is contained in:
OutCraft 2022-12-20 20:27:57 +01:00 committed by GitHub
parent 8d89080bc0
commit 66b495906b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,7 @@ import java.util.List;
import java.util.function.Consumer;
import com.jozufozu.flywheel.core.PartialModel;
import com.mojang.blaze3d.platform.InputConstants;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials;
@ -310,7 +311,8 @@ public class StationScreen extends AbstractStationScreen {
@Override
public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers) {
boolean hitEnter = getFocused() instanceof EditBox && (pKeyCode == 257 || pKeyCode == 335);
boolean hitEnter = getFocused() instanceof EditBox
&& (pKeyCode == InputConstants.KEY_RETURN || pKeyCode == InputConstants.KEY_NUMPADENTER);
if (hitEnter && nameBox.isFocused()) {
nameBox.setFocus(false);