Skip to content

Commit a76139c

Browse files
committed
[ALPHA] Port to 25w36b
* update dependencies - yarn mappings 25w36b+build.6 - fabric api 0.133.1+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 7cb2af1 commit a76139c

143 files changed

Lines changed: 2277 additions & 937 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=25w36b
9+
yarn_mappings=+build.6
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.1+1.21.9
1414
# Java
1515
java_lang_version=17
1616
# Mod Properties

logics/src/main/java/dev/stashy/extrasounds/logics/SoundManager.java

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

3-
import com.google.common.collect.Sets;
43
import dev.stashy.extrasounds.logics.debug.DebugUtils;
54
import dev.stashy.extrasounds.logics.entry.SoundPackLoader;
65
import dev.stashy.extrasounds.logics.impl.VersionedHotbarSoundHandler;
@@ -27,6 +26,7 @@
2726
import org.apache.logging.log4j.LogManager;
2827
import org.apache.logging.log4j.Logger;
2928

29+
import java.util.HashSet;
3030
import java.util.Objects;
3131
import java.util.Set;
3232

@@ -48,7 +48,7 @@ public final class SoundManager {
4848

4949
public SoundManager() {
5050
this.hotbarSoundHandler = VersionedHotbarSoundHandler.newInstance();
51-
this.missingSoundId = Sets.newHashSet();
51+
this.missingSoundId = new HashSet<>();
5252
this.lastPlayed = 0;
5353
this.quickMovingItem = Items.AIR;
5454
}

logics/src/main/java/dev/stashy/extrasounds/logics/VersionedMain.java

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

3-
import com.google.common.collect.Maps;
43
import dev.stashy.extrasounds.logics.impl.state.InventoryClickState;
54
import dev.stashy.extrasounds.logics.runtime.VersionedSoundEventWrapper;
65
import me.lonefelidae16.groominglib.Util;
@@ -14,6 +13,7 @@
1413
import net.minecraft.util.Identifier;
1514
import net.minecraft.util.collection.IndexedIterable;
1615

16+
import java.util.HashMap;
1717
import java.util.Map;
1818
import java.util.function.Predicate;
1919

@@ -33,7 +33,7 @@ public static VersionedMain newInstance() {
3333
* Predicate in this value will be passed an instance of an {@link InventoryClickState}.<br>
3434
* Item -&gt; Predicate&lt;InventoryClickStatus&gt;
3535
*/
36-
protected static final Map<Item, Predicate<InventoryClickState>> IGNORE_SOUND_PREDICATE_MAP = Util.make(Maps.newHashMap(), map -> {
36+
protected static final Map<Item, Predicate<InventoryClickState>> IGNORE_SOUND_PREDICATE_MAP = Util.make(new HashMap<>(), map -> {
3737
map.put(Items.BUNDLE, status -> {
3838
return status.isRMB && !(status.slot instanceof CreativeInventoryScreen.LockableSlot);
3939
});

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/SoundPackLoader.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package dev.stashy.extrasounds.logics.entry;
22

3-
import com.google.common.collect.Sets;
43
import com.google.gson.*;
54
import dev.stashy.extrasounds.logics.ExtraSounds;
65
import dev.stashy.extrasounds.logics.SoundManager;
@@ -153,7 +152,7 @@ public static void init() {
153152
*/
154153
private static void processSounds(Map<String, SoundGenerator> soundGenerator, Map<String, SoundEntry> resource) {
155154
final SoundEntry fallbackSoundEntry = Sounds.aliased(SoundManager.FALLBACK_SOUND_EVENT);
156-
final Set<String> inSoundsJsonIds = Sets.newHashSet();
155+
final Set<String> inSoundsJsonIds = new HashSet<>();
157156
final String fallbackSoundJson = GSON.toJson(fallbackSoundEntry);
158157
if (DebugUtils.SEARCH_UNDEF_SOUND) {
159158
try (InputStream stream = SoundPackLoader.class.getClassLoader().getResourceAsStream("assets/%s/%s".formatted(ExtraSounds.MODID, SOUNDS_JSON_ID.getPath()))) {

logics/src/main/java/dev/stashy/extrasounds/logics/impl/AbstractInteractionHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import dev.stashy.extrasounds.logics.ExtraSounds;
44
import dev.stashy.extrasounds.logics.impl.state.ActionResultState;
5+
import dev.stashy.extrasounds.logics.mixin.access.FlowerPotBlockInvoker;
56
import dev.stashy.extrasounds.sounds.Sounds;
67
import net.minecraft.block.*;
78
import net.minecraft.block.entity.BlockEntity;
@@ -100,7 +101,7 @@ public final void onUse(ClientPlayerEntity player, BlockPos blockPos, ActionResu
100101
(this.block instanceof FlowerPotBlock potBlock) &&
101102
actionResult == ActionResultState.SUCCESS
102103
) {
103-
if (!potBlock.isEmpty()) {
104+
if (!((FlowerPotBlockInvoker) potBlock).invokeIsEmpty()) {
104105
// Take from pot
105106
ExtraSounds.MANAGER.blockInteract(potBlock.getContent().asItem(), blockPos);
106107
} else {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package dev.stashy.extrasounds.logics.mixin.access;
2+
3+
import net.minecraft.block.FlowerPotBlock;
4+
import org.spongepowered.asm.mixin.Mixin;
5+
import org.spongepowered.asm.mixin.gen.Invoker;
6+
7+
@Mixin(FlowerPotBlock.class)
8+
public interface FlowerPotBlockInvoker {
9+
@Invoker("isEmpty")
10+
boolean invokeIsEmpty();
11+
}

versioned/es1.20/src/main/java/dev/stashy/extrasounds/mc1_20/mixin/action/item/ClientPlayerEntityMixin.java renamed to logics/src/main/java/dev/stashy/extrasounds/logics/mixin/action/item/ClientPlayerEntityMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package dev.stashy.extrasounds.mc1_20.mixin.action.item;
1+
package dev.stashy.extrasounds.logics.mixin.action.item;
22

33
import com.mojang.authlib.GameProfile;
44
import dev.stashy.extrasounds.logics.ExtraSounds;

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
}

0 commit comments

Comments
 (0)