Updated to 23w31a

This commit is contained in:
shedaniel
2023-08-04 19:31:02 +08:00
parent 18ba59c904
commit 38edbd29d3
15 changed files with 50 additions and 44 deletions

View File

@@ -7,7 +7,7 @@ on:
- '**.properties'
- '**/src/**'
branches:
- "1.20"
- "1.20.2"
types: [ opened, synchronize, reopened ]
jobs:
validate-gradle:

View File

@@ -7,7 +7,7 @@ on:
- '**.properties'
- '**/src/**'
branches:
- "1.20"
- "1.20.2"
workflow_dispatch:
inputs:
norelease:

View File

@@ -29,7 +29,7 @@ import net.minecraft.client.Minecraft;
@Environment(EnvType.CLIENT)
public interface ClientRawInputEvent {
/**
* @see MouseScrolled#mouseScrolled(Minecraft, double)
* @see MouseScrolled#mouseScrolled(Minecraft, double, double)
*/
Event<MouseScrolled> MOUSE_SCROLLED = EventFactory.createEventResult();
/**
@@ -63,12 +63,13 @@ public interface ClientRawInputEvent {
* Invoked whenever the mouse scroll wheel is used.
* Equivalent to Forge's {@code InputEvent.MouseScrollEvent} event.
*
* @param client The Minecraft instance performing it.
* @param amount The amount of movement.
* @param client The Minecraft instance performing it.
* @param amountX The amount of movement on the X axis.
* @param amountY The amount of movement on the Y axis.
* @return A {@link EventResult} determining the outcome of the event,
* the execution of the vanilla scrolling mechanism may be cancelled by the result.
*/
EventResult mouseScrolled(Minecraft client, double amount);
EventResult mouseScrolled(Minecraft client, double amountX, double amountY);
}
interface MouseClicked {

View File

@@ -30,7 +30,7 @@ import net.minecraft.client.gui.screens.Screen;
@Environment(EnvType.CLIENT)
public interface ClientScreenInputEvent {
/**
* @see MouseScrolled#mouseScrolled(Minecraft, Screen, double, double, double)
* @see MouseScrolled#mouseScrolled(Minecraft, Screen, double, double, double, double)
*/
Event<MouseScrolled> MOUSE_SCROLLED_PRE = EventFactory.createEventResult();
Event<MouseScrolled> MOUSE_SCROLLED_POST = EventFactory.createEventResult();
@@ -129,15 +129,16 @@ public interface ClientScreenInputEvent {
* <p> This event is handled in two phases PRE and POST, which are invoked
* before and after the keys have been processed by the screen, respectively.
*
* @param client The Minecraft instance performing it.
* @param screen The screen this keystroke was performed in.
* @param mouseX The scaled x-coordinate of the mouse cursor.
* @param mouseY The scaled y-coordinate of the mouse cursor.
* @param amount The amount the scroll wheel is moved.
* @param client The Minecraft instance performing it.
* @param screen The screen this keystroke was performed in.
* @param mouseX The scaled x-coordinate of the mouse cursor.
* @param mouseY The scaled y-coordinate of the mouse cursor.
* @param amountX The amount the scroll wheel is moved horizontally.
* @param amountY The amount the scroll wheel is moved vertically.
* @return A {@link EventResult} determining the outcome of the event,
* the execution of the vanilla scrolling mechanism may be cancelled by the result.
*/
EventResult mouseScrolled(Minecraft client, Screen screen, double mouseX, double mouseY, double amount);
EventResult mouseScrolled(Minecraft client, Screen screen, double mouseX, double mouseY, double amountX, double amountY);
}
interface MouseReleased {

View File

@@ -32,7 +32,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(PlayerList.class)
public class MixinPlayerList {
@Inject(method = "placeNewPlayer", at = @At("RETURN"))
private void placeNewPlayer(Connection connection, ServerPlayer serverPlayer, CallbackInfo ci) {
private void placeNewPlayer(Connection connection, ServerPlayer serverPlayer, int latency, CallbackInfo ci) {
PlayerEvent.PLAYER_JOIN.invoker().join(serverPlayer);
}

View File

@@ -35,7 +35,7 @@ public abstract class MixinAbstractContainerScreen extends Screen {
super(component);
}
@Inject(method = "render",
@Inject(method = "renderBackground",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/AbstractContainerScreen;renderBg(Lnet/minecraft/client/gui/GuiGraphics;FII)V",
ordinal = 0, shift = At.Shift.AFTER))
public void renderBackground(GuiGraphics graphics, int mouseX, int mouseY, float delta, CallbackInfo ci) {

View File

@@ -24,9 +24,12 @@ import dev.architectury.event.events.client.ClientChatEvent;
import dev.architectury.event.events.client.ClientPlayerEvent;
import dev.architectury.event.events.client.ClientRecipeUpdateEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.client.multiplayer.CommonListenerCookie;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.network.Connection;
import net.minecraft.network.protocol.game.ClientboundLoginPacket;
import net.minecraft.network.protocol.game.ClientboundRespawnPacket;
import net.minecraft.network.protocol.game.ClientboundUpdateRecipesPacket;
@@ -40,10 +43,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ClientPacketListener.class)
public class MixinClientPacketListener {
@Shadow
@Final
private Minecraft minecraft;
public abstract class MixinClientPacketListener extends ClientCommonPacketListenerImpl {
@Shadow
@Final
private RecipeManager recipeManager;
@@ -52,6 +52,10 @@ public class MixinClientPacketListener {
@Unique
private LocalPlayer tmpPlayer;
protected MixinClientPacketListener(Minecraft minecraft, Connection connection, CommonListenerCookie commonListenerCookie) {
super(minecraft, connection, commonListenerCookie);
}
@Inject(method = "handleLogin", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Options;broadcastOptions()V"))
private void handleLogin(ClientboundLoginPacket packet, CallbackInfo ci) {
ClientPlayerEvent.CLIENT_PLAYER_JOIN.invoker().join(minecraft.player);

View File

@@ -57,7 +57,7 @@ public abstract class MixinMinecraft {
@Unique
private ThreadLocal<Boolean> setScreenCancelled = new ThreadLocal<>();
@Inject(method = "clearLevel(Lnet/minecraft/client/gui/screens/Screen;)V",
@Inject(method = "disconnect(Lnet/minecraft/client/gui/screens/Screen;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/GameNarrator;clear()V"))
private void handleLogin(Screen screen, CallbackInfo ci) {
ClientPlayerEvent.CLIENT_PLAYER_QUIT.invoker().quit(player);

View File

@@ -49,31 +49,31 @@ public class MixinMouseHandler {
private double ypos;
@Inject(method = "onScroll",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;mouseScrolled(DDD)Z",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;mouseScrolled(DDDD)Z",
ordinal = 0), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
public void onMouseScrolled(long handle, double xOffset, double yOffset, CallbackInfo info, double amount, double x, double y) {
public void onMouseScrolled(long handle, double xOffset, double yOffset, CallbackInfo info, boolean discreteMouseScroll, double mouseWheelSensitivity, double amountX, double amountY, double x, double y) {
if (!info.isCancelled()) {
var result = ClientScreenInputEvent.MOUSE_SCROLLED_PRE.invoker().mouseScrolled(minecraft, minecraft.screen, x, y, amount);
var result = ClientScreenInputEvent.MOUSE_SCROLLED_PRE.invoker().mouseScrolled(minecraft, minecraft.screen, x, y, amountX, amountY);
if (result.isPresent())
info.cancel();
}
}
@Inject(method = "onScroll",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;mouseScrolled(DDD)Z",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;mouseScrolled(DDDD)Z",
ordinal = 0, shift = At.Shift.AFTER), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
public void onMouseScrolledPost(long handle, double xOffset, double yOffset, CallbackInfo info, double amount, double x, double y) {
public void onMouseScrolledPost(long handle, double xOffset, double yOffset, CallbackInfo info, boolean discreteMouseScroll, double mouseWheelSensitivity, double amountX, double amountY, double x, double y) {
if (!info.isCancelled()) {
var result = ClientScreenInputEvent.MOUSE_SCROLLED_POST.invoker().mouseScrolled(minecraft, minecraft.screen, x, y, amount);
var result = ClientScreenInputEvent.MOUSE_SCROLLED_POST.invoker().mouseScrolled(minecraft, minecraft.screen, x, y, amountX, amountY);
}
}
@Inject(method = "onScroll",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;isSpectator()Z",
ordinal = 0), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
public void onRawMouseScrolled(long handle, double xOffset, double yOffset, CallbackInfo info, double amount) {
public void onRawMouseScrolled(long handle, double xOffset, double yOffset, CallbackInfo info, boolean discreteMouseScroll, double mouseWheelSensitivity, double amountX, double doubleY) {
if (!info.isCancelled()) {
var result = ClientRawInputEvent.MOUSE_SCROLLED.invoker().mouseScrolled(minecraft, amount);
var result = ClientRawInputEvent.MOUSE_SCROLLED.invoker().mouseScrolled(minecraft, amountX, doubleY);
if (result.isPresent())
info.cancel();
}

View File

@@ -34,7 +34,7 @@
},
"icon": "icon.png",
"depends": {
"minecraft": "~1.20-",
"minecraft": "~1.20.2-",
"fabricloader": ">=0.14.0",
"fabric-api": ">=0.66.0"
},

View File

@@ -17,7 +17,7 @@ license = "LGPL-3"
[[dependencies.architectury]]
modId = "minecraft"
mandatory = true
versionRange = "[1.20,)"
versionRange = "[1.20.2,)"
ordering = "NONE"
side = "BOTH"

View File

@@ -1,20 +1,20 @@
org.gradle.jvmargs=-Xmx6G
org.gradle.daemon=false
platforms=fabric,forge
platforms=fabric
minecraft_version=1.20
supported_version=1.20(.1)
minecraft_version=23w31a
supported_version=23w31a
artifact_type=release
artifact_type=beta
archives_base_name=architectury
archives_base_name_snapshot=architectury-snapshot
base_version=9.1
base_version=10.0
maven_group=dev.architectury
fabric_loader_version=0.14.21
fabric_api_version=0.83.0+1.20
fabric_loader_version=0.14.22
fabric_api_version=0.86.1+1.20.2
mod_menu_version=7.0.0
forge_version=46.0.1

View File

@@ -13,9 +13,9 @@ if (JavaVersion.current().ordinal() + 1 < 17) {
include("common")
include("fabric")
include("forge")
//include("forge")
include("testmod-common")
include("testmod-fabric")
include("testmod-forge")
//include("testmod-forge")
rootProject.name = "architectury"

View File

@@ -305,8 +305,8 @@ public class DebugEvents {
// ClientTextureStitchEvent.POST.register(atlas -> {
// TestMod.SINK.accept("Client texture stitched: " + atlas.location());
// });
ClientScreenInputEvent.MOUSE_SCROLLED_PRE.register((client, screen, mouseX, mouseY, amount) -> {
TestMod.SINK.accept("Screen Mouse scrolled: %.2f distance", amount);
ClientScreenInputEvent.MOUSE_SCROLLED_PRE.register((client, screen, mouseX, mouseY, amountX, amountY) -> {
TestMod.SINK.accept("Screen Mouse scrolled: %.2f x-distance %.2f y-distance", amountX, amountY);
return EventResult.pass();
});
ClientScreenInputEvent.MOUSE_CLICKED_PRE.register((client, screen, mouseX, mouseY, button) -> {
@@ -333,8 +333,8 @@ public class DebugEvents {
TestMod.SINK.accept("Screen Key released: " + InputConstants.getKey(keyCode, scanCode).getDisplayName().getString());
return EventResult.pass();
});
ClientRawInputEvent.MOUSE_SCROLLED.register((client, amount) -> {
TestMod.SINK.accept("Raw Mouse scrolled: %.2f distance", amount);
ClientRawInputEvent.MOUSE_SCROLLED.register((client, amountX, amountY) -> {
TestMod.SINK.accept("Raw Mouse scrolled: %.2f x-distance %.2f y-distance", amountX, amountY);
return EventResult.pass();
});
ClientRawInputEvent.MOUSE_CLICKED_PRE.register((client, button, action, mods) -> {

View File

@@ -39,7 +39,7 @@ public class SyncDataMessage extends BaseS2CMessage {
}
public SyncDataMessage(FriendlyByteBuf buf) {
serverData = buf.readAnySizeNbt();
serverData = buf.readNbt();
}
@Override