Cleanup in modelhandler, tweak to caching in corporea cube renderer

This commit is contained in:
Vincent Lee committed 2016-02-17 17:49:54 -06:00
1 parent 769ed577c4
commit 9e0c7ba0c7
2 files changed
+7 -23

No files matched your search

@@ -703,33 +703,16 @@ public final class ModelHandler {
}
private static void registerStateMappers() {
// Override to let smartmodels work, see RenderEventHandler
ModelLoader.setCustomStateMapper(ModBlocks.floatingSpecialFlower, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return new ModelResourceLocation("botania:floatingSpecialFlower", "normal");
}
});
ModelLoader.setCustomStateMapper(ModBlocks.floatingFlower, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return new ModelResourceLocation("botania:miniIsland", "normal");
}
});
ModelLoader.setCustomStateMapper(ModBlocks.platform, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return new ModelResourceLocation("botania:platform", "normal");
}
});
// Override to let smart models work, see MiscellaneousIcons
ModelLoader.setCustomStateMapper(ModBlocks.floatingSpecialFlower, new StateMap.Builder().ignore(BotaniaStateProps.COLOR).build());
ModelLoader.setCustomStateMapper(ModBlocks.floatingFlower, new StateMap.Builder().ignore(BotaniaStateProps.COLOR).build());
ModelLoader.setCustomStateMapper(ModBlocks.platform, new StateMap.Builder().ignore(BotaniaStateProps.PLATFORM_VARIANT).build());
// Ignore vanilla facing, variant in double flower
ModelLoader.setCustomStateMapper(ModBlocks.doubleFlower1, (new StateMap.Builder()).ignore(BlockDoublePlant.VARIANT, BlockDoublePlant.field_181084_N).build());
ModelLoader.setCustomStateMapper(ModBlocks.doubleFlower2, (new StateMap.Builder()).ignore(BlockDoublePlant.VARIANT, BlockDoublePlant.field_181084_N).build());
// Ignore color in unstable cube, mana beacon, special flower, and petals (handled by color multiplier)
// Ignore color in unstable cube, mana beacon, special flower, and petals (handled by Block.colorMultiplier)
ModelLoader.setCustomStateMapper(ModBlocks.unstableBlock, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR).build());
ModelLoader.setCustomStateMapper(ModBlocks.manaBeacon, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR).build());
ModelLoader.setCustomStateMapper(ModBlocks.petalBlock, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR).build());
@@ -143,7 +143,8 @@ public class RenderTileCorporeaCrystalCube extends TileEntitySpecialRenderer<Til
// Copied from AnimationTESR
protected static BlockRendererDispatcher blockRenderer;
protected static final LoadingCache<Pair<IExtendedBlockState, IModelState>, IBakedModel> modelCache = CacheBuilder.newBuilder().maximumSize(10).expireAfterWrite(100, TimeUnit.MILLISECONDS).build(new CacheLoader<Pair<IExtendedBlockState, IModelState>, IBakedModel>()
// Botania - expanded size to 15 to hold all states, expanded expire time to 1 sec for performance
protected static final LoadingCache<Pair<IExtendedBlockState, IModelState>, IBakedModel> modelCache = CacheBuilder.newBuilder().maximumSize(15).expireAfterWrite(1000, TimeUnit.MILLISECONDS).build(new CacheLoader<Pair<IExtendedBlockState, IModelState>, IBakedModel>()
{
public IBakedModel load(Pair<IExtendedBlockState, IModelState> key) throws Exception
{