-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c7ac4c
commit 982e76b
Showing
4 changed files
with
38 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package me.mrnavastar.sqlib.impl; | ||
|
||
import net.minecraft.sound.SoundEvent; | ||
import net.minecraft.util.Identifier; | ||
|
||
import java.lang.reflect.Field; | ||
|
||
// This class is used for backwards compatibility as 1.21.2 changed SoundEvent to a record | ||
public class SoundParser { | ||
|
||
private static Field id = null; | ||
|
||
static { | ||
try { | ||
id = SoundEvent.class.getDeclaredField("comp_3319"); | ||
} catch (NoSuchFieldException ignore) {} | ||
|
||
// DEV | ||
try { | ||
id = SoundEvent.class.getDeclaredField("id"); | ||
} catch (NoSuchFieldException ignore) {} | ||
|
||
id.setAccessible(true); | ||
} | ||
|
||
public static Identifier getId(SoundEvent event) { | ||
try { | ||
return (Identifier) id.get(event); | ||
} catch (IllegalAccessException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters