Skip to content

Commit 8a0a1a3

Browse files
committed
basic fix for submodel
1 parent d463176 commit 8a0a1a3

File tree

1 file changed

+29
-17
lines changed

1 file changed

+29
-17
lines changed

src/main/java/re/imc/geysermodelengine/model/EntityTask.java

+29-17
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.ticxo.modelengine.api.animation.BlueprintAnimation;
66
import com.ticxo.modelengine.api.animation.handler.AnimationHandler;
77
import com.ticxo.modelengine.api.entity.CullType;
8+
import com.ticxo.modelengine.api.generator.blueprint.BlueprintBone;
89
import com.ticxo.modelengine.api.model.ActiveModel;
910
import com.ticxo.modelengine.api.model.ModeledEntity;
1011
import com.ticxo.modelengine.api.model.bone.BoneBehaviorTypes;
@@ -197,20 +198,10 @@ public void updateEntityProperties(Collection<Player> players, boolean firstSend
197198
Map<String, Boolean> animUpdates = new HashMap<>();
198199
Set<String> anims = new HashSet<>();
199200
// if (GeyserModelEngine.getInstance().getEnablePartVisibilityModels().contains(model.getActiveModel().getBlueprint().getName())) {
200-
model.getActiveModel().getBones().forEach((s, bone) -> {
201-
String name = unstripName(bone).toLowerCase();
202-
203-
if (name.equals("hitbox") ||
204-
name.equals("shadow") ||
205-
name.equals("mount") ||
206-
name.startsWith("p_") ||
207-
name.startsWith("b_") ||
208-
name.startsWith("ob_")) {
209-
return;
210-
}
211-
boneUpdates.put(name, bone.isVisible());
212-
});
213201

202+
model.getActiveModel().getBlueprint().getBones().forEach((s, bone) -> {
203+
processBone(bone, boneUpdates);
204+
});
214205
// }
215206

216207

@@ -285,10 +276,31 @@ public void updateEntityProperties(Collection<Player> players, boolean firstSend
285276
}
286277
}
287278

288-
private String unstripName(ModelBone bone) {
289-
String name = bone.getBoneId();
290-
if (bone.getBlueprintBone().getBehaviors().get("head") != null) {
291-
if (!bone.getBlueprintBone().getBehaviors().get("head").isEmpty()) return "hi_" + name;
279+
private void processBone(BlueprintBone bone, Map<String, Boolean> map) {
280+
String name = unstripName(bone).toLowerCase();
281+
if (name.equals("hitbox") ||
282+
name.equals("shadow") ||
283+
name.equals("mount") ||
284+
name.startsWith("p_") ||
285+
name.startsWith("b_") ||
286+
name.startsWith("ob_")) {
287+
return;
288+
}
289+
for (BlueprintBone blueprintBone : bone.getChildren().values()) {
290+
processBone(blueprintBone, map);
291+
}
292+
ModelBone activeBone = model.getActiveModel().getBones().get(bone.getName());
293+
294+
boolean visible = false;
295+
if (activeBone != null) {
296+
visible = activeBone.isVisible();
297+
}
298+
map.put(name, visible);
299+
}
300+
private String unstripName(BlueprintBone bone) {
301+
String name = bone.getName();
302+
if (bone.getBehaviors().get("head") != null) {
303+
if (!bone.getBehaviors().get("head").isEmpty()) return "hi_" + name;
292304
return "h_" + name;
293305
}
294306

0 commit comments

Comments
 (0)