Jump to content

[SOLVED] [1.12.2] Metadata blocks in inventory


JimiIT92

Recommended Posts

Hi everyone :D I'm trying to make metadata blocks in 1.12.2 using the forge_marker blockstates system. Now, the block itself works fine, if i place them down i get different textures based on their variant. But in inventory i get the black/purple texture :/ This is my json blockstate file
 

{
    "forge_marker": 1,
    "defaults": {
        "textures": {
        },
        "model": "cube_all"
    },
    "variants": {
        "normal": [{

        }],
        "inventory": [{

        }],
         "color": {
            "white":  { "textures": { "all": "mineworld:blocks/marble_white"} },
            "black":  { "textures": { "all": "mineworld:blocks/marble_black"} },
            "red":  { "textures": { "all": "mineworld:blocks/marble_red"} },
            "brown":  { "textures": { "all": "mineworld:blocks/marble_brown"} },
            "pink":  { "textures": { "all": "mineworld:blocks/marble_pink"} },
            "yellow":  { "textures": { "all": "mineworld:blocks/marble_yellow"} },
            "green":  { "textures": { "all": "mineworld:blocks/marble_green"} }
        }
    }
}

And this is how i register them
 

ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MARBLE), 0, new ModelResourceLocation(MARBLE.getRegistryName() + "_white", "white"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MARBLE), 1, new ModelResourceLocation(MARBLE.getRegistryName() + "_black", "black"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MARBLE), 2, new ModelResourceLocation(MARBLE.getRegistryName() + "_red", "red"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MARBLE), 3, new ModelResourceLocation(MARBLE.getRegistryName() + "_brown", "brown"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MARBLE), 4, new ModelResourceLocation(MARBLE.getRegistryName() + "_pink", "pink"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MARBLE), 5, new ModelResourceLocation(MARBLE.getRegistryName() + "_yellow", "yellow"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MARBLE), 6, new ModelResourceLocation(MARBLE.getRegistryName() + "_green", "green"));

 

What am i missing here? :/ 

 

Edited by JimiIT92
Solved

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

MARBLE.getRegistryName() + "_black", "black"));

 

You're telling it to look for a different file every time. Drop that "_color" bit.

 

Also, read your logs.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I removed that color part but nothing changed. My log throws this error

 

[15:40:30] [main/ERROR] [FML]: Exception loading model for variant mineworld:marble#white for item "mineworld:marble", blockstate location exception: 
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model mineworld:marble#white with loader VariantLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:296) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:151) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
	at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:559) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_181]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_181]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException
	at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:83) ~[ModelBlockDefinition.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1175) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
	... 20 more

 

Edited by JimiIT92
removed log syntax highlight

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

If i change to this

 

{
    "forge_marker": 1,
    "defaults": {
        "textures": {
        },
        "model": "cube_all"
    },
    "variants": {
        "normal": [{

        }],
        "inventory": [{

        }],
        "color": {
            "color=white":  { "textures": { "all": "mineworld:blocks/marble_white"} },
            "color=black":  { "textures": { "all": "mineworld:blocks/marble_black"} },
            "color=red":  { "textures": { "all": "mineworld:blocks/marble_red"} },
            "color=brown":  { "textures": { "all": "mineworld:blocks/marble_brown"} },
            "color=pink":  { "textures": { "all": "mineworld:blocks/marble_pink"} },
            "color=yellow":  { "textures": { "all": "mineworld:blocks/marble_yellow"} },
            "color=green":  { "textures": { "all": "mineworld:blocks/marble_green"} }
        }
    }
}

or to this
 

{
    "forge_marker": 1,
    "defaults": {
        "textures": {
        },
        "model": "cube_all"
    },
    "variants": {
        "normal": [{

        }],
        "inventory": [{

        }],
        "color=white":  { "textures": { "all": "mineworld:blocks/marble_white"} },
        "color=black":  { "textures": { "all": "mineworld:blocks/marble_black"} },
        "color=red":  { "textures": { "all": "mineworld:blocks/marble_red"} },
        "color=brown":  { "textures": { "all": "mineworld:blocks/marble_brown"} },
        "color=pink":  { "textures": { "all": "mineworld:blocks/marble_pink"} },
        "color=yellow":  { "textures": { "all": "mineworld:blocks/marble_yellow"} },
        "color=green":  { "textures": { "all": "mineworld:blocks/marble_green"} }
    }
}

then the placed block has no texture too :/ Also i don't understand where the difference comes from and how to tell the game to use the one without "color=" instead

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

Ok, i thought it was some error in the json file since it's the first time i use the forge blockstate format. Anyway this is the class i'm using to create the block with the variants
 

package com.mineworld.block;

import com.mineworld.block.enums.EnumMarble;
import com.mineworld.core.MWTabs;

import net.minecraft.block.BlockPlanks;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;

public class BlockMarble extends BlockMW {
	private static final PropertyEnum<EnumMarble> COLOR = PropertyEnum.<EnumMarble>create("color", EnumMarble.class);

	public BlockMarble(String name) {
		super(name, Material.ROCK, MapColor.QUARTZ, SoundType.STONE, MWTabs.BUILDING_BLOCKS);
		this.setDefaultState(this.blockState.getBaseState().withProperty(COLOR, EnumMarble.WHITE));
		setHardness(1.5F);
		setResistance(10.0F);
	}

	/**
	 * Gets the metadata of the item this Block can drop. This method is called when
	 * the block gets destroyed. It returns the metadata of the dropped item based
	 * on the old metadata of the block.
	 */
	public int damageDropped(IBlockState state) {
		return ((EnumMarble) state.getValue(COLOR)).getMetadata();
	}

	/**
	 * returns a list of blocks with the same ID, but different meta (eg: wood
	 * returns 4 blocks)
	 */
	public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items) {
		for (EnumMarble value : EnumMarble.values()) {
			items.add(new ItemStack(this, 1, value.getMetadata()));
		}
	}

	/**
	 * Get the MapColor for this Block and the given BlockState
	 */
	public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
		return ((EnumMarble) state.getValue(COLOR)).getMapColor();
	}

	/**
	 * Convert the BlockState into the correct metadata value
	 */
	public int getMetaFromState(IBlockState state) {
		return ((EnumMarble) state.getValue(COLOR)).getMetadata();
	}

	protected BlockStateContainer createBlockState() {
		return new BlockStateContainer(this, new IProperty[] { COLOR });
	}

	/**
	 * Convert the given metadata into a BlockState for this Block
	 */
	public IBlockState getStateFromMeta(int meta) {
		return this.getDefaultState().withProperty(COLOR, EnumMarble.byMetadata(meta));
	}
}

BlockMW just sets the registry name, the unlocalized name and the creative tab

 

This is the enum i use to create the variants
 

package com.mineworld.block.enums;

import net.minecraft.block.material.MapColor;
import net.minecraft.util.IStringSerializable;

public enum EnumMarble implements IStringSerializable {
	WHITE(0, "white", MapColor.QUARTZ),
	BLACK(1, "black", MapColor.BLACK),
	RED(2, "red", MapColor.RED),
	BROWN(3, "brown", MapColor.BROWN),
	PINK(4, "pink", MapColor.PINK),
	YELLOW(5, "yellow", MapColor.YELLOW),
	GREEN(6, "green", MapColor.GREEN);

	private static final EnumMarble[] META_LOOKUP = new EnumMarble[values().length];
	private final int meta;
    private final String name;
    private final MapColor mapColor;
	
    private EnumMarble(int metaIn, String nameIn, MapColor mapColorIn)
    {
        this.meta = metaIn;
        this.name = nameIn;
        this.mapColor = mapColorIn;
    }
    
    static
    {
        for (EnumMarble value : values())
        {
            META_LOOKUP[value.getMetadata()] = value;
        }
    }
    
    public static EnumMarble byMetadata(int meta)
    {
        if (meta < 0 || meta >= META_LOOKUP.length)
        {
            meta = 0;
        }

        return META_LOOKUP[meta];
    }
    
	@Override
	public String getName() {
		return this.name;
	}

	public int getMetadata() {
		return this.meta;
	}

	public MapColor getMapColor() {
		return this.mapColor;
	}

	public String toString() {
        return this.name;
    }
}

 I looked at the vanilla code for planks but i can't find any difference that makes the variant incorrect

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

I use that base class just for blocks that don't have any particular feature (like ores, mineral blocks or colored blocks) :) Anyway i changed the registration part to "color=white" instead of just white and it worked. Except it isn't for slabs, wich i did the same thing. It says it can't found a variant for slab#color=yellow but in the model registration i specified the variant like the normal block ("color=yellow"). In this case the error could be in the json file? Here's the one i'm using

 

{
    "forge_marker": 1,
    "variants": {
        "normal": [{

        }],
        "inventory": [{

        }],
        "half": {
            "top": {
                "model": "upper_slab"
            },
            "bottom": {
                "model": "half_slab"
            }
        },
        "color": {
            "white":  { "textures": { "bottom": "mineworld:blocks/marble_white", 
                "side": "mineworld:blocks/marble_white", 
                "top": "mineworld:blocks/marble_white"

            } },
            "black":  { "textures": { "bottom": "mineworld:blocks/marble_black", 
                "side": "mineworld:blocks/marble_black", 
                "top": "mineworld:blocks/marble_black"

            } },
            "red":  { "textures": { "bottom": "mineworld:blocks/marble_red", 
                "side": "mineworld:blocks/marble_red", 
                "top": "mineworld:blocks/marble_red"

            } },
            "brown":  { "textures": { "bottom": "mineworld:blocks/marble_brown", 
                "side": "mineworld:blocks/marble_brown", 
                "top": "mineworld:blocks/marble_brown"

            } },
            "pink":  { "textures": { "bottom": "mineworld:blocks/marble_pink", 
                "side": "mineworld:blocks/marble_pink", 
                "top": "mineworld:blocks/marble_pink"

            } },
            "yellow":  { "textures": { "bottom": "mineworld:blocks/marble_yellow", 
                "side": "mineworld:blocks/marble_yellow", 
                "top": "mineworld:blocks/marble_yellow"

            } },
            "green":  { "textures": { "bottom": "mineworld:blocks/marble_green", 
                "side": "mineworld:blocks/marble_green", 
                "top": "mineworld:blocks/marble_green"

            } }
        }
    }
}

 

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

Maybe there's an issue on how i register it? I use this method to register the slab

 

public static <E extends Enum<?>> void registerMetadataBlockModel(Block block, String variantName, Class<E> variants) {
		for(int i = 0; i < variants.getEnumConstants().length; i++) {
			ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), i, new ModelResourceLocation(block.getRegistryName(),  variantName + "=" + variants.getEnumConstants()[i].name()));
		}
	}

And from the model registry event i call it like this
 

BlockUtils.registerMetadataBlockModel(MARBLE_SLAB, "color", EnumMarble.class);
BlockUtils.registerMetadataBlockModel(MARBLE_DOUBLE_SLAB, "color", EnumMarble.class);

 

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

The json hasn't changed, but i post it again so there's everything in one place. This is the method i use to register a block with variants. It takes the block itself, the variant name and the enum class corresponding to the variant values

 

Spoiler

public static <E extends Enum<?>> void registerMetadataBlockModel(Block block, String variantName, Class<E> variants) {
        for(int i = 0; i < variants.getEnumConstants().length; i++) {
            ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), i, new ModelResourceLocation(block.getRegistryName(),  variantName + "=" + variants.getEnumConstants().name().toLowerCase()));
        }
    }

 

The enum i'm using to give the slab a variant is this

 

Spoiler

package com.mineworld.block.enums;

import com.mineworld.block.BlockMarble;

import net.minecraft.block.material.MapColor;
import net.minecraft.util.IStringSerializable;

public enum EnumOre implements IStringSerializable {
    RUBY(0, "ruby", MapColor.RED, 2, 0),
    SAPPHIRE(1, "sapphire", MapColor.BLUE, 2, 0),
    COPPER(2, "copper", MapColor.TNT, 1, 10),
    BRONZE(3, "bronze", MapColor.BROWN, 1, 5),
    SILVER(4, "silver", MapColor.LIGHT_BLUE, 1, 0),
    ALUMINIUM(5, "aluminium", MapColor.SILVER, 1, 0),
    PYRITE(6, "pyrite", MapColor.YELLOW, 0, 0);

    private static final EnumOre[] META_LOOKUP = new EnumOre[values().length];
    private final int meta;
    private final String name;
    private final MapColor mapColor;
    private final int harvestLevel;
    private final int powerLevel;
    
    private EnumOre(int metaIn, String nameIn, MapColor mapColorIn, int harvestLevel, int powerLevel)
    {
        this.meta = metaIn;
        this.name = nameIn;
        this.mapColor = mapColorIn;
        this.harvestLevel = harvestLevel;
        this.powerLevel = powerLevel;
    }
    
    static
    {
        for (EnumOre value : values())
        {
            META_LOOKUP[value.getMetadata()] = value;
        }
    }
    
    public static EnumOre byMetadata(int meta)
    {
        if (meta < 0 || meta >= META_LOOKUP.length)
        {
            meta = 0;
        }

        return META_LOOKUP[meta];
    }
    
    @Override
    public String getName() {
        return this.name;
    }

    public int getMetadata() {
        return this.meta;
    }

    public MapColor getMapColor() {
        return this.mapColor;
    }
    
    public int getHarvestLevel() {
        return this.harvestLevel;
    }
    
    public int getPowerLevel() {
        return this.powerLevel;
    }

    public String toString() {
        return this.name;
    }
}
 

 

and this is the slab base class 

 

Spoiler

package com.mineworld.block.slab;

import java.util.Arrays;
import java.util.Random;

import javax.annotation.Nullable;

import com.google.common.base.Predicate;
import com.mineworld.block.enums.EnumMarble;
import com.mineworld.core.MWBlocks;
import com.mineworld.core.MWTabs;
import com.mineworld.settings.ModSettings;

import net.minecraft.block.BlockSlab;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public abstract class BlockMarbleSlab extends BlockSlab
{
    public static final PropertyEnum<EnumMarble> COLOR = PropertyEnum.<EnumMarble>create("color", EnumMarble.class);

    public BlockMarbleSlab(String name)
    {
        super(Material.ROCK);
        setUnlocalizedName(ModSettings.MODID + "." + name);
        setRegistryName(name);
        setSoundType(SoundType.METAL);
        IBlockState iblockstate = this.blockState.getBaseState();

        if (!this.isDouble())
        {
            iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
        }

        this.setDefaultState(iblockstate.withProperty(COLOR, EnumMarble.WHITE));
        this.setCreativeTab(MWTabs.BUILDING_BLOCKS);
        this.setHardness(1.5F);
        this.setResistance(10.0F);
    }

    /**
     * Get the MapColor for this Block and the given BlockState
     */
    public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos)
    {
        return ((EnumMarble)state.getValue(COLOR)).getMapColor();
    }

    /**
     * Get the Item that this Block should drop when harvested.
     */
    public Item getItemDropped(IBlockState state, Random rand, int fortune)
    {
        return Item.getItemFromBlock(MWBlocks.MARBLE_SLAB);
    }

    public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
    {
        return new ItemStack(MWBlocks.MARBLE_SLAB, 1, ((EnumMarble)state.getValue(COLOR)).getMetadata());
    }

    /**
     * Returns the slab block name with the type associated with it
     */
    public String getUnlocalizedName(int meta)
    {
        return super.getUnlocalizedName() + "." + EnumMarble.byMetadata(meta).getName();
    }

    public IProperty<?> getVariantProperty()
    {
        return COLOR;
    }

    public Comparable<?> getTypeForItem(ItemStack stack)
    {
        return EnumMarble.byMetadata(stack.getMetadata() & 7);
    }

    /**
     * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
     */
    public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items)
    {
        for(EnumMarble ore : COLOR.getAllowedValues()) {
            items.add(new ItemStack(this, 1, ore.getMetadata()));
        }
    }

    /**
     * Convert the given metadata into a BlockState for this Block
     */
    public IBlockState getStateFromMeta(int meta)
    {
        IBlockState iblockstate = this.getDefaultState().withProperty(COLOR, EnumMarble.byMetadata(meta & 7));

        if (!this.isDouble())
        {
            iblockstate = iblockstate.withProperty(HALF, (meta & 8) == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP);
        }

        return iblockstate;
    }

    /**
     * Convert the BlockState into the correct metadata value
     */
    public int getMetaFromState(IBlockState state)
    {
        int i = 0;
        i = i | ((EnumMarble)state.getValue(COLOR)).getMetadata();

        if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP)
        {
            i |= 8;
        }

        return i;
    }

    protected BlockStateContainer createBlockState()
    {
        return this.isDouble() ? new BlockStateContainer(this, new IProperty[] {COLOR}) : new BlockStateContainer(this, new IProperty[] {HALF, COLOR});
    }

    /**
     * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It
     * returns the metadata of the dropped item based on the old metadata of the block.
     */
    public int damageDropped(IBlockState state)
    {
        return ((EnumMarble)state.getValue(COLOR)).getMetadata();
    }
}

 

In the register block event i register the half slab and the double slab block like this

 

Spoiler

event.getRegistry().registerAll(new BlockHalfMarbleSlab("marble_slab"),
                new BlockDoubleMarbleSlab("marble_double_slab"))

 

As well as the item block in the register item event

 

Spoiler

event.getRegistry().registerAll(new ItemSlab(MARBLE_SLAB, MARBLE_SLAB, MARBLE_DOUBLE_SLAB).setRegistryName(MARBLE_SLAB.getRegistryName()))

 

And finally i register the model using the ModelRegistryEvent like this

 

Spoiler

registerMetadataBlockModel(MARBLE_SLAB, "color", EnumMarble.class);
registerMetadataBlockModel(MARBLE_DOUBLE_SLAB, "color", EnumMarble.class);

 

The blockstates json file i use for the half slab is this

 

Spoiler

{
    "forge_marker": 1,
    "variants": {
        "normal": [{

        }],
        "inventory": [{

        }],
        "half": {
            "top": {
                "model": "upper_slab"
            },
            "bottom": {
                "model": "half_slab"
            }
        },
        "color": {
            "white":  { "textures": { "bottom": "mineworld:blocks/marble_white", 
                "side": "mineworld:blocks/marble_white", 
                "top": "mineworld:blocks/marble_white"

            } },
            "black":  { "textures": { "bottom": "mineworld:blocks/marble_black", 
                "side": "mineworld:blocks/marble_black", 
                "top": "mineworld:blocks/marble_black"

            } },
            "red":  { "textures": { "bottom": "mineworld:blocks/marble_red", 
                "side": "mineworld:blocks/marble_red", 
                "top": "mineworld:blocks/marble_red"

            } },
            "brown":  { "textures": { "bottom": "mineworld:blocks/marble_brown", 
                "side": "mineworld:blocks/marble_brown", 
                "top": "mineworld:blocks/marble_brown"

            } },
            "pink":  { "textures": { "bottom": "mineworld:blocks/marble_pink", 
                "side": "mineworld:blocks/marble_pink", 
                "top": "mineworld:blocks/marble_pink"

            } },
            "yellow":  { "textures": { "bottom": "mineworld:blocks/marble_yellow", 
                "side": "mineworld:blocks/marble_yellow", 
                "top": "mineworld:blocks/marble_yellow"

            } },
            "green":  { "textures": { "bottom": "mineworld:blocks/marble_green", 
                "side": "mineworld:blocks/marble_green", 
                "top": "mineworld:blocks/marble_green"

            } }
        }
    }
}

 

While for the double slab i use this json file

 

Spoiler

{
    "forge_marker": 1,
    "defaults": {
        "model": "cube_all"
    },
    "variants": {
        "normal": [{

        }],
        "inventory": [{

        }],
        "color": {
            "white":  { "textures": { "all": "mineworld:blocks/marble_white"
            } },
            "black":  { "textures": { "all": "mineworld:blocks/marble_black"
            } },
            "red":  { "textures": { "all": "mineworld:blocks/marble_red"
            } },
            "brown":  { "textures": { "all": "mineworld:blocks/marble_brown"
            } },
            "pink":  { "textures": { "all": "mineworld:blocks/marble_pink"
            } },
            "yellow":  { "textures": { "all": "mineworld:blocks/marble_yellow"
            } },
            "green":  { "textures": { "all": "mineworld:blocks/marble_green"
            } }
        }
    }
}

 

If i place the block on the ground it works fine, both for half slabs and double slabs, is just in inventory that i get no icon and model, just a plain black/purple texture

Edited by JimiIT92
Code lost from previous edit, fixed now

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

Update: so, after spending some time trying to figure out the arcane i did it. Reading the old messages i thought about the "variant=something" thing and i remembered that when you have multiple properties, the blockstate is something like "property1=value1,property2=value2". And so i tried using the "half=bottom,color=white" to register the white slab and it worked! I now have a proper icon displaying in the inventory :D Thanks everyone for your help :)

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.