mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-14 07:35:10 +01:00
Initial port to 1.21.3
- Still waiting for SpruceUI to update, only use the advanced config in the meantime
This commit is contained in:
@@ -60,10 +60,11 @@ public class InputHandlers {
|
||||
// When in-game
|
||||
if (client.currentScreen == null && client.player != null) {
|
||||
if (!client.player.isSpectator()) {
|
||||
var inv = client.player.getInventory();
|
||||
if (next)
|
||||
client.player.getInventory().scrollInHotbar(-1.0);
|
||||
inv.setSelectedSlot(inv.selectedSlot < 8 ? inv.selectedSlot + 1 : inv.selectedSlot - 8);
|
||||
else
|
||||
client.player.getInventory().scrollInHotbar(1.0);
|
||||
inv.setSelectedSlot(inv.selectedSlot > 0 ? inv.selectedSlot - 1 : inv.selectedSlot + 8);
|
||||
}
|
||||
else {
|
||||
if (client.inGameHud.getSpectatorHud().isOpen()) {
|
||||
@@ -79,11 +80,9 @@ public class InputHandlers {
|
||||
} else if (client.currentScreen instanceof CreativeInventoryScreenAccessor inventory) {
|
||||
inventory.midnightcontrols$setSelectedTab(ItemGroupUtil.cycleTab(next, client));
|
||||
return true;
|
||||
} else if (client.currentScreen instanceof InventoryScreen || client.currentScreen instanceof CraftingScreen || client.currentScreen instanceof AbstractFurnaceScreen<?>) {
|
||||
RecipeBookWidget recipeBook;
|
||||
if (client.currentScreen instanceof InventoryScreen inventoryScreen) recipeBook = inventoryScreen.getRecipeBookWidget();
|
||||
else if (client.currentScreen instanceof CraftingScreen craftingScreen) recipeBook = craftingScreen.getRecipeBookWidget();
|
||||
else recipeBook = ((AbstractFurnaceScreen<?>)client.currentScreen).getRecipeBookWidget();
|
||||
} else if (client.currentScreen instanceof RecipeBookScreen<?> recipeBookScreen) {
|
||||
RecipeBookWidget<?> recipeBook = ((RecipeBookScreenAccessor) recipeBookScreen).getRecipeBook();
|
||||
|
||||
var recipeBookAccessor = (RecipeBookWidgetAccessor) recipeBook;
|
||||
var tabs = recipeBookAccessor.getTabButtons();
|
||||
var currentTab = recipeBookAccessor.getCurrentTab();
|
||||
@@ -98,7 +97,7 @@ public class InputHandlers {
|
||||
currentTab.setToggled(false);
|
||||
recipeBookAccessor.setCurrentTab(currentTab = tabs.get(nextTab));
|
||||
currentTab.setToggled(true);
|
||||
recipeBookAccessor.midnightcontrols$refreshResults(true);
|
||||
recipeBookScreen.refreshRecipeBook();
|
||||
return true;
|
||||
} else if (client.currentScreen instanceof AdvancementsScreenAccessor screen) {
|
||||
var tabs = screen.getTabs().values().stream().distinct().toList();
|
||||
|
||||
@@ -48,10 +48,11 @@ public final class MovementHandler implements PressAction {
|
||||
public void applyMovement(@NotNull ClientPlayerEntity player) {
|
||||
if (!this.shouldOverrideMovement)
|
||||
return;
|
||||
player.input.pressingForward = this.pressingForward;
|
||||
player.input.pressingBack = this.pressingBack;
|
||||
player.input.pressingLeft = this.pressingLeft;
|
||||
player.input.pressingRight = this.pressingRight;
|
||||
// TODO
|
||||
// player.input.playerInput.pressingForward = this.pressingForward;
|
||||
// player.input.pressingBack = this.pressingBack;
|
||||
// player.input.pressingLeft = this.pressingLeft;
|
||||
// player.input.pressingRight = this.pressingRight;
|
||||
|
||||
polarUtil.calculate(this.movementSideways, this.movementForward, this.slowdownFactor);
|
||||
player.input.movementForward = polarUtil.polarY;
|
||||
@@ -81,7 +82,7 @@ public final class MovementHandler implements PressAction {
|
||||
}
|
||||
|
||||
this.slowdownFactor = client.player.shouldSlowDown() ? (MathHelper.clamp(
|
||||
0.3F + (float) client.player.getAttributeValue(EntityAttributes.PLAYER_SNEAKING_SPEED),
|
||||
0.3F + (float) client.player.getAttributeValue(EntityAttributes.SNEAKING_SPEED),
|
||||
0.0F,
|
||||
1.0F
|
||||
)) : 1.f;
|
||||
|
||||
Reference in New Issue
Block a user