mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 11:59:25 +00:00
Switched animation system to capabilities, added animated item example, fixed state passing in MultiModel.
This commit is contained in:
1 parent
558348125d
commit
5f62404f8a
14 files changed
+338
-99
No files matched your search
@@ -185,9 +185,7 @@ public class BlockStateLoader
|
||||
|
||||
IModel model = ModelLoaderRegistry.getModelOrLogError(part.getModelLocation(), "Unable to load block sub-model: \'" + part.getModelLocation());
|
||||
|
||||
IModelState partState = new ModelStateComposition(baseTr, part.getState());
|
||||
|
||||
models.put(entry.getKey(), Pair.<IModel, IModelState>of(runModelHooks(model, part.smooth, part.gui3d, part.uvLock, part.getTextures(), part.getCustomData()), partState));
|
||||
models.put(entry.getKey(), Pair.<IModel, IModelState>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());
|
||||
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.block.model.ItemModelGenerator;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelBlock;
|
||||
import net.minecraft.client.renderer.block.model.ModelBlockDefinition;
|
||||
@@ -57,6 +58,7 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraftforge.client.model.animation.Animation;
|
||||
import net.minecraftforge.client.model.animation.AnimationItemOverrideList;
|
||||
import net.minecraftforge.client.model.animation.IAnimatedModel;
|
||||
import net.minecraftforge.client.model.animation.IClip;
|
||||
import net.minecraftforge.client.model.animation.ModelBlockAnimation;
|
||||
@@ -497,17 +499,18 @@ public final class ModelLoader extends ModelBakery
|
||||
return new ItemLayerModel(model).bake(perState, format, bakedTextureGetter);
|
||||
}
|
||||
if(isCustomRenderer(model)) return new BuiltInModel(transforms, model.createOverrides());
|
||||
return bakeNormal(model, perState, state.apply(Optional.<IModelPart>absent()).or(TRSRTransformation.identity()), newTransforms, format, bakedTextureGetter, uvlock);
|
||||
return bakeNormal(model, perState, state, newTransforms, format, bakedTextureGetter, uvlock);
|
||||
}
|
||||
|
||||
private IBakedModel bakeNormal(ModelBlock model, IModelState perState, final TRSRTransformation modelState, List<TRSRTransformation> newTransforms, final VertexFormat format, final Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, boolean uvLocked)
|
||||
private IBakedModel bakeNormal(ModelBlock model, IModelState perState, final IModelState modelState, List<TRSRTransformation> newTransforms, final VertexFormat format, final Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, boolean uvLocked)
|
||||
{
|
||||
final TRSRTransformation baseState = modelState.apply(Optional.<IModelPart>absent()).or(TRSRTransformation.identity());
|
||||
TextureAtlasSprite particle = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName("particle")));
|
||||
SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(model, model.createOverrides())).setTexture(particle);
|
||||
for(int i = 0; i < model.getElements().size(); i++)
|
||||
{
|
||||
BlockPart part = model.getElements().get(i);
|
||||
TRSRTransformation transformation = modelState;
|
||||
TRSRTransformation transformation = baseState;
|
||||
if(newTransforms.get(i) != null)
|
||||
{
|
||||
transformation = transformation.compose(newTransforms.get(i));
|
||||
@@ -525,13 +528,15 @@ public final class ModelLoader extends ModelBakery
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.addFaceQuad(modelState.rotate(e.getValue().cullFace), makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), transformation, uvLocked));
|
||||
builder.addFaceQuad(baseState.rotate(e.getValue().cullFace), makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), transformation, uvLocked));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new IPerspectiveAwareModel.MapWrapper(builder.makeBakedModel(), perState)
|
||||
{
|
||||
private final ItemOverrideList overrides = new AnimationItemOverrideList(VanillaModelWrapper.this, modelState, format, bakedTextureGetter, super.getOverrides());
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand)
|
||||
{
|
||||
@@ -550,6 +555,12 @@ public final class ModelLoader extends ModelBakery
|
||||
}
|
||||
return super.getQuads(state, side, rand);
|
||||
};
|
||||
|
||||
@Override
|
||||
public ItemOverrideList getOverrides()
|
||||
{
|
||||
return overrides;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,15 @@ import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverride;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -28,6 +32,7 @@ import com.google.common.base.Function;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
// TODO: Switch to vanilla class, or to something similar
|
||||
@@ -36,15 +41,55 @@ public final class MultiModel implements IModel
|
||||
{
|
||||
private static final class Baked implements IPerspectiveAwareModel
|
||||
{
|
||||
private final ResourceLocation location;
|
||||
private final IBakedModel base;
|
||||
private final ImmutableMap<String, IBakedModel> parts;
|
||||
|
||||
private final IBakedModel internalBase;
|
||||
private ImmutableMap<Optional<EnumFacing>, ImmutableList<BakedQuad>> quads;
|
||||
private final ImmutableMap<TransformType, Pair<Baked, TRSRTransformation>> transforms;
|
||||
private final ItemOverrideList overrides = new ItemOverrideList(Lists.<ItemOverride>newArrayList())
|
||||
{
|
||||
@Override
|
||||
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity)
|
||||
{
|
||||
if(originalModel != Baked.this)
|
||||
{
|
||||
return originalModel;
|
||||
}
|
||||
boolean dirty = false;
|
||||
IBakedModel newBase = null;
|
||||
|
||||
if(base != null)
|
||||
{
|
||||
newBase = base.getOverrides().handleItemState(base, stack, world, entity);
|
||||
if(base != newBase)
|
||||
{
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
ImmutableMap.Builder<String, IBakedModel> builder = ImmutableMap.builder();
|
||||
for(Map.Entry<String, IBakedModel> entry : parts.entrySet())
|
||||
{
|
||||
IBakedModel newPart = entry.getValue().getOverrides().handleItemState(entry.getValue(), stack, world, entity);
|
||||
builder.put(entry.getKey(), newPart);
|
||||
if(entry.getValue() != newPart)
|
||||
{
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
if(dirty)
|
||||
{
|
||||
// TODO: caching?
|
||||
return new Baked(location, newBase instanceof IPerspectiveAwareModel, newBase, builder.build());
|
||||
}
|
||||
return Baked.this;
|
||||
}
|
||||
};
|
||||
|
||||
public Baked(ResourceLocation location, boolean perspective, IBakedModel base, ImmutableMap<String, IBakedModel> parts)
|
||||
{
|
||||
this.location = location;
|
||||
this.base = base;
|
||||
this.parts = parts;
|
||||
|
||||
@@ -120,22 +165,22 @@ public final class MultiModel implements IModel
|
||||
ImmutableList.Builder<BakedQuad> quads = ImmutableList.builder();
|
||||
if (base != null)
|
||||
{
|
||||
quads.addAll(base.getQuads(null, face, 0));
|
||||
quads.addAll(base.getQuads(state, face, 0));
|
||||
}
|
||||
for (IBakedModel bakedPart : parts.values())
|
||||
{
|
||||
quads.addAll(bakedPart.getQuads(null, face, 0));
|
||||
quads.addAll(bakedPart.getQuads(state, face, 0));
|
||||
}
|
||||
builder.put(Optional.of(face), quads.build());
|
||||
}
|
||||
ImmutableList.Builder<BakedQuad> quads = ImmutableList.builder();
|
||||
if (base != null)
|
||||
{
|
||||
quads.addAll(base.getQuads(null, null, 0));
|
||||
quads.addAll(base.getQuads(state, null, 0));
|
||||
}
|
||||
for (IBakedModel bakedPart : parts.values())
|
||||
{
|
||||
quads.addAll(bakedPart.getQuads(null, null, 0));
|
||||
quads.addAll(bakedPart.getQuads(state, null, 0));
|
||||
}
|
||||
builder.put(Optional.<EnumFacing>absent(), quads.build());
|
||||
this.quads = builder.build();
|
||||
@@ -154,7 +199,7 @@ public final class MultiModel implements IModel
|
||||
@Override
|
||||
public ItemOverrideList getOverrides()
|
||||
{
|
||||
return ItemOverrideList.NONE;
|
||||
return overrides;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +262,7 @@ public final class MultiModel implements IModel
|
||||
for (Entry<String, Pair<IModel, IModelState>> entry : parts.entrySet())
|
||||
{
|
||||
Pair<IModel, IModelState> pair = entry.getValue();
|
||||
mapBuilder.put(entry.getKey(), pair.getLeft().bake(pair.getRight(), format, bakedTextureGetter));
|
||||
mapBuilder.put(entry.getKey(), pair.getLeft().bake(new ModelStateComposition(state, pair.getRight()), format, bakedTextureGetter));
|
||||
}
|
||||
|
||||
if(bakedBase == null && parts.isEmpty())
|
||||
|
||||
@@ -107,7 +107,7 @@ public enum Animation implements IResourceManagerReloadListener
|
||||
return defaultModelBlockAnimation;
|
||||
}
|
||||
ModelBlockAnimation mba = mbaGson.fromJson(new InputStreamReader(resource.getInputStream(), "UTF-8"), ModelBlockAnimation.class);
|
||||
String json = mbaGson.toJson(mba);
|
||||
//String json = mbaGson.toJson(mba);
|
||||
return mba;
|
||||
}
|
||||
catch(IOException e)
|
||||
@@ -124,7 +124,7 @@ public enum Animation implements IResourceManagerReloadListener
|
||||
|
||||
private IResourceManager manager;
|
||||
|
||||
private final AnimationStateMachine missing = new AnimationStateMachine(
|
||||
protected final AnimationStateMachine missing = new AnimationStateMachine(
|
||||
ImmutableMap.<String, ITimeValue>of(),
|
||||
ImmutableMap.of("missingno", (IClip)Clips.IdentityClip.instance),
|
||||
ImmutableList.of("missingno"),
|
||||
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package net.minecraftforge.client.model.animation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverride;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.IModelState;
|
||||
import net.minecraftforge.client.model.ModelStateComposition;
|
||||
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
public final class AnimationItemOverrideList extends ItemOverrideList
|
||||
{
|
||||
private final IModel model;
|
||||
private final IModelState state;
|
||||
private final VertexFormat format;
|
||||
private final Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter;
|
||||
|
||||
public AnimationItemOverrideList(IModel model, IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, ItemOverrideList overrides)
|
||||
{
|
||||
this(model, state, format, bakedTextureGetter, overrides.getOverrides());
|
||||
}
|
||||
|
||||
public AnimationItemOverrideList(IModel model, IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, List<ItemOverride> overrides)
|
||||
{
|
||||
super(overrides);
|
||||
this.model = model;
|
||||
this.state = state;
|
||||
this.format = format;
|
||||
this.bakedTextureGetter = bakedTextureGetter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity)
|
||||
{
|
||||
if(stack.hasCapability(net.minecraftforge.client.model.animation.CapabilityAnimation.ANIMATION_CAPABILITY, null))
|
||||
{
|
||||
// TODO: caching?
|
||||
IAnimationStateMachine asm = stack.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null);
|
||||
if(world == null)
|
||||
{
|
||||
world = entity.worldObj;
|
||||
}
|
||||
if(world == null)
|
||||
{
|
||||
world = Minecraft.getMinecraft().theWorld;
|
||||
}
|
||||
IModelState state = asm.apply(Animation.getWorldTime(world, Animation.getPartialTickTime())).getLeft();
|
||||
return model.bake(new ModelStateComposition(state, this.state), format, bakedTextureGetter);
|
||||
}
|
||||
return originalModel;
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,11 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.IModelState;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.client.model.pipeline.VertexLighterFlat;
|
||||
import net.minecraftforge.client.model.pipeline.VertexBufferConsumer;
|
||||
|
||||
@@ -28,14 +30,14 @@ import org.lwjgl.opengl.GL11;
|
||||
* Some quirks are still left, deprecated for the moment.
|
||||
*/
|
||||
@Deprecated
|
||||
public class AnimationModelBase<T extends Entity & IAnimationProvider> extends ModelBase implements IEventHandler<T>
|
||||
public class AnimationModelBase<T extends Entity> extends ModelBase implements IEventHandler<T>
|
||||
{
|
||||
private final VertexLighterFlat lighter;
|
||||
private final IModel model;
|
||||
private final ResourceLocation modelLocation;
|
||||
|
||||
public AnimationModelBase(IModel model, VertexLighterFlat lighter)
|
||||
public AnimationModelBase(ResourceLocation modelLocation, VertexLighterFlat lighter)
|
||||
{
|
||||
this.model = model;
|
||||
this.modelLocation = modelLocation;
|
||||
this.lighter = lighter;
|
||||
}
|
||||
|
||||
@@ -43,13 +45,14 @@ public class AnimationModelBase<T extends Entity & IAnimationProvider> extends M
|
||||
@Override
|
||||
public void render(Entity entity, float limbSwing, float limbSwingSpeed, float timeAlive, float yawHead, float rotationPitch, float scale)
|
||||
{
|
||||
if(!(entity instanceof IAnimationProvider))
|
||||
if(!(entity.hasCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null)))
|
||||
{
|
||||
throw new ClassCastException("AnimationModelBase expects IAnimationProvider");
|
||||
return;
|
||||
}
|
||||
|
||||
Pair<IModelState, Iterable<Event>> pair = ((IAnimationProvider)entity).asm().apply(timeAlive / 20);
|
||||
Pair<IModelState, Iterable<Event>> pair = entity.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null).apply(timeAlive / 20);
|
||||
handleEvents((T)entity, timeAlive / 20, pair.getRight());
|
||||
IModel model = ModelLoaderRegistry.getModelOrMissing(modelLocation);
|
||||
IBakedModel bakedModel = model.bake(pair.getLeft(), DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter());
|
||||
|
||||
BlockPos pos = new BlockPos(entity.posX, entity.posY + entity.height, entity.posZ);
|
||||
|
||||
@@ -18,12 +18,16 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
/**
|
||||
* Generic TileEntitySpecialRenderer that works with the Forge model system and animations.
|
||||
*/
|
||||
public class AnimationTESR<T extends TileEntity & IAnimationProvider> extends FastTESR<T> implements IEventHandler<T>
|
||||
public class AnimationTESR<T extends TileEntity> extends FastTESR<T> implements IEventHandler<T>
|
||||
{
|
||||
protected static BlockRendererDispatcher blockRenderer;
|
||||
|
||||
public void renderTileEntityFast(T te, double x, double y, double z, float partialTick, int breakStage, VertexBuffer renderer)
|
||||
{
|
||||
if(!te.hasCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
|
||||
BlockPos pos = te.getPos();
|
||||
IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
|
||||
@@ -38,7 +42,7 @@ public class AnimationTESR<T extends TileEntity & IAnimationProvider> extends Fa
|
||||
if(exState.getUnlistedNames().contains(Properties.AnimationProperty))
|
||||
{
|
||||
float time = Animation.getWorldTime(getWorld(), partialTick);
|
||||
Pair<IModelState, Iterable<Event>> pair = te.asm().apply(time);
|
||||
Pair<IModelState, Iterable<Event>> pair = te.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null).apply(time);
|
||||
handleEvents(te, time, pair.getRight());
|
||||
|
||||
// TODO: caching?
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package net.minecraftforge.client.model.animation;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
|
||||
|
||||
public class CapabilityAnimation
|
||||
{
|
||||
@CapabilityInject(IAnimationStateMachine.class)
|
||||
public static Capability<IAnimationStateMachine> ANIMATION_CAPABILITY = null;
|
||||
|
||||
public static void register()
|
||||
{
|
||||
CapabilityManager.INSTANCE.register(IAnimationStateMachine.class, new Capability.IStorage<IAnimationStateMachine>()
|
||||
{
|
||||
public NBTBase writeNBT(Capability<IAnimationStateMachine> capability, IAnimationStateMachine instance, EnumFacing side)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void readNBT(Capability<IAnimationStateMachine> capability, IAnimationStateMachine instance, EnumFacing side, NBTBase nbt) {}
|
||||
}, new Callable<IAnimationStateMachine>()
|
||||
{
|
||||
public IAnimationStateMachine call() throws Exception
|
||||
{
|
||||
return Animation.INSTANCE.missing;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static class DefaultItemAnimationCapabilityProvider implements ICapabilityProvider
|
||||
{
|
||||
private final IAnimationStateMachine asm;
|
||||
|
||||
public DefaultItemAnimationCapabilityProvider(IAnimationStateMachine asm)
|
||||
{
|
||||
this.asm = asm;
|
||||
}
|
||||
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
|
||||
{
|
||||
return capability == ANIMATION_CAPABILITY;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing)
|
||||
{
|
||||
if(capability == ANIMATION_CAPABILITY)
|
||||
{
|
||||
return (T)asm;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package net.minecraftforge.client.model.animation;
|
||||
|
||||
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
|
||||
|
||||
|
||||
/**
|
||||
* Something that can provide the Animation State Machine, for example and Entity or a Block
|
||||
*/
|
||||
public interface IAnimationProvider
|
||||
{
|
||||
public IAnimationStateMachine asm();
|
||||
}
|
||||
@@ -49,7 +49,6 @@ import net.minecraftforge.client.model.b3d.B3DModel.Mesh;
|
||||
import net.minecraftforge.client.model.b3d.B3DModel.Node;
|
||||
import net.minecraftforge.client.model.b3d.B3DModel.Texture;
|
||||
import net.minecraftforge.client.model.b3d.B3DModel.Vertex;
|
||||
import net.minecraftforge.client.model.pipeline.LightUtil;
|
||||
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
@@ -680,9 +679,16 @@ public final class B3DLoader implements ICustomModelLoader
|
||||
if(quads == null)
|
||||
{
|
||||
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
|
||||
generateQuads(builder, node, modelState);
|
||||
generateQuads(builder, node, this.state);
|
||||
quads = builder.build();
|
||||
}
|
||||
// TODO: caching?
|
||||
if(this.state != modelState)
|
||||
{
|
||||
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
|
||||
generateQuads(builder, node, modelState);
|
||||
return builder.build();
|
||||
}
|
||||
return quads;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user