[Fix] RecordItem constructor reflection fails on Quilt

This commit is contained in:
Frank 2022-07-17 01:57:02 +02:00
parent 4aed7c6285
commit e7c90b3521

View file

@ -33,7 +33,7 @@ public class BaseDiscItem extends RecordItem {
} }
public static RecordItem create(int comparatorOutput, SoundEvent sound, Properties settings, int lengthInSeconds) { public static RecordItem create(int comparatorOutput, SoundEvent sound, Properties settings, int lengthInSeconds) {
for (Constructor<?> c : RecordItem.class.getConstructors()) { for (Constructor<?> c : RecordItem.class.getDeclaredConstructors()) {
if (c.getParameterCount() == 4) { if (c.getParameterCount() == 4) {
var types = c.getParameterTypes(); var types = c.getParameterTypes();
if (types.length == 4) { //1.19.1 Constructor if (types.length == 4) { //1.19.1 Constructor
@ -69,7 +69,10 @@ public class BaseDiscItem extends RecordItem {
} }
} }
} }
BCLib.LOGGER.error("No Constructor for RecordItems found."); BCLib.LOGGER.error("No Constructor for RecordItems found:");
for (Constructor<?> c : RecordItem.class.getDeclaredConstructors()) {
BCLib.LOGGER.error(" - " + c);
}
return null; return null;
} }
} }