Skip to content

Commit 90d00a4

Browse files
Merge remote-tracking branch 'origin/1.16.5-forge' into 1.17.1-forge
2 parents 5ddc146 + 251707c commit 90d00a4

5 files changed

Lines changed: 9 additions & 17 deletions

File tree

src/main/java/cam72cam/mod/UMCMixinPlugin.java renamed to src/main/java/cam72cam/mod/UMCMixinExtrasLoader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
import java.util.List;
1010
import java.util.Set;
1111

12-
public class UMCMixinPlugin implements IMixinConfigPlugin {
12+
public class UMCMixinExtrasLoader implements IMixinConfigPlugin {
1313
@Override
1414
public void onLoad(String mixinPackage) {
1515
MixinExtrasBootstrap.init();
16-
}
16+
}
1717

1818
@Override
1919
public String getRefMapperConfig() {

src/main/java/cam72cam/mod/event/ClientEvents.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ public static void onClientTick(TickEvent.ClientTickEvent event) {
119119
}
120120

121121
private static void onGuiMouse(GuiScreenEvent.MouseInputEvent event, int btn, MouseAction action) {
122-
MouseGuiEvent mevt = new MouseGuiEvent(action, (int) event.getMouseX(), (int) event.getMouseY(), btn, event instanceof GuiScreenEvent.MouseScrollEvent ? (int) ((GuiScreenEvent.MouseScrollEvent) event).getScrollDelta() : 0);
122+
MouseGuiEvent mevt = new MouseGuiEvent(action, (int) event.getMouseX(), (int) event.getMouseY(), btn, action == MouseAction.SCROLL ? (int) ((GuiScreenEvent.MouseScrollEvent) event).getScrollDelta() : 0);
123123

124124
if (!MOUSE_GUI.executeCancellable(h -> h.apply(mevt))) {
125125
event.setCanceled(true);
126-
if (!(event instanceof GuiScreenEvent.MouseScrollEvent)) {
126+
if (action != MouseAction.SCROLL) {
127127
// Apparently cancelling this input event only cancels it for the *GUI* handlers, not all input handlers
128128
// Therefore we need to track that ourselves. Thanks for changing that from 1.12.2-forge
129129
skipNextMouseInputEvent = true;
@@ -145,7 +145,7 @@ public static void onGuiRelease(GuiScreenEvent.MouseReleasedEvent.Pre event) {
145145
}
146146
@SubscribeEvent
147147
public static void onGuiScroll(GuiScreenEvent.MouseScrollEvent.Pre event) {
148-
onGuiMouse(event, -1, MouseAction.RELEASE);
148+
onGuiMouse(event, -1, MouseAction.SCROLL);
149149
}
150150

151151
private static void hackInputState(InputEvent.MouseInputEvent event) {

src/main/java/cam72cam/mod/serialization/TagSerializer.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package cam72cam.mod.serialization;
22

3-
import cam72cam.mod.ModCore;
43
import cam72cam.mod.world.World;
54

65
import javax.annotation.Nullable;
@@ -61,14 +60,7 @@ private static void init(Class<?> cls) throws SerializationException {
6160
String fieldName = tag.value().isEmpty() ? field.getName() : tag.value();
6261

6362
if (Modifier.isFinal(field.getModifiers())) {
64-
ModCore.warn("A mod is trying to deserialize a tag into a final field %s. This should never have been implemented and will be removed in future versions. You have been warned.", fieldName);
65-
try {
66-
Field modifiersField = Field.class.getDeclaredField("modifiers");
67-
modifiersField.setAccessible(true);
68-
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
69-
} catch (NoSuchFieldException | IllegalAccessException e) {
70-
throw new SerializationException(String.format("Unable to access field %s in class %s", fieldName, cls), e);
71-
}
63+
throw new SerializationException(String.format("A mod is trying to deserialize a tag into a final field %s.%s. This is not supported.", cls.getName(), field.getName()));
7264
}
7365

7466
TagMapped mapped = field.getType().getAnnotation(TagMapped.class);

src/main/resources/mixins.feat.universalmodcore.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"required": true,
33
"package": "cam72cam.mod.mixin.feat",
44
"refmap": "mixins.universalmodcore.refmap.json",
5+
"plugin": "cam72cam.mod.UMCMixinExtrasLoader",
56
"target": "@env(DEFAULT)",
67
"minVersion": "0.8.2",
7-
"plugin": "cam72cam.mod.UMCMixinPlugin",
88
"compatibilityLevel": "JAVA_8",
99
"mixinPriority": 1300,
1010
"mixins": [

src/test/java/cam72cam/mod/serialization/Test.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ public void testSubObjects() throws SerializationException {
436436
}
437437

438438
@TagField
439-
private final Integer hidden = 0;
439+
private Integer hidden = 0;
440440

441441
@org.junit.jupiter.api.Test
442442
public void testHidden() throws SerializationException {
@@ -465,7 +465,7 @@ public TagAccessor<CustomClass> apply(Class<CustomClass> type, String fieldName,
465465

466466
@TagMapped(CustomMapper.class)
467467
public static class CustomClass {
468-
private final Integer field;
468+
private Integer field;
469469

470470
public CustomClass(Integer integer) {
471471
this.field = integer;

0 commit comments

Comments
 (0)