Fixed exception when loading tail segments

This commit is contained in:
Sollace 2019-11-28 16:10:09 +02:00
parent 032fb2719f
commit 52038d2d0c
4 changed files with 8 additions and 8 deletions

View file

@ -23,10 +23,9 @@ public class PegasusWings<T extends Model & IPegasus> implements IPart, MsonMode
protected Wing legacyWing; protected Wing legacyWing;
@SuppressWarnings("unchecked")
@Override @Override
public void init(ModelContext context) { public void init(ModelContext context) {
pegasus = (T)context.getModel(); pegasus = context.getModel();
leftWing = context.findByName("left_wing"); leftWing = context.findByName("left_wing");
rightWing = context.findByName("right_wing"); rightWing = context.findByName("right_wing");
legacyWing = context.findByName("legacy_right_wing"); legacyWing = context.findByName("legacy_right_wing");
@ -92,7 +91,7 @@ public class PegasusWings<T extends Model & IPegasus> implements IPart, MsonMode
@Override @Override
public void init(ModelContext context) { public void init(ModelContext context) {
pegasus = (IPegasus)context.getModel(); pegasus = context.getModel();
extended = context.findByName("extended"); extended = context.findByName("extended");
folded = context.findByName("folded"); folded = context.findByName("folded");
} }

View file

@ -23,10 +23,9 @@ public class PonySnout implements IPart, MsonModel {
private ICapitated<ModelPart> head; private ICapitated<ModelPart> head;
@SuppressWarnings("unchecked")
@Override @Override
public void init(ModelContext context) { public void init(ModelContext context) {
head = (ICapitated<ModelPart>)context.getModel(); head = context.getModel();
mare = context.findByName("mare"); mare = context.findByName("mare");
stallion = context.findByName("stallion"); stallion = context.findByName("stallion");
} }

View file

@ -22,15 +22,17 @@ public class PonyTail implements IPart, MsonModel {
@Override @Override
public void init(ModelContext context) { public void init(ModelContext context) {
theModel = (AbstractPonyModel<?>)context.getModel(); theModel = context.getModel();
tail = new ModelPart(theModel); tail = new ModelPart(theModel);
try { try {
int segments = context.getLocals().getValue("segments").get().intValue(); int segments = context.getLocals().getValue("segments").get().intValue();
ModelContext subContext = context.resolve(this);
for (int i = 0; i < segments; i++) { for (int i = 0; i < segments; i++) {
Segment segment = context.findByName("segment_" + i); Segment segment = subContext.findByName("segment_" + i);
segment.index = i; segment.index = i;
tail.addChild(segment); tail.addChild(segment);
} }

View file

@ -25,7 +25,7 @@ public class SeaponyTail implements IPart, MsonModel {
@Override @Override
public void init(ModelContext context) { public void init(ModelContext context) {
model = (IPonyModel<?>)context.getModel(); model = context.getModel();
tailBase = context.findByName("base"); tailBase = context.findByName("base");
tailTip = context.findByName("tip"); tailTip = context.findByName("tip");
tailFins = context.findByName("fins"); tailFins = context.findByName("fins");