仅在库存中阻止纹理加载

时间:2016-06-09 16:45:54

标签: java minecraft minecraft-forge

我正在创建一个mod但是块的纹理(唯一的)只在库存中加载,当它被删除时,希望你能帮助我,我正在使用1.8 MDK。

Blockstates:

    {
    "variants"": {
        "normal": {"model": "horsenexus:horse_block"},
     }
}

模型,阻止:

{
    "parent": "block/cube_all",
    "textures": {
        "down": "horsenexus:blocks/horse_block_down",
        "up": "horsenexus:blocks/horse_block_top",
        "north": "horsenexus:blocks/horse_block_north",
        "east": "horsenexus:blocks/horse_block_east",
        "south": "horsenexus:blocks/horse_block_south",
        "west": "horsenexus:blocks/horse_block_west"
    }

}

模特,项目:

{
    "parent": "horsenexus:block/horse_block",
    "display": {
        "thirdperson": {
            "rotation": [ 10, -45, 170 ],
            "translation": [ 0, 1.5, -2.75 ],
            "scale": [ 0.375, 0.375, 0.375 ]
         }
     }
}

代码:

package com.crazyhoorse961.core.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;

public class HorseBlock extends Block{

    public HorseBlock(Material materialIn) {
        super(materialIn);
        this.setHardness(5.6F);
        this.setResistance(56.34F);
        this.setStepSound(this.soundTypeSnow);
    }

}

最后一个:

package com.crazyhoorse961.core.init;

import com.crazyhoorse961.core.Reference;
import com.crazyhoorse961.core.blocks.HorseBlock;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class Horse_Block {
    public static Block horse_block;

    public static void init()
    {

        horse_block = new HorseBlock(Material.clay).setUnlocalizedName("horse_block");
    }

    public static void register()
    {
        GameRegistry.registerBlock(horse_block, horse_block.getUnlocalizedName().substring(5));
    }

    public static void registerRenders()
    {
        registerRender(horse_block);
    }

    public static void registerRender(Block block)
    {

        Item item = Item.getItemFromBlock(block);
        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));

        }
    }

感谢您帮助我,祝您有个美好的一天。

1 个答案:

答案 0 :(得分:1)

尝试更改“模型,阻止”代码中的以下行

"parent": "block/cube_all",

成:

"parent": "block/cube",

据我所知,'cube_all'仅在块的所有边使用相同的纹理时使用。