model dump: instance getTextureLocation preferred over static overloads (shulker texture was missing), boat water patch posed with its unit state, painting skipped (no model)
This commit is contained in:
1 parent
a890370cc5
commit
e364d76da0
2 files changed
+11
-6
No files matched your search
@@ -114,6 +114,8 @@ public class VanillaModelDump {
|
||||
List<String> failed = new ArrayList<>();
|
||||
for (Map.Entry<EntityType<?>, EntityRendererProvider<?>> e : providers.entrySet()) {
|
||||
String key = BuiltInRegistries.ENTITY_TYPE.getKey(e.getKey()).getPath();
|
||||
// No model: the painting is a sprite quad (needs the atlas manager), PixelPics bakes it itself.
|
||||
if (key.equals("painting")) continue;
|
||||
EntityRenderer<?, ?> r;
|
||||
try {
|
||||
r = e.getValue().create(ctx);
|
||||
@@ -556,14 +558,15 @@ public class VanillaModelDump {
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-bridge method matching {@code test} in the nearest class (from the object's class up) that declares one;
|
||||
* of several there the LAST in declaration order (ShulkerRenderer also has a static
|
||||
* getTextureLocation(DyeColor), which then wins and fails: the dump has no shulker texture).
|
||||
* Non-bridge instance method matching {@code test} in the nearest class (from the object's class up) that
|
||||
* declares one; static overloads are skipped (ShulkerRenderer's static getTextureLocation(DyeColor)).
|
||||
*/
|
||||
static Method declaredMethod(Object o, java.util.function.Predicate<Method> test) {
|
||||
for (Class<?> c = o.getClass(); c != null; c = c.getSuperclass()) {
|
||||
Method found = null;
|
||||
for (Method m : c.getDeclaredMethods()) if (!m.isBridge() && test.test(m)) found = m;
|
||||
for (Method m : c.getDeclaredMethods()) {
|
||||
if (!m.isBridge() && !Modifier.isStatic(m.getModifiers()) && test.test(m)) found = m;
|
||||
}
|
||||
if (found != null) {
|
||||
found.setAccessible(true);
|
||||
return found;
|
||||
@@ -1407,7 +1410,9 @@ public class VanillaModelDump {
|
||||
for (Method m : model.getClass().getMethods()) {
|
||||
if (!m.getName().equals("setupAnim") || m.getParameterCount() != 1) continue;
|
||||
try {
|
||||
m.invoke(model, m.getParameterTypes()[0].getDeclaredConstructor().newInstance());
|
||||
Class<?> pt = m.getParameterTypes()[0];
|
||||
// Model.Simple (boat water patch) takes Unit
|
||||
m.invoke(model, pt.isEnum() ? pt.getEnumConstants()[0] : pt.getDeclaredConstructor().newInstance());
|
||||
posed = true;
|
||||
break;
|
||||
} catch (Throwable ignored) {
|
||||
|
||||
Reference in new issue
Block a user