Don't copy state from variant to multi-part model (#4629)
This commit is contained in:
parent
d4ade990e3
commit
10b8d47b53
2 changed files with 16 additions and 14 deletions
|
@ -200,10 +200,6 @@ public class BlockStateLoader
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply rotation of base model to sub-models.
|
|
||||||
// If baseRot is non-null, then that rotation will be applied instead of the base model's rotation.
|
|
||||||
// This is used to allow replacing base model with a sub-model when there is no base model for a variant.
|
|
||||||
IModelState baseTr = getState();
|
|
||||||
ImmutableMap.Builder<String, Pair<IModel, IModelState>> models = ImmutableMap.builder();
|
ImmutableMap.Builder<String, Pair<IModel, IModelState>> models = ImmutableMap.builder();
|
||||||
for (Entry<String, SubModel> entry : parts.entrySet())
|
for (Entry<String, SubModel> entry : parts.entrySet())
|
||||||
{
|
{
|
||||||
|
@ -224,7 +220,7 @@ public class BlockStateLoader
|
||||||
models.put(entry.getKey(), Pair.of(runModelHooks(model, part.smooth, part.gui3d, part.uvLock, part.getTextures(), part.getCustomData()), part.getState()));
|
models.put(entry.getKey(), Pair.of(runModelHooks(model, part.smooth, part.gui3d, part.uvLock, part.getTextures(), part.getCustomData()), part.getState()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new MultiModel(getModelLocation(), hasBase ? base : null, baseTr, models.build());
|
return new MultiModel(getModelLocation(), hasBase ? base : null, models.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -227,20 +227,32 @@ public final class MultiModel implements IModel
|
||||||
private final ResourceLocation location;
|
private final ResourceLocation location;
|
||||||
@Nullable
|
@Nullable
|
||||||
private final IModel base;
|
private final IModel base;
|
||||||
private final IModelState baseState;
|
|
||||||
private final Map<String, Pair<IModel, IModelState>> parts;
|
private final Map<String, Pair<IModel, IModelState>> parts;
|
||||||
|
|
||||||
|
// TODO 1.13 remove, kept for binary compatibility
|
||||||
|
@Deprecated
|
||||||
public MultiModel(ResourceLocation location, @Nullable IModel base, IModelState baseState, ImmutableMap<String, Pair<IModel, IModelState>> parts)
|
public MultiModel(ResourceLocation location, @Nullable IModel base, IModelState baseState, ImmutableMap<String, Pair<IModel, IModelState>> parts)
|
||||||
|
{
|
||||||
|
this(location, base, parts);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiModel(ResourceLocation location, @Nullable IModel base, ImmutableMap<String, Pair<IModel, IModelState>> parts)
|
||||||
{
|
{
|
||||||
this.location = location;
|
this.location = location;
|
||||||
this.base = base;
|
this.base = base;
|
||||||
this.baseState = baseState;
|
|
||||||
this.parts = parts;
|
this.parts = parts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO 1.13 remove, kept for binary compatibility
|
||||||
|
@Deprecated
|
||||||
public MultiModel(ResourceLocation location, IModel base, IModelState baseState, Map<String, Pair<IModel, IModelState>> parts)
|
public MultiModel(ResourceLocation location, IModel base, IModelState baseState, Map<String, Pair<IModel, IModelState>> parts)
|
||||||
{
|
{
|
||||||
this(location, base, baseState, ImmutableMap.copyOf(parts));
|
this(location, base, parts);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiModel(ResourceLocation location, IModel base, Map<String, Pair<IModel, IModelState>> parts)
|
||||||
|
{
|
||||||
|
this(location, base, ImmutableMap.copyOf(parts));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -295,10 +307,4 @@ public final class MultiModel implements IModel
|
||||||
}
|
}
|
||||||
return new Baked(location, true, bakedBase, mapBuilder.build());
|
return new Baked(location, true, bakedBase, mapBuilder.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IModelState getDefaultState()
|
|
||||||
{
|
|
||||||
return baseState;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue