@Override
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity)
{
FluidStack fluidStack = FluidUtil.getFluidContained(stack);
// not a fluid item apparently
if (fluidStack == null)
{
// empty bucket
return originalModel;
}
BakedDynBucket model = (BakedDynBucket)originalModel;
Fluid fluid = fluidStack.getFluid();
String name = fluid.getName();
if (!model.cache.containsKey(name))
{
IModel parent = model.parent.process(ImmutableMap.of("fluid", name));
Function<ResourceLocation, TextureAtlasSprite> textureGetter;
textureGetter = new Function<ResourceLocation, TextureAtlasSprite>()
{
public TextureAtlasSprite apply(ResourceLocation location)
{
return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
}
};
IBakedModel bakedModel = parent.bake(new SimpleModelState(model.transforms), model.format, textureGetter);
model.cache.put(name, bakedModel);
return bakedModel;
}
return model.cache.get(name);
}
ModelDynBucket.java 文件源码
java
阅读 31
收藏 0
点赞 0
评论 0
项目:CustomWorldGen
作者:
评论列表
文章目录