Skip to content

Commit ef74971

Browse files
committed
✨ Updated to Minecraft 1.21.5
1 parent b4290f6 commit ef74971

File tree

31 files changed

+231
-247
lines changed

31 files changed

+231
-247
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
plugins {
2-
id 'fabric-loom' version '1.7-SNAPSHOT' apply false
2+
id 'fabric-loom' version '1.10-SNAPSHOT' apply false
33
id 'net.neoforged.moddev' version '2.0.73' apply false
44
}

common/src/main/java/com/mrcrayfish/controllable/client/CameraHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import com.mrcrayfish.controllable.client.util.EventHelper;
99
import com.mrcrayfish.controllable.client.util.InputHelper;
1010
import com.mrcrayfish.controllable.event.Value;
11-
import com.mrcrayfish.framework.api.event.TickEvents;
11+
import com.mrcrayfish.framework.api.event.client.FrameworkClientTickEvents;
1212
import net.minecraft.client.DeltaTracker;
1313
import net.minecraft.client.Minecraft;
1414
import org.jetbrains.annotations.ApiStatus;
@@ -36,8 +36,8 @@ public void registerEvents()
3636
{
3737
if(!this.initialized)
3838
{
39-
TickEvents.START_CLIENT.register(this::updateRotationDelta);
40-
TickEvents.START_RENDER.register(this::updateCamera);
39+
FrameworkClientTickEvents.START_CLIENT.register(this::updateRotationDelta);
40+
FrameworkClientTickEvents.START_RENDER.register(this::updateCamera);
4141
this.initialized = true;
4242
}
4343
}

common/src/main/java/com/mrcrayfish/controllable/client/ControllerEvents.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.mrcrayfish.controllable.client.gui.screens.SettingsScreen;
66
import com.mrcrayfish.controllable.client.gui.widget.ControllerButton;
77
import com.mrcrayfish.controllable.client.input.Controller;
8-
import com.mrcrayfish.framework.api.event.ScreenEvents;
8+
import com.mrcrayfish.framework.api.event.client.FrameworkScreenEvents;
99
import net.minecraft.client.Minecraft;
1010
import net.minecraft.client.gui.components.AbstractWidget;
1111
import net.minecraft.client.gui.components.Button;
@@ -24,11 +24,10 @@ public class ControllerEvents
2424
{
2525
public static void init()
2626
{
27-
ScreenEvents.INIT.register(ControllerEvents::onScreenInit);
28-
ScreenEvents.MODIFY_WIDGETS.register(ControllerEvents::onModifyScreenWidgets);
27+
FrameworkScreenEvents.INIT.register(ControllerEvents::onModifyScreenWidgets);
2928
}
3029

31-
private static void onScreenInit(Screen screen)
30+
private static void onModifyScreenWidgets(Screen screen, List<AbstractWidget> widgets, Consumer<AbstractWidget> add, Consumer<AbstractWidget> remove)
3231
{
3332
ButtonBinding.resetButtonStates();
3433

@@ -42,10 +41,7 @@ private static void onScreenInit(Screen screen)
4241
mc.gameMode.releaseUsingItem(mc.player);
4342
}
4443
}
45-
}
4644

47-
private static void onModifyScreenWidgets(Screen screen, List<AbstractWidget> widgets, Consumer<AbstractWidget> add, Consumer<AbstractWidget> remove)
48-
{
4945
if(screen instanceof OptionsScreen)
5046
{
5147
Optional<AbstractWidget> btn = widgets.stream().filter(widget -> widget instanceof Button button &&

common/src/main/java/com/mrcrayfish/controllable/client/InputHandler.java

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@
2626
import com.mrcrayfish.controllable.client.input.Controller;
2727
import com.mrcrayfish.controllable.client.settings.AnalogMovement;
2828
import com.mrcrayfish.controllable.client.settings.Thumbstick;
29-
import com.mrcrayfish.controllable.client.util.ClientHelper;
30-
import com.mrcrayfish.controllable.client.util.EventHelper;
31-
import com.mrcrayfish.controllable.client.util.InputHelper;
32-
import com.mrcrayfish.controllable.client.util.MouseHooks;
29+
import com.mrcrayfish.controllable.client.util.*;
3330
import com.mrcrayfish.controllable.event.ControllerEvents;
3431
import com.mrcrayfish.controllable.integration.EmiSupport;
3532
import com.mrcrayfish.controllable.integration.JeiSupport;
@@ -38,8 +35,9 @@
3835
import com.mrcrayfish.controllable.mixin.client.RecipeBookComponentAccessor;
3936
import com.mrcrayfish.controllable.mixin.client.RecipeBookPageAccessor;
4037
import com.mrcrayfish.controllable.platform.ClientServices;
41-
import com.mrcrayfish.framework.api.event.ClientEvents;
42-
import com.mrcrayfish.framework.api.event.TickEvents;
38+
import com.mrcrayfish.framework.api.event.FrameworkTickEvents;
39+
import com.mrcrayfish.framework.api.event.client.FrameworkClientTickEvents;
40+
import com.mrcrayfish.framework.api.event.client.FrameworkInputEvents;
4341
import net.minecraft.client.CameraType;
4442
import net.minecraft.client.Minecraft;
4543
import net.minecraft.client.gui.components.AbstractSelectionList;
@@ -116,11 +114,11 @@ public void registerEvents()
116114
{
117115
if(!this.initialized)
118116
{
119-
TickEvents.START_CLIENT.register(this::onStartClickTick);
120-
TickEvents.END_CLIENT.register(this::onEndClickTick);
121-
TickEvents.START_PLAYER.register(this::onStartPlayerTick);
122-
TickEvents.END_PLAYER.register(this::onEndPlayerTick);
123-
ClientEvents.PLAYER_INPUT_UPDATE.register(this::updateInput);
117+
FrameworkClientTickEvents.START_CLIENT.register(this::onStartClickTick);
118+
FrameworkClientTickEvents.END_CLIENT.register(this::onEndClickTick);
119+
FrameworkTickEvents.START_PLAYER.register(this::onStartPlayerTick);
120+
FrameworkTickEvents.END_PLAYER.register(this::onEndPlayerTick);
121+
FrameworkInputEvents.CLIENT_INPUT_UPDATE.register(this::updateInput);
124122
this.initialized = true;
125123
}
126124
}
@@ -317,6 +315,7 @@ private void updateInput(Player player, ClientInput input)
317315
}
318316
}
319317

318+
MutableClientInput mutableInput = new MutableClientInput(input);
320319
boolean up = false;
321320
boolean down = false;
322321
boolean left = false;
@@ -326,7 +325,7 @@ private void updateInput(Player player, ClientInput input)
326325
{
327326
up = inputY < 0;
328327
down = inputY > 0;
329-
input.forwardImpulse = -inputY;
328+
mutableInput.setForwardImpulse(-inputY);
330329
controller.updateInputTime();
331330
}
332331

@@ -335,23 +334,20 @@ private void updateInput(Player player, ClientInput input)
335334
{
336335
right = inputX > 0;
337336
left = inputX < 0;
338-
input.leftImpulse = -inputX;
337+
mutableInput.setLeftImpulse(-inputX);
339338
controller.updateInputTime();
340339
}
341340

342341
// Update key presses if there is a change
343342
if(up || down || left || right)
344343
{
345-
input.keyPresses = new Input(
346-
input.keyPresses.forward() || up,
347-
input.keyPresses.backward() || down,
348-
input.keyPresses.left() || left,
349-
input.keyPresses.right() || right,
350-
input.keyPresses.jump(),
351-
input.keyPresses.shift(),
352-
input.keyPresses.sprint()
353-
);
344+
mutableInput.setForward(up);
345+
mutableInput.setBackward(down);
346+
mutableInput.setLeft(left);
347+
mutableInput.setRight(right);
354348
}
349+
350+
mutableInput.apply();
355351
}
356352
}
357353
}
@@ -360,7 +356,7 @@ public static void navigateToHotbarSlot(Context context, int index)
360356
{
361357
if(context.screen().isEmpty()) {
362358
context.player().ifPresent(player -> {
363-
player.getInventory().selected = index;
359+
player.getInventory().setSelectedSlot(index);
364360
});
365361
}
366362
}

common/src/main/java/com/mrcrayfish/controllable/client/InputProcessor.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import com.mrcrayfish.controllable.client.input.Buttons;
1010
import com.mrcrayfish.controllable.client.input.Controller;
1111
import com.mrcrayfish.controllable.client.input.AdaptiveControllerManager;
12-
import com.mrcrayfish.framework.api.event.TickEvents;
12+
import com.mrcrayfish.framework.api.event.client.FrameworkClientTickEvents;
1313
import net.minecraft.client.Minecraft;
1414
import net.minecraft.client.gui.screens.Screen;
1515
import org.jetbrains.annotations.ApiStatus;
@@ -39,10 +39,10 @@ public void registerEvents()
3939
{
4040
if(!this.initialized)
4141
{
42-
TickEvents.START_RENDER.register((partialTick) -> this.pollControllerInput(false));
43-
TickEvents.END_RENDER.register((partialTick) -> this.pollControllerInput(false));
44-
TickEvents.START_CLIENT.register(() -> this.pollControllerInput(true));
45-
TickEvents.END_CLIENT.register(() -> this.pollControllerInput(false));
42+
FrameworkClientTickEvents.START_RENDER.register((partialTick) -> this.pollControllerInput(false));
43+
FrameworkClientTickEvents.END_RENDER.register((partialTick) -> this.pollControllerInput(false));
44+
FrameworkClientTickEvents.START_CLIENT.register(() -> this.pollControllerInput(true));
45+
FrameworkClientTickEvents.END_CLIENT.register(() -> this.pollControllerInput(false));
4646
this.initialized = true;
4747
}
4848
}

0 commit comments

Comments
 (0)