Skip to content

Commit 2f3a34c

Browse files
committed
[BETA] Port to 1.21.9-pre1
* update dependencies - yarn mappings 1.21.9-pre1+build.2 - fabric api 0.133.7+1.21.9 - fabric loader 0.17.2 - SoundCategories * new sounds - `item.category.gear.copper` - Copper items, tools, armor * new module - `:versioned:es1.21.9` * into versioned module - `logics.mixin.action.entity.LivingEntityMixin`
1 parent 903b794 commit 2f3a34c

125 files changed

Lines changed: 2272 additions & 365 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ dependencies {
110110
// <editor-fold desc="Extra Sounds modules">
111111
compileOnly include(project(path: 'logics'))
112112
// 1.21 family
113-
// compileOnly include(project(path: 'versioned:es1.21.9'))
113+
compileOnly include(project(path: 'versioned:es1.21.9'))
114114
compileOnly include(project(path: 'versioned:es1.21.6'))
115115
compileOnly include(project(path: 'versioned:es1.21.5'))
116116
compileOnly include(project(path: 'versioned:es1.21.4'))

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ org.gradle.caching=true
55
org.gradle.configureondemand=true
66
# Fabric Properties
77
# check these on https://fabricmc.net/develop/
8-
minecraft_version=1.21.8
9-
yarn_mappings=+build.1
10-
loader_version=0.16.14
8+
minecraft_version=1.21.9-pre1
9+
yarn_mappings=+build.2
10+
loader_version=0.17.2
1111
loom_version=1.11-SNAPSHOT
1212
#Fabric api
13-
fabric_api_version=0.129.0+1.21.8
13+
fabric_api_version=0.133.7+1.21.9
1414
# Java
1515
java_lang_version=17
1616
# Mod Properties

logics/src/main/java/dev/stashy/extrasounds/logics/compat/mixin/midnightcontrols/MouseMixin.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,24 @@ public abstract class MouseMixin {
1919
private final VersionedHotbarSoundHandler soundHandler = ExtraSounds.MANAGER.getHotbarSoundHandler();
2020

2121
/**
22-
* The lambda of {@code MinecraftClient#execute(() -> { ... })}
22+
* The lambda in 3rd arg of {@code InputUtil#setMouseCallbacks()}
2323
*/
2424
@Unique
25-
private static final String METHOD_SIGN_SETUP_CALLBACK_LAMBDA = "method_22686";
26-
@Unique
27-
private static final String METHOD_SIGN_ON_MOUSE_BUTTON = "Lnet/minecraft/client/Mouse;onMouseButton(JIII)V";
25+
private static final String METHOD_SIGN_SETUP_CALLBACK_LAMBDA = "method_22684";
2826

29-
@Inject(method = METHOD_SIGN_SETUP_CALLBACK_LAMBDA, at = @At(value = "INVOKE", target = METHOD_SIGN_ON_MOUSE_BUTTON), require = 0)
30-
private void extrasounds$storeHotbarIndex_integrateMidnightControls(long windowx, int button, int action, int modifiers, CallbackInfo ci) {
27+
@Inject(method = METHOD_SIGN_SETUP_CALLBACK_LAMBDA, at = @At("HEAD"))
28+
private void extrasounds$storeHotbarIndex_integrateMidnightControls(CallbackInfo ci) {
3129
final ClientPlayerEntity player = MinecraftClient.getInstance().player;
32-
if (player == null || button != 0) {
30+
if (player == null) {
3331
return;
3432
}
3533
this.currentHotbarSlot = this.soundHandler.getPlayerInventorySlot(player);
3634
}
3735

38-
@Inject(method = METHOD_SIGN_SETUP_CALLBACK_LAMBDA, at = @At(value = "INVOKE", target = METHOD_SIGN_ON_MOUSE_BUTTON, shift = At.Shift.AFTER), require = 0)
39-
private void extrasounds$touchHotbar_integrateMidnightControls(long windowx, int button, int action, int modifiers, CallbackInfo ci) {
36+
@Inject(method = METHOD_SIGN_SETUP_CALLBACK_LAMBDA, at = @At("RETURN"))
37+
private void extrasounds$touchHotbar_integrateMidnightControls(CallbackInfo ci) {
4038
final ClientPlayerEntity player = MinecraftClient.getInstance().player;
41-
if (player == null || button != 0) {
39+
if (player == null) {
4240
return;
4341
}
4442
final int selectedSlot = this.soundHandler.getPlayerInventorySlot(player);

logics/src/main/java/dev/stashy/extrasounds/logics/compat/mixin/rei/TextFieldWidgetMixin.java

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import dev.stashy.extrasounds.logics.impl.TextFieldHandler;
44
import me.shedaniel.rei.api.client.gui.widgets.TextField;
55
import me.shedaniel.rei.impl.client.gui.widget.basewidgets.TextFieldWidget;
6-
import net.minecraft.client.gui.screen.Screen;
76
import org.spongepowered.asm.mixin.Mixin;
87
import org.spongepowered.asm.mixin.Pseudo;
98
import org.spongepowered.asm.mixin.Shadow;
@@ -32,58 +31,59 @@ public abstract class TextFieldWidgetMixin implements TextField {
3231
this.soundHandler.setCursor(this.cursorPos);
3332
}
3433

35-
@Inject(method = "charTyped", at = @At("RETURN"))
36-
private void extrasounds$appendChar(CallbackInfoReturnable<Boolean> cir) {
37-
if (!cir.getReturnValue() || !this.soundHandler.isPosUpdated(this.cursorPos, this.cursorPos)) {
38-
return;
39-
}
40-
this.soundHandler.onKey(TextFieldHandler.KeyType.INSERT);
41-
this.soundHandler.setCursor(this.cursorPos);
42-
}
43-
44-
@Inject(
45-
method = "keyPressed",
46-
at = @At(
47-
value = "INVOKE",
48-
target = "Lnet/minecraft/client/Keyboard;setClipboard(Ljava/lang/String;)V",
49-
shift = At.Shift.AFTER
50-
)
51-
)
52-
private void extrasounds$cutAction(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable<Boolean> cir) {
53-
if (!Screen.isCut(keyCode) || this.getSelectedText().isEmpty()) {
54-
return;
55-
}
56-
this.soundHandler.onKey(TextFieldHandler.KeyType.CUT);
57-
this.soundHandler.setCursor(this.cursorPos);
58-
}
59-
60-
@Inject(
61-
method = "keyPressed",
62-
at = @At(
63-
value = "INVOKE",
64-
target = "Lnet/minecraft/client/Keyboard;getClipboard()Ljava/lang/String;",
65-
shift = At.Shift.AFTER
66-
)
67-
)
68-
private void extrasounds$pasteAction(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable<Boolean> cir) {
69-
if (!Screen.isPaste(keyCode) || !this.soundHandler.isPosUpdated(this.cursorPos, this.cursorPos)) {
70-
return;
71-
}
72-
this.soundHandler.onKey(TextFieldHandler.KeyType.PASTE);
73-
this.soundHandler.setCursor(this.cursorPos);
74-
}
75-
76-
@Inject(method = "keyPressed",
77-
at = {
78-
@At(value = "INVOKE", target = "Lme/shedaniel/rei/impl/client/gui/widget/basewidgets/TextFieldWidget;moveCursor(I)V", shift = At.Shift.AFTER),
79-
@At(value = "INVOKE", target = "Lme/shedaniel/rei/impl/client/gui/widget/basewidgets/TextFieldWidget;moveCursorTo(I)V", shift = At.Shift.AFTER),
80-
@At(value = "INVOKE", target = "Lme/shedaniel/rei/impl/client/gui/widget/basewidgets/TextFieldWidget;moveCursorToStart()V", shift = At.Shift.AFTER),
81-
@At(value = "INVOKE", target = "Lme/shedaniel/rei/impl/client/gui/widget/basewidgets/TextFieldWidget;moveCursorToEnd()V", shift = At.Shift.AFTER)
82-
}
83-
)
84-
private void extrasounds$cursorMoveKeyTyped(CallbackInfoReturnable<Boolean> cir) {
85-
this.soundHandler.onCursorChanged(this.cursorPos, this.cursorPos);
86-
}
34+
// TODO: vanilla method sign has changed
35+
// @Inject(method = "charTyped", at = @At("RETURN"))
36+
// private void extrasounds$appendChar(CallbackInfoReturnable<Boolean> cir) {
37+
// if (!cir.getReturnValue() || !this.soundHandler.isPosUpdated(this.cursorPos, this.cursorPos)) {
38+
// return;
39+
// }
40+
// this.soundHandler.onKey(TextFieldHandler.KeyType.INSERT);
41+
// this.soundHandler.setCursor(this.cursorPos);
42+
// }
43+
//
44+
// @Inject(
45+
// method = "keyPressed",
46+
// at = @At(
47+
// value = "INVOKE",
48+
// target = "Lnet/minecraft/client/Keyboard;setClipboard(Ljava/lang/String;)V",
49+
// shift = At.Shift.AFTER
50+
// )
51+
// )
52+
// private void extrasounds$cutAction(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable<Boolean> cir) {
53+
// if (!Screen.isCut(keyCode) || this.getSelectedText().isEmpty()) {
54+
// return;
55+
// }
56+
// this.soundHandler.onKey(TextFieldHandler.KeyType.CUT);
57+
// this.soundHandler.setCursor(this.cursorPos);
58+
// }
59+
//
60+
// @Inject(
61+
// method = "keyPressed",
62+
// at = @At(
63+
// value = "INVOKE",
64+
// target = "Lnet/minecraft/client/Keyboard;getClipboard()Ljava/lang/String;",
65+
// shift = At.Shift.AFTER
66+
// )
67+
// )
68+
// private void extrasounds$pasteAction(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable<Boolean> cir) {
69+
// if (!Screen.isPaste(keyCode) || !this.soundHandler.isPosUpdated(this.cursorPos, this.cursorPos)) {
70+
// return;
71+
// }
72+
// this.soundHandler.onKey(TextFieldHandler.KeyType.PASTE);
73+
// this.soundHandler.setCursor(this.cursorPos);
74+
// }
75+
//
76+
// @Inject(method = "keyPressed",
77+
// at = {
78+
// @At(value = "INVOKE", target = "Lme/shedaniel/rei/impl/client/gui/widget/basewidgets/TextFieldWidget;moveCursor(I)V", shift = At.Shift.AFTER),
79+
// @At(value = "INVOKE", target = "Lme/shedaniel/rei/impl/client/gui/widget/basewidgets/TextFieldWidget;moveCursorTo(I)V", shift = At.Shift.AFTER),
80+
// @At(value = "INVOKE", target = "Lme/shedaniel/rei/impl/client/gui/widget/basewidgets/TextFieldWidget;moveCursorToStart()V", shift = At.Shift.AFTER),
81+
// @At(value = "INVOKE", target = "Lme/shedaniel/rei/impl/client/gui/widget/basewidgets/TextFieldWidget;moveCursorToEnd()V", shift = At.Shift.AFTER)
82+
// }
83+
// )
84+
// private void extrasounds$cursorMoveKeyTyped(CallbackInfoReturnable<Boolean> cir) {
85+
// this.soundHandler.onCursorChanged(this.cursorPos, this.cursorPos);
86+
// }
8787

8888
@Inject(method = {"mouseClicked", "method_25402"}, at = @At(value = "INVOKE", target = "Lme/shedaniel/rei/impl/client/gui/widget/basewidgets/TextFieldWidget;moveCursorTo(I)V", shift = At.Shift.AFTER), require = 1)
8989
private void extrasounds$clickEvent(CallbackInfoReturnable<Boolean> cir) {

logics/src/main/java/dev/stashy/extrasounds/logics/entry/BaseVanillaGenerator.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,18 @@ protected String getItemIdPath(Item item) {
3838
}
3939

4040
private boolean isBrickItem(Item item) {
41-
final String idPath = getItemIdPath(item);
41+
final String idPath = this.getItemIdPath(item);
4242
return item == Items.BRICK || idPath.endsWith("pottery_sherd") || idPath.startsWith("pottery_shard");
4343
}
4444

4545
private boolean isGearGoldenItem(Item item) {
46-
return item instanceof CompassItem ||
47-
item instanceof SpyglassItem || item instanceof ShearsItem ||
48-
this.getItemIdPath(item).endsWith("_harness");
46+
return item instanceof CompassItem || item instanceof ShearsItem;
4947
}
5048

5149
private boolean isGearLeatherItem(Item item) {
52-
return item instanceof LeadItem || getItemIdPath(item).equals("elytra") ||
53-
getItemIdPath(item).equals("saddle");
50+
return item instanceof LeadItem || this.getItemIdPath(item).equals("elytra") ||
51+
this.getItemIdPath(item).equals("saddle") ||
52+
this.getItemIdPath(item).endsWith("_harness");
5453
}
5554

5655
private boolean isGearGenericItem(Item item) {
@@ -122,6 +121,8 @@ protected SoundDefinition generalSounds(Item item) {
122121
return SoundDefinition.of(aliased(BUNDLES));
123122
} else if (item instanceof EggItem) {
124123
return SoundDefinition.of(aliased(EGG));
124+
} else if (item instanceof SpyglassItem) {
125+
return SoundDefinition.of(aliased(Gear.IRON));
125126
}
126127

127128
return DEFAULT_SOUND;

logics/src/main/java/dev/stashy/extrasounds/logics/mixin/inventory/HandledScreenMixin.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package dev.stashy.extrasounds.logics.mixin.inventory;
22

3+
import com.llamalad7.mixinextras.sugar.Local;
34
import dev.stashy.extrasounds.logics.ExtraSounds;
45
import dev.stashy.extrasounds.sounds.SoundType;
56
import dev.stashy.extrasounds.sounds.Sounds;
@@ -11,7 +12,6 @@
1112
import org.spongepowered.asm.mixin.injection.At;
1213
import org.spongepowered.asm.mixin.injection.Inject;
1314
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
14-
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
1515

1616
import java.util.Set;
1717

@@ -23,8 +23,16 @@ public abstract class HandledScreenMixin {
2323
@Shadow
2424
protected @Final Set<Slot> cursorDragSlots;
2525

26-
@Inject(method = "mouseDragged", at = @At(value = "INVOKE", target = "Ljava/util/Set;add(Ljava/lang/Object;)Z"), locals = LocalCapture.CAPTURE_FAILSOFT)
27-
private void extrasounds$quickCraftSound(double mouseX, double mouseY, int button, double deltaX, double deltaY, CallbackInfoReturnable<Boolean> cir, Slot slot) {
26+
@Inject(
27+
method = { // mouseDragged
28+
"method_25403(DDIDD)Z",
29+
// "method_25403(Lnet/minecraft/class_11909;DD)Z", // >=MC1.21.9
30+
"mouseDragged(Lnet/minecraft/client/gui/Click;DD)Z" // >=MC1.21.9
31+
},
32+
at = @At(value = "INVOKE", target = "Ljava/util/Set;add(Ljava/lang/Object;)Z"),
33+
require = 1
34+
)
35+
private void extrasounds$quickCraftSound(CallbackInfoReturnable<Boolean> cir, @Local Slot slot) {
2836
if (!cursorDragSlots.contains(slot) && !cursorDragSlots.isEmpty()) {
2937
ExtraSounds.MANAGER.playSound(Sounds.ITEM_DRAG, SoundType.PLACE);
3038
}

logics/src/main/java/dev/stashy/extrasounds/sounds/Categories.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@ private Gear() {
4949
public static final VersionedSoundEventWrapper TURTLE = ExtraSounds.createEvent("item.category.gear.turtle");
5050
public static final VersionedSoundEventWrapper ARMADILLO = ExtraSounds.createEvent("item.category.gear.armadillo");
5151
public static final VersionedSoundEventWrapper WOOD = ExtraSounds.createEvent("item.category.gear.wood");
52+
public static final VersionedSoundEventWrapper COPPER = ExtraSounds.createEvent("item.category.gear.copper");
5253
}
5354
}

logics/src/main/resources/extrasounds.logics.mixins.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"client": [
77
"access.FlowerPotBlockInvoker",
88

9-
"action.entity.LivingEntityMixin",
109
"action.item.ClientPlayerEntityMixin",
1110
"hotbar.MinecraftClientMixin",
1211
"inventory.ClientPlayerInteractionManagerMixin",

settings.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pluginManagement {
1616
// SoundCategories modules
1717
include 'sound-categories', 'sound-categories:shared'
1818
// 1.21 family
19-
include 'sound-categories:versioned:sc1.21.6', 'sound-categories:versioned:sc1.21'
19+
include 'sound-categories:versioned:sc1.21.9', 'sound-categories:versioned:sc1.21.6', 'sound-categories:versioned:sc1.21'
2020
// 1.20 family
2121
include 'sound-categories:versioned:sc1.20.5', 'sound-categories:versioned:sc1.20.3', 'sound-categories:versioned:sc1.20.2', 'sound-categories:versioned:sc1.20'
2222
// 1.19 family
@@ -27,7 +27,7 @@ include 'sound-categories:versioned:sc1.18'
2727
// ExtraSounds modules
2828
include 'logics'
2929
// 1.21 family
30-
include /*'versioned:es1.21.9', */'versioned:es1.21.6', 'versioned:es1.21.5', 'versioned:es1.21.4', 'versioned:es1.21.2', 'versioned:es1.21'
30+
include 'versioned:es1.21.9', 'versioned:es1.21.6', 'versioned:es1.21.5', 'versioned:es1.21.4', 'versioned:es1.21.2', 'versioned:es1.21'
3131
// 1.20 family
3232
include 'versioned:es1.20.5', 'versioned:es1.20.2', 'versioned:es1.20'
3333
// 1.19 family

0 commit comments

Comments
 (0)