2023-11-19 15:44:13 +01:00
|
|
|
package net.anvilcraft.anvillib.cosmetics;
|
|
|
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
|
|
|
import software.bernie.geckolib3.geo.render.built.GeoBone;
|
|
|
|
import software.bernie.geckolib3.geo.render.built.GeoModel;
|
|
|
|
|
|
|
|
public class CosmeticParts {
|
|
|
|
public boolean head = false;
|
|
|
|
public boolean body = false;
|
|
|
|
public boolean leftArm = false;
|
|
|
|
public boolean leftLeg = false;
|
|
|
|
public boolean rightArm = false;
|
|
|
|
public boolean rightLeg = false;
|
|
|
|
|
|
|
|
public final String headName = "head";
|
|
|
|
public final String bodyName = "body";
|
|
|
|
public final String leftArmName = "arm_left";
|
|
|
|
public final String leftLegName = "leg_left";
|
|
|
|
public final String rightArmName = "arm_right";
|
|
|
|
public final String rightLegName = "leg_right";
|
|
|
|
|
2023-11-24 18:52:05 +01:00
|
|
|
public CosmeticParts() {}
|
2023-11-19 15:44:13 +01:00
|
|
|
|
|
|
|
public CosmeticParts(GeoModel model) {
|
|
|
|
Optional<GeoBone> maybeRoot = model.getBone("root");
|
2023-11-24 18:52:05 +01:00
|
|
|
if (maybeRoot.isEmpty())
|
|
|
|
return;
|
2023-11-19 15:44:13 +01:00
|
|
|
GeoBone root = maybeRoot.get();
|
|
|
|
for (GeoBone bone : root.childBones) {
|
|
|
|
switch (bone.name) {
|
|
|
|
case headName:
|
|
|
|
this.head = true;
|
|
|
|
break;
|
|
|
|
case bodyName:
|
|
|
|
this.body = true;
|
|
|
|
break;
|
|
|
|
case leftArmName:
|
|
|
|
this.leftArm = true;
|
|
|
|
break;
|
|
|
|
case leftLegName:
|
|
|
|
this.leftLeg = true;
|
|
|
|
break;
|
|
|
|
case rightArmName:
|
|
|
|
this.rightArm = true;
|
|
|
|
break;
|
|
|
|
case rightLegName:
|
|
|
|
this.rightLeg = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|