From ff36403b4975402587d4625e8f6a2301f74ea61e Mon Sep 17 00:00:00 2001 From: Thiakil Date: Wed, 10 Jun 2026 20:44:10 +0800 Subject: [PATCH 1/2] apply magic constant annotations --- .../blaze3d/buffers/GpuBuffer.java.patch | 10 +++++++ .../pipeline/ColorTargetState.java.patch | 10 +++++++ .../platform/InputConstants.java.patch | 10 +++++++ .../blaze3d/textures/GpuTexture.java.patch | 10 +++++++ .../input/InputWithModifiers.java.patch | 10 +++++++ .../client/input/KeyEvent.java.patch | 10 +++++++ .../client/input/MouseButtonInfo.java.patch | 29 +++++++++++++++++++ .../model/geometry/BakedQuad.java.patch | 10 +++++++ .../server/level/TicketType.java.patch | 10 +++++++ .../minecraft/world/entity/Entity.java.patch | 10 +++++++ .../world/level/block/Block.java.patch | 8 +++++ 11 files changed, 127 insertions(+) create mode 100644 src/patches/com/mojang/blaze3d/buffers/GpuBuffer.java.patch create mode 100644 src/patches/com/mojang/blaze3d/pipeline/ColorTargetState.java.patch create mode 100644 src/patches/com/mojang/blaze3d/platform/InputConstants.java.patch create mode 100644 src/patches/com/mojang/blaze3d/textures/GpuTexture.java.patch create mode 100644 src/patches/net/minecraft/client/input/InputWithModifiers.java.patch create mode 100644 src/patches/net/minecraft/client/input/KeyEvent.java.patch create mode 100644 src/patches/net/minecraft/client/input/MouseButtonInfo.java.patch create mode 100644 src/patches/net/minecraft/client/resources/model/geometry/BakedQuad.java.patch create mode 100644 src/patches/net/minecraft/server/level/TicketType.java.patch create mode 100644 src/patches/net/minecraft/world/entity/Entity.java.patch diff --git a/src/patches/com/mojang/blaze3d/buffers/GpuBuffer.java.patch b/src/patches/com/mojang/blaze3d/buffers/GpuBuffer.java.patch new file mode 100644 index 00000000..18bf8ac0 --- /dev/null +++ b/src/patches/com/mojang/blaze3d/buffers/GpuBuffer.java.patch @@ -0,0 +1,10 @@ +--- a/com/mojang/blaze3d/buffers/GpuBuffer.java ++++ b/com/mojang/blaze3d/buffers/GpuBuffer.java +@@ -67,6 +_,7 @@ + @Retention(RetentionPolicy.CLASS) + @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.TYPE_USE}) + @OnlyIn(Dist.CLIENT) ++ @org.intellij.lang.annotations.MagicConstant(flagsFromClass = GpuBuffer.class) + public @interface Usage { + } + } diff --git a/src/patches/com/mojang/blaze3d/pipeline/ColorTargetState.java.patch b/src/patches/com/mojang/blaze3d/pipeline/ColorTargetState.java.patch new file mode 100644 index 00000000..b06082ac --- /dev/null +++ b/src/patches/com/mojang/blaze3d/pipeline/ColorTargetState.java.patch @@ -0,0 +1,10 @@ +--- a/com/mojang/blaze3d/pipeline/ColorTargetState.java ++++ b/com/mojang/blaze3d/pipeline/ColorTargetState.java +@@ -42,6 +_,7 @@ + @Retention(RetentionPolicy.CLASS) + @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.TYPE_USE}) + @OnlyIn(Dist.CLIENT) ++ @org.intellij.lang.annotations.MagicConstant(flags = {WRITE_RED, WRITE_GREEN, WRITE_BLUE, WRITE_ALPHA, WRITE_COLOR, WRITE_ALL, WRITE_NONE}) + public @interface WriteMask { + } + } diff --git a/src/patches/com/mojang/blaze3d/platform/InputConstants.java.patch b/src/patches/com/mojang/blaze3d/platform/InputConstants.java.patch new file mode 100644 index 00000000..e9447935 --- /dev/null +++ b/src/patches/com/mojang/blaze3d/platform/InputConstants.java.patch @@ -0,0 +1,10 @@ +--- a/com/mojang/blaze3d/platform/InputConstants.java ++++ b/com/mojang/blaze3d/platform/InputConstants.java +@@ -479,6 +_,7 @@ + @Retention(RetentionPolicy.CLASS) + @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.TYPE_USE}) + @OnlyIn(Dist.CLIENT) ++ @org.intellij.lang.annotations.MagicConstant(intValues = {KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N, KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12, KEY_F13, KEY_F14, KEY_F15, KEY_F16, KEY_F17, KEY_F18, KEY_F19, KEY_F20, KEY_F21, KEY_F22, KEY_F23, KEY_F24, KEY_F25, KEY_NUMLOCK, KEY_NUMPAD0, KEY_NUMPAD1, KEY_NUMPAD2, KEY_NUMPAD3, KEY_NUMPAD4, KEY_NUMPAD5, KEY_NUMPAD6, KEY_NUMPAD7, KEY_NUMPAD8, KEY_NUMPAD9, KEY_NUMPADCOMMA, KEY_NUMPADENTER, KEY_NUMPADEQUALS, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_UP, KEY_ADD, KEY_APOSTROPHE, KEY_BACKSLASH, KEY_COMMA, KEY_EQUALS, KEY_GRAVE, KEY_LBRACKET, KEY_MINUS, KEY_MULTIPLY, KEY_PERIOD, KEY_RBRACKET, KEY_SEMICOLON, KEY_SLASH, KEY_SPACE, KEY_TAB, KEY_LALT, KEY_LCONTROL, KEY_LSHIFT, KEY_LSUPER, KEY_RALT, KEY_RCONTROL, KEY_RSHIFT, KEY_RSUPER, KEY_RETURN, KEY_ESCAPE, KEY_BACKSPACE, KEY_DELETE, KEY_END, KEY_HOME, KEY_INSERT, KEY_PAGEDOWN, KEY_PAGEUP, KEY_CAPSLOCK, KEY_PAUSE, KEY_SCROLLLOCK, KEY_PRINTSCREEN} ) + public @interface Value { + } + } diff --git a/src/patches/com/mojang/blaze3d/textures/GpuTexture.java.patch b/src/patches/com/mojang/blaze3d/textures/GpuTexture.java.patch new file mode 100644 index 00000000..6bb4eb1d --- /dev/null +++ b/src/patches/com/mojang/blaze3d/textures/GpuTexture.java.patch @@ -0,0 +1,10 @@ +--- a/com/mojang/blaze3d/textures/GpuTexture.java ++++ b/com/mojang/blaze3d/textures/GpuTexture.java +@@ -70,6 +_,7 @@ + @Retention(RetentionPolicy.CLASS) + @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.TYPE_USE}) + @OnlyIn(Dist.CLIENT) ++ @org.intellij.lang.annotations.MagicConstant(flagsFromClass = GpuTexture.class) + public @interface Usage { + } + } diff --git a/src/patches/net/minecraft/client/input/InputWithModifiers.java.patch b/src/patches/net/minecraft/client/input/InputWithModifiers.java.patch new file mode 100644 index 00000000..930a004d --- /dev/null +++ b/src/patches/net/minecraft/client/input/InputWithModifiers.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/client/input/InputWithModifiers.java ++++ b/net/minecraft/client/input/InputWithModifiers.java +@@ -90,6 +_,7 @@ + @Retention(RetentionPolicy.CLASS) + @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.TYPE_USE}) + @OnlyIn(Dist.CLIENT) ++ @org.intellij.lang.annotations.MagicConstant(flags = {InputConstants.MOD_SHIFT, InputConstants.MOD_CONTROL, InputConstants.MOD_ALT, InputConstants.MOD_SUPER, InputConstants.MOD_CAPS_LOCK, InputConstants.MOD_NUM_LOCK}) + public @interface Modifiers { + } + } diff --git a/src/patches/net/minecraft/client/input/KeyEvent.java.patch b/src/patches/net/minecraft/client/input/KeyEvent.java.patch new file mode 100644 index 00000000..13aa7f80 --- /dev/null +++ b/src/patches/net/minecraft/client/input/KeyEvent.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/client/input/KeyEvent.java ++++ b/net/minecraft/client/input/KeyEvent.java +@@ -18,6 +_,7 @@ + @Retention(RetentionPolicy.CLASS) + @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.TYPE_USE}) + @OnlyIn(Dist.CLIENT) ++ @org.intellij.lang.annotations.MagicConstant(intValues = {InputConstants.PRESS, InputConstants.RELEASE, InputConstants.REPEAT}) + public @interface Action { + } + } diff --git a/src/patches/net/minecraft/client/input/MouseButtonInfo.java.patch b/src/patches/net/minecraft/client/input/MouseButtonInfo.java.patch new file mode 100644 index 00000000..c1c9d2e4 --- /dev/null +++ b/src/patches/net/minecraft/client/input/MouseButtonInfo.java.patch @@ -0,0 +1,29 @@ +--- a/net/minecraft/client/input/MouseButtonInfo.java ++++ b/net/minecraft/client/input/MouseButtonInfo.java +@@ -18,12 +_,26 @@ + @Retention(RetentionPolicy.CLASS) + @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.TYPE_USE}) + @OnlyIn(Dist.CLIENT) ++ @org.intellij.lang.annotations.MagicConstant(intValues = { ++ com.mojang.blaze3d.platform.InputConstants.PRESS, ++ com.mojang.blaze3d.platform.InputConstants.RELEASE ++ }) + public @interface Action { + } + + @Retention(RetentionPolicy.CLASS) + @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.TYPE_USE}) + @OnlyIn(Dist.CLIENT) ++ @org.intellij.lang.annotations.MagicConstant(intValues = { ++ com.mojang.blaze3d.platform.InputConstants.MOUSE_BUTTON_LEFT, ++ com.mojang.blaze3d.platform.InputConstants.MOUSE_BUTTON_RIGHT, ++ com.mojang.blaze3d.platform.InputConstants.MOUSE_BUTTON_MIDDLE, ++ com.mojang.blaze3d.platform.InputConstants.MOUSE_BUTTON_4, ++ com.mojang.blaze3d.platform.InputConstants.MOUSE_BUTTON_5, ++ com.mojang.blaze3d.platform.InputConstants.MOUSE_BUTTON_6, ++ com.mojang.blaze3d.platform.InputConstants.MOUSE_BUTTON_7, ++ com.mojang.blaze3d.platform.InputConstants.MOUSE_BUTTON_8 ++ }) + public @interface MouseButton { + } + } diff --git a/src/patches/net/minecraft/client/resources/model/geometry/BakedQuad.java.patch b/src/patches/net/minecraft/client/resources/model/geometry/BakedQuad.java.patch new file mode 100644 index 00000000..390d8d26 --- /dev/null +++ b/src/patches/net/minecraft/client/resources/model/geometry/BakedQuad.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/client/resources/model/geometry/BakedQuad.java ++++ b/net/minecraft/client/resources/model/geometry/BakedQuad.java +@@ -56,6 +_,7 @@ + @Retention(RetentionPolicy.CLASS) + @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.TYPE_USE}) + @OnlyIn(Dist.CLIENT) ++ @org.intellij.lang.annotations.MagicConstant(flags = {FLAG_TRANSLUCENT, FLAG_ANIMATED}) + public @interface MaterialFlags { + } + diff --git a/src/patches/net/minecraft/server/level/TicketType.java.patch b/src/patches/net/minecraft/server/level/TicketType.java.patch new file mode 100644 index 00000000..3475b681 --- /dev/null +++ b/src/patches/net/minecraft/server/level/TicketType.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/server/level/TicketType.java ++++ b/net/minecraft/server/level/TicketType.java +@@ -54,6 +_,7 @@ + + @Retention(RetentionPolicy.CLASS) + @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.TYPE_USE}) ++ @org.intellij.lang.annotations.MagicConstant(flags = {FLAG_PERSIST, FLAG_LOADING, FLAG_SIMULATION, FLAG_KEEP_DIMENSION_ACTIVE, FLAG_CAN_EXPIRE_IF_UNLOADED}) + public @interface Flags { + } + } diff --git a/src/patches/net/minecraft/world/entity/Entity.java.patch b/src/patches/net/minecraft/world/entity/Entity.java.patch new file mode 100644 index 00000000..5c838547 --- /dev/null +++ b/src/patches/net/minecraft/world/entity/Entity.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/entity/Entity.java ++++ b/net/minecraft/world/entity/Entity.java +@@ -4000,6 +_,7 @@ + + @Retention(RetentionPolicy.CLASS) + @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.TYPE_USE}) ++ @org.intellij.lang.annotations.MagicConstant(intValues = {FLAG_ONFIRE, FLAG_SHIFT_KEY_DOWN, FLAG_SPRINTING, FLAG_SWIMMING, FLAG_INVISIBLE, FLAG_GLOWING, FLAG_FALL_FLYING}) + public @interface Flags { + } + diff --git a/src/patches/net/minecraft/world/level/block/Block.java.patch b/src/patches/net/minecraft/world/level/block/Block.java.patch index 8e9f1f22..9221f1d1 100644 --- a/src/patches/net/minecraft/world/level/block/Block.java.patch +++ b/src/patches/net/minecraft/world/level/block/Block.java.patch @@ -9,3 +9,11 @@ } @Deprecated +@@ -603,6 +_,7 @@ + + @Retention(RetentionPolicy.CLASS) + @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.TYPE_USE}) ++ @org.intellij.lang.annotations.MagicConstant(flags = {UPDATE_NEIGHBORS, UPDATE_CLIENTS, UPDATE_INVISIBLE, UPDATE_IMMEDIATE, UPDATE_KNOWN_SHAPE, UPDATE_SUPPRESS_DROPS, UPDATE_MOVE_BY_PISTON, UPDATE_SKIP_SHAPE_UPDATE_ON_WIRE, UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS, UPDATE_SKIP_ON_PLACE}) + public @interface UpdateFlags { + } + } From 45da997d9805a331e537be4d7f31ca17b935b9ac Mon Sep 17 00:00:00 2001 From: Thiakil Date: Wed, 10 Jun 2026 20:48:08 +0800 Subject: [PATCH 2/2] unpick block update flags --- .../world/level/block/Block.java.patch | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/patches/net/minecraft/world/level/block/Block.java.patch b/src/patches/net/minecraft/world/level/block/Block.java.patch index 9221f1d1..44a62be7 100644 --- a/src/patches/net/minecraft/world/level/block/Block.java.patch +++ b/src/patches/net/minecraft/world/level/block/Block.java.patch @@ -1,5 +1,26 @@ --- a/net/minecraft/world/level/block/Block.java +++ b/net/minecraft/world/level/block/Block.java +@@ -99,13 +_,13 @@ + public static final int UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS = 256; + public static final int UPDATE_SKIP_ON_PLACE = 512; + @Block.UpdateFlags +- public static final int UPDATE_NONE = 260; +- @Block.UpdateFlags +- public static final int UPDATE_ALL = 3; +- @Block.UpdateFlags +- public static final int UPDATE_ALL_IMMEDIATE = 11; +- @Block.UpdateFlags +- public static final int UPDATE_SKIP_ALL_SIDEEFFECTS = 816; ++ public static final int UPDATE_NONE = UPDATE_INVISIBLE | UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS; ++ @Block.UpdateFlags ++ public static final int UPDATE_ALL = UPDATE_NEIGHBORS | UPDATE_CLIENTS; ++ @Block.UpdateFlags ++ public static final int UPDATE_ALL_IMMEDIATE = UPDATE_NEIGHBORS | UPDATE_CLIENTS | UPDATE_IMMEDIATE; ++ @Block.UpdateFlags ++ public static final int UPDATE_SKIP_ALL_SIDEEFFECTS = UPDATE_KNOWN_SHAPE | UPDATE_SUPPRESS_DROPS | UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS | UPDATE_SKIP_ON_PLACE; + public static final float INDESTRUCTIBLE = -1.0F; + public static final float INSTANT = 0.0F; + public static final int UPDATE_LIMIT = 512; @@ -574,7 +_,7 @@ }