Java 类net.minecraftforge.client.model.SimpleModelState 实例源码

项目:CrystalMod    文件:RenderTileCrystalCluster.java   
public static IBakedModel getBakedCluster(){
    if(bakedCluster == null){
        IModel model;
        try {
            model = OBJLoader.INSTANCE.loadModel(CrystalMod.resourceL("models/block/obj/cluster.obj"));
            Function<ResourceLocation, TextureAtlasSprite> textureGetter;
            textureGetter = new Function<ResourceLocation, TextureAtlasSprite>()
            {
                @Override
                public TextureAtlasSprite apply(ResourceLocation location)
                {
                    return RenderUtil.getSprite(location);
                }
            };

            bakedCluster = model.bake(new SimpleModelState(DynamicBaseModel.DEFAULT_PERSPECTIVE_TRANSFORMS), DefaultVertexFormats.BLOCK, textureGetter);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return bakedCluster;
}
项目:Hard-Science    文件:HSOBJModelWrapper.java   
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    ImmutableMap.Builder<TransformType, TRSRTransformation> builder = ImmutableMap.builder();

    // This is borked up for the 1st and 3rd person transforms - OBJ models not needed right now so setting aside
    // Qould normally not belong here - should register transforms at item creation time and then retrieve them here.

    builder.put(TransformType.FIRST_PERSON_RIGHT_HAND, getTransform(  0.250f, 1.000f,  0.000f, 000, -90,  25, 0.65f));
    builder.put(TransformType.FIRST_PERSON_LEFT_HAND,  getTransform( -0.250f, 1.000f,  0.000f, 000,  90, -25, 0.65f));

    builder.put(TransformType.THIRD_PERSON_RIGHT_HAND, getTransform(  0.000f, 0.000f,  0.000f, 000, 000, 000, 1.0f));
    builder.put(TransformType.THIRD_PERSON_LEFT_HAND,  getTransform(  0.000f, 0.000f,  0.000f, 000, 000, 000, 1.0f));

    builder.put(TransformType.FIXED,                   getTransform(  0.500f, 0.500f,  0.500f, 0, 180, 0,   0.9f));
    builder.put(TransformType.GUI,                     getTransform(  0.500f, 0.500f,  0.500f, 0, 0, 45,  1.0f));
    builder.put(TransformType.GROUND,                  getTransform(  0.500f, 0.400f,  0.500f, 0, 0, 0,     0.6f));


    IModelState perspectiveState = new SimpleModelState(builder.build());

    return wrapped.bake(perspectiveState, format, bakedTextureGetter);
}
项目:Adventurers-Toolbox    文件:MaceModel.java   
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
        @Nullable World world, @Nullable EntityLivingBase entity) {

    if (stack.getItem() != ModItems.mace) {
        return originalModel;
    }

    BakedMaceModel model = (BakedMaceModel) originalModel;

    String key = IHeadTool.getHeadMat(stack).getName() + "|"
            + IHaftTool.getHaftMat(stack).getName() + "|"
            + IHandleTool.getHandleMat(stack).getName() + "|"
            + IAdornedTool.getAdornmentMat(stack).getName();

    if (!model.cache.containsKey(key)) {
        ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
        builder.put("head", IHeadTool.getHeadMat(stack).getName());
        builder.put("haft", IHaftTool.getHaftMat(stack).getName());
        builder.put("handle", IHandleTool.getHandleMat(stack).getName());
        if (IAdornedTool.getAdornmentMat(stack) != ModMaterials.ADORNMENT_NULL) {
            builder.put("adornment", IAdornedTool.getAdornmentMat(stack).getName());
        }
        IModel parent = model.parent.retexture(builder.build());
        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(key, bakedModel);
        return bakedModel;
    }

    return model.cache.get(key);
}
项目:Adventurers-Toolbox    文件:DaggerModel.java   
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
        @Nullable World world, @Nullable EntityLivingBase entity) {

    if (stack.getItem() != ModItems.dagger) {
        return originalModel;
    }

    BakedDaggerModel model = (BakedDaggerModel) originalModel;

    String key = IBladeTool.getBladeMat(stack).getName() + "|"
            + IHandleTool.getHandleMat(stack).getName() + "|"
            + IAdornedTool.getAdornmentMat(stack).getName();

    if (!model.cache.containsKey(key)) {
        ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
        builder.put("blade", IBladeTool.getBladeMat(stack).getName());
        builder.put("handle", IHandleTool.getHandleMat(stack).getName());
        if (IAdornedTool.getAdornmentMat(stack) != ModMaterials.ADORNMENT_NULL) {
            builder.put("adornment", IAdornedTool.getAdornmentMat(stack).getName());
        }
        IModel parent = model.parent.retexture(builder.build());
        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(key, bakedModel);
        return bakedModel;
    }

    return model.cache.get(key);
}
项目:Adventurers-Toolbox    文件:HoeModel.java   
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
        @Nullable World world, @Nullable EntityLivingBase entity) {

    if (stack.getItem() != ModItems.hoe) {
        return originalModel;
    }

    BakedHoeModel model = (BakedHoeModel) originalModel;

    String key = IHeadTool.getHeadMat(stack).getName() + "|"
            + IHaftTool.getHaftMat(stack).getName() + "|"
            + IHandleTool.getHandleMat(stack).getName() + "|"
            + IAdornedTool.getAdornmentMat(stack).getName();

    if (!model.cache.containsKey(key)) {
        ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
        builder.put("head", IHeadTool.getHeadMat(stack).getName());
        builder.put("haft", IHaftTool.getHaftMat(stack).getName());
        builder.put("handle", IHandleTool.getHandleMat(stack).getName());
        if (IAdornedTool.getAdornmentMat(stack) != ModMaterials.ADORNMENT_NULL) {
            builder.put("adornment", IAdornedTool.getAdornmentMat(stack).getName());
        }
        IModel parent = model.parent.retexture(builder.build());
        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(key, bakedModel);
        return bakedModel;
    }

    return model.cache.get(key);
}
项目:Adventurers-Toolbox    文件:PickaxeModel.java   
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
        @Nullable World world, @Nullable EntityLivingBase entity) {

    if (stack.getItem() != ModItems.pickaxe) {
        return originalModel;
    }

    BakedPickaxeModel model = (BakedPickaxeModel) originalModel;

    String key = IHeadTool.getHeadMat(stack).getName() + "|"
            + IHaftTool.getHaftMat(stack).getName() + "|"
            + IHandleTool.getHandleMat(stack).getName() + "|"
            + IAdornedTool.getAdornmentMat(stack).getName();

    if (!model.cache.containsKey(key)) {
        ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
        builder.put("head", IHeadTool.getHeadMat(stack).getName());
        builder.put("haft", IHaftTool.getHaftMat(stack).getName());
        builder.put("handle", IHandleTool.getHandleMat(stack).getName());
        if (IAdornedTool.getAdornmentMat(stack) != ModMaterials.ADORNMENT_NULL) {
            builder.put("adornment", IAdornedTool.getAdornmentMat(stack).getName());
        }
        IModel parent = model.parent.retexture(builder.build());
        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(key, bakedModel);
        return bakedModel;
    }

    return model.cache.get(key);
}
项目:Adventurers-Toolbox    文件:AxeModel.java   
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
        @Nullable World world, @Nullable EntityLivingBase entity) {

    if (stack.getItem() != ModItems.axe) {
        return originalModel;
    }

    BakedAxeModel model = (BakedAxeModel) originalModel;

    String key = IHeadTool.getHeadMat(stack).getName() + "|"
            + IHaftTool.getHaftMat(stack).getName() + "|"
            + IHandleTool.getHandleMat(stack).getName() + "|"
            + IAdornedTool.getAdornmentMat(stack).getName();

    if (!model.cache.containsKey(key)) {
        ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
        builder.put("head", IHeadTool.getHeadMat(stack).getName());
        builder.put("haft", IHaftTool.getHaftMat(stack).getName());
        builder.put("handle", IHandleTool.getHandleMat(stack).getName());
        if (IAdornedTool.getAdornmentMat(stack) != ModMaterials.ADORNMENT_NULL) {
            builder.put("adornment", IAdornedTool.getAdornmentMat(stack).getName());
        }
        IModel parent = model.parent.retexture(builder.build());
        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(key, bakedModel);
        return bakedModel;
    }

    return model.cache.get(key);
}
项目:Adventurers-Toolbox    文件:HammerModel.java   
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
        @Nullable World world, @Nullable EntityLivingBase entity) {

    if (stack.getItem() != ModItems.hammer) {
        return originalModel;
    }

    BakedHammerModel model = (BakedHammerModel) originalModel;

    String key = IHeadTool.getHeadMat(stack).getName() + "|"
            + IHaftTool.getHaftMat(stack).getName() + "|"
            + IHandleTool.getHandleMat(stack).getName() + "|"
            + IAdornedTool.getAdornmentMat(stack).getName();

    if (!model.cache.containsKey(key)) {
        ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
        builder.put("head", IHeadTool.getHeadMat(stack).getName());
        builder.put("haft", IHaftTool.getHaftMat(stack).getName());
        builder.put("handle", IHandleTool.getHandleMat(stack).getName());
        if (IAdornedTool.getAdornmentMat(stack) != ModMaterials.ADORNMENT_NULL) {
            builder.put("adornment", IAdornedTool.getAdornmentMat(stack).getName());
        }
        IModel parent = model.parent.retexture(builder.build());
        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(key, bakedModel);
        return bakedModel;
    }

    return model.cache.get(key);
}
项目:Adventurers-Toolbox    文件:ShovelModel.java   
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
        @Nullable World world, @Nullable EntityLivingBase entity) {

    if (stack.getItem() != ModItems.shovel) {
        return originalModel;
    }

    BakedShovelModel model = (BakedShovelModel) originalModel;

    String key = IHeadTool.getHeadMat(stack).getName() + "|"
            + IHaftTool.getHaftMat(stack).getName() + "|"
            + IHandleTool.getHandleMat(stack).getName() + "|"
            + IAdornedTool.getAdornmentMat(stack).getName();

    if (!model.cache.containsKey(key)) {
        ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
        builder.put("head", IHeadTool.getHeadMat(stack).getName());
        builder.put("haft", IHaftTool.getHaftMat(stack).getName());
        builder.put("handle", IHandleTool.getHandleMat(stack).getName());
        if (IAdornedTool.getAdornmentMat(stack) != ModMaterials.ADORNMENT_NULL) {
            builder.put("adornment", IAdornedTool.getAdornmentMat(stack).getName());
        }
        IModel parent = model.parent.retexture(builder.build());
        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(key, bakedModel);
        return bakedModel;
    }

    return model.cache.get(key);
}
项目:Adventurers-Toolbox    文件:SwordModel.java   
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
        @Nullable World world, @Nullable EntityLivingBase entity) {

    if (stack.getItem() != ModItems.sword) {
        return originalModel;
    }

    BakedSwordModel model = (BakedSwordModel) originalModel;

    String key = IBladeTool.getBladeMat(stack).getName() + "|"
            + ICrossguardTool.getCrossguardMat(stack).getName() + "|"
            + IHandleTool.getHandleMat(stack).getName() + "|"
            + IAdornedTool.getAdornmentMat(stack).getName();

    if (!model.cache.containsKey(key)) {
        ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
        builder.put("blade", IBladeTool.getBladeMat(stack).getName());
        builder.put("crossguard", ICrossguardTool.getCrossguardMat(stack).getName());
        builder.put("handle", IHandleTool.getHandleMat(stack).getName());
        if (IAdornedTool.getAdornmentMat(stack) != ModMaterials.ADORNMENT_NULL) {
            builder.put("adornment", IAdornedTool.getAdornmentMat(stack).getName());
        }
        IModel parent = model.parent.retexture(builder.build());
        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(key, bakedModel);
        return bakedModel;
    }

    return model.cache.get(key);
}
项目:Adventurers-Toolbox    文件:HandpickModel.java   
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
        @Nullable World world, @Nullable EntityLivingBase entity) {

    if (stack.getItem() != ModItems.handpick) {
        return originalModel;
    }

    BakedHandpickModel model = (BakedHandpickModel) originalModel;

    String key = IHeadTool.getHeadMat(stack).getName() + "|"
            + IHaftTool.getHaftMat(stack).getName() + "|"
            + IHandleTool.getHandleMat(stack).getName() + "|"
            + IAdornedTool.getAdornmentMat(stack).getName();

    if (!model.cache.containsKey(key)) {
        ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
        builder.put("head", IHeadTool.getHeadMat(stack).getName());
        builder.put("haft", IHaftTool.getHaftMat(stack).getName());
        builder.put("handle", IHandleTool.getHandleMat(stack).getName());
        if (IAdornedTool.getAdornmentMat(stack) != ModMaterials.ADORNMENT_NULL) {
            builder.put("adornment", IAdornedTool.getAdornmentMat(stack).getName());
        }
        IModel parent = model.parent.retexture(builder.build());
        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(key, bakedModel);
        return bakedModel;
    }

    return model.cache.get(key);
}
项目:CrystalMod    文件:ModelWrappedFood.java   
@Override
   public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity)
   {
       ItemStack food = ItemWrappedFood.getFood(stack);

       // not a crop item
       if (!ItemStackTools.isValid(food))
       {
           return originalModel;
       }

       //BakedSeed model = (BakedSeed)originalModel;
       BakedItemModel model = (BakedItemModel)originalModel;
       String name = ItemUtil.getStringForItemStack(food, true, false);
       String cacheName = name+"v1";
       if (!cache.containsKey(cacheName))
       {
           IModel parent = model.parent.process(ImmutableMap.of("food", name));
           Function<ResourceLocation, TextureAtlasSprite> textureGetter;
           textureGetter = new Function<ResourceLocation, TextureAtlasSprite>()
           {
               @Override
public TextureAtlasSprite apply(ResourceLocation location)
               {
                   return RenderUtil.getSprite(location);
               }
           };

           IBakedModel bakedModel = parent.bake(new SimpleModelState(model.transforms), model.format, textureGetter);
           cache.put(cacheName, bakedModel);
           return bakedModel;
       }

       return cache.get(cacheName);
   }
项目:CrystalMod    文件:ModelSeed.java   
@Override
   public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity)
   {
       IMaterialCrop crop = ItemMaterialSeed.getCrop(stack);

       // not a crop item
       if (crop == null)
       {
           return originalModel;
       }

       //BakedSeed model = (BakedSeed)originalModel;
       BakedItemModel model = (BakedItemModel)originalModel;
       String name = crop.getUnlocalizedName();
       String cacheName = name+"v11";
       if (!cache.containsKey(cacheName))
       {
           IModel parent = model.parent.process(ImmutableMap.of("crop", name));
           Function<ResourceLocation, TextureAtlasSprite> textureGetter;
           textureGetter = new Function<ResourceLocation, TextureAtlasSprite>()
           {
               @Override
public TextureAtlasSprite apply(ResourceLocation location)
               {
                   return RenderUtil.getSprite(location);
               }
           };

           IBakedModel bakedModel = parent.bake(new SimpleModelState(model.transforms), model.format, textureGetter);
           cache.put(cacheName, bakedModel);
           return bakedModel;
       }

       return cache.get(cacheName);
   }
项目:enderutilities    文件:ModelEnderBucket.java   
@Override
public IBakedModel handleItemState(IBakedModel originalModelIn, ItemStack stack, World world, EntityLivingBase entity)
{
    if ((stack.getItem() instanceof ItemEnderBucket) == false)
    {
        return originalModelIn;
    }

    BakedEnderBucket originalModel = (BakedEnderBucket) originalModelIn;
    ItemEnderBucket item = (ItemEnderBucket)stack.getItem();
    String linked = ItemEnderBucket.LinkMode.fromStack(stack) == ItemEnderBucket.LinkMode.ENABLED ? "true" : "false";
    int capacity = item.getCapacityCached(stack, null);
    ItemEnderBucket.BucketMode mode = ItemEnderBucket.BucketMode.fromStack(stack);
    String modeStr = "none";
    int amount = 0;

    FluidStack fluidStack = item.getFluidCached(stack);
    Fluid fluid = null;

    if (fluidStack != null)
    {
        amount = fluidStack.amount;
        fluid = fluidStack.getFluid();
    }

    if (mode == ItemEnderBucket.BucketMode.DRAIN) { modeStr = "drain"; }
    else if (mode == ItemEnderBucket.BucketMode.FILL) { modeStr = "fill"; }
    else if (mode == ItemEnderBucket.BucketMode.BIND) { modeStr = "bind"; }

    String key = linked + "_" + modeStr + "_" + fluid + "_" + amount + "_" + capacity;

    if (originalModel.cache.containsKey(key) == false)
    {
        ImmutableMap.Builder<String, String> map = ImmutableMap.builder();
        if (fluid != null)
        {
            map.put("fluid", fluid.getName());
        }
        map.put("linked", linked);
        map.put("mode", modeStr);
        map.put("amount", String.valueOf(amount));
        map.put("capacity", String.valueOf(capacity));

        IModel parent = originalModel.parent.process(map.build());

        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(originalModel.transforms), originalModel.format, textureGetter);
        originalModel.cache.put(key, bakedModel);

        return bakedModel;
    }

    return originalModel.cache.get(key);
}
项目:enderutilities    文件:ModelEnderTools.java   
@Override
public IBakedModel handleItemState(IBakedModel originalModelIn, ItemStack stack, World world, EntityLivingBase entity)
{
    boolean isTool = stack.getItem() == EnderUtilitiesItems.ENDER_TOOL;
    ItemLocationBoundModular item = (ItemLocationBoundModular)stack.getItem();
    String core = String.valueOf(item.getSelectedModuleTier(stack, ModuleType.TYPE_ENDERCORE));
    String cap = String.valueOf(item.getSelectedModuleTier(stack, ModuleType.TYPE_ENDERCAPACITOR));
    String lc = String.valueOf(item.getSelectedModuleTier(stack, ModuleType.TYPE_LINKCRYSTAL));
    String toolClass;
    String broken;
    String powered;
    String creative;
    String mode;
    String key;

    if (isTool)
    {
        ItemEnderTool itemTool = (ItemEnderTool)stack.getItem();
        toolClass = ItemEnderTool.ToolType.fromStack(stack).getToolClass();
        broken = String.valueOf(itemTool.isToolBroken(stack));
        powered = String.valueOf(ItemEnderTool.PowerStatus.fromStack(stack) == ItemEnderTool.PowerStatus.POWERED);
        creative = String.valueOf(itemTool.isCreativeLikeBreakingEnabled(stack));
        mode = String.valueOf(ItemEnderTool.DropsMode.fromStack(stack).ordinal());
        key = toolClass + broken + powered + creative + mode + core + cap + lc;
    }
    else
    {
        ItemEnderSword itemSword = (ItemEnderSword)stack.getItem();
        toolClass = "sword";
        broken = String.valueOf(itemSword.isToolBroken(stack));
        powered = "false";
        creative = "false";
        mode = String.valueOf(ItemEnderSword.SwordMode.fromStack(stack).ordinal());
        key = broken + powered + creative + mode + core + cap + lc;
    }

    BakedEnderTool originalModel = (BakedEnderTool) originalModelIn;

    if (originalModel.cache.containsKey(key) == false)
    {
        ImmutableMap.Builder<String, String> map = ImmutableMap.builder();
        map.put("toolClass", toolClass);
        map.put("broken", broken);
        map.put("powered", powered);
        map.put("creative", creative);
        map.put("mode", mode);
        map.put("core", core);
        map.put("capacitor", cap);
        map.put("lc", lc);

        IModel model = originalModel.parent.process(map.build());

        Function<ResourceLocation, TextureAtlasSprite> textureGetter;
        textureGetter = new Function<ResourceLocation, TextureAtlasSprite>()
        {
            public TextureAtlasSprite apply(ResourceLocation location)
            {
                return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
            }
        };

        IBakedModel bakedModel = model.bake(new SimpleModelState(originalModel.transforms), originalModel.format, textureGetter);
        originalModel.cache.put(key, bakedModel);

        return bakedModel;
    }

    return originalModel.cache.get(key);
}