Jump to content

[1.10.2] Custom slabs not rendering


Erfurt

Recommended Posts

Hey guys,

I have a problem with my slabs not rendering, other than the rendering issue it seems like everything else is working. They seem to stack correctly, but it's a bit hard to tell as the half slab is rendering as a full block in the standard black and purple texture. Not sure if it's something in my classes, or if it's something in my .json naming(highly doubt this one) and I doubt that it's something in the .json files, as the are 'copied' from how the vanilla slabs .json files is. I have added most of my classes in the spoiler and the names of my .json files, maybe someone can see the error I have made. Cause I sure can't at the moment :P

 

 

 

public abstract class EadoreSlab extends BlockSlab
{
private static final PropertyBool VARIANT = PropertyBool.create("variant");

public EadoreSlab(Material mat, String name)
{
	super(mat);
	this.setUnlocalizedName(name);
	this.setRegistryName(name);
	this.useNeighborBrightness = !this.isDouble();

	if(mat == Material.WOOD)
	{
		Blocks.FIRE.setFireInfo(this, 5, 5);
	}

	if (!this.isDouble())
	{
            setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
        }

	IBlockState blockState = this.blockState.getBaseState();
        blockState = blockState.withProperty(VARIANT, false);
        if (!this.isDouble())
        {
            blockState.withProperty(HALF, EnumBlockHalf.BOTTOM);
        }
        
        setDefaultState(blockState);
}

@Override
public String getUnlocalizedName(int meta)
{
	return this.getUnlocalizedName();
}

@Override
public Comparable<?> getTypeForItem(ItemStack stack)
{
	return false;
}

@Override
public IProperty<?> getVariantProperty()
{
	return VARIANT;
}

@Override
public int damageDropped(IBlockState state)
{
	return 0;
}

@Override
public final IBlockState getStateFromMeta(final int meta) {
	IBlockState blockState = this.getDefaultState();
        blockState = blockState.withProperty(VARIANT, false);
        if (!this.isDouble()) {
            EnumBlockHalf value = EnumBlockHalf.BOTTOM;
            if ((meta &  != 0) {
                value = EnumBlockHalf.TOP;
            }

            blockState = blockState.withProperty(HALF, value);
        }

	return blockState;
}

@Override
public final int getMetaFromState(final IBlockState state) {
        if (this.isDouble()) {
           return 0;
        }

        if ((EnumBlockHalf) state.getValue(HALF) == EnumBlockHalf.TOP) {
            return 8;
        } else {
            return 0;
        }
}

@Override
protected final BlockStateContainer createBlockState() {
        if (this.isDouble()) {
            return new BlockStateContainer(this, new IProperty[] {VARIANT});
        } else {
            return new BlockStateContainer(
                this,
                new IProperty[] {VARIANT, HALF});
        }
}
}

 

Class for the double slab, half slab class the same, other than it return false in the isDouble boolean

public class EadoreDoubleSlab extends EadoreSlab
{

public EadoreDoubleSlab(Material mat, String name)
{
	super(mat, name);
}

@Override
public boolean isDouble() 
{
	return true;
}

}

 

Itemclass for my custom slabs

public class EadoreItemSlab extends ItemSlab
{

public EadoreItemSlab(Block block, EadoreHalfSlab singleSlab, EadoreDoubleSlab doubleSlab, Boolean stacked)
{
	super(block, singleSlab, doubleSlab);
}

}

 

This is how I register the slabs.

public class BlockRegistry
{
public static Block planks_maple;

public static Block slab_half_maple;
public static Block slab_double_maple;


public static void init()
{
	planks_maple = new EadorePlanks("planks_maple");

	slab_half_maple = new EadoreHalfSlab(Material.WOOD, "slab_half_maple");
	slab_double_maple = new EadoreDoubleSlab(Material.WOOD, "slab_double_maple");
}

public static void register()
{
	registerBlock(planks_maple);

	registerSlab(slab_half_maple, slab_half_maple, slab_double_maple, false);
	registerSlab(slab_double_maple, slab_half_maple, slab_double_maple, false);
}

public static void registerRenders()
{
	registerRender(planks_maple);

	registerRender(slab_half_maple);
	registerRender(slab_double_maple);
}

public static void registerBlock(Block block)
{
	GameRegistry.register(block);
	GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
}

public static void registerSlab(Block block, Block singleSlab, Block doubleSlab, Boolean stacked)
{
	GameRegistry.register(block);
	GameRegistry.register(new EadoreItemSlab(block, (EadoreHalfSlab)singleSlab, (EadoreDoubleSlab)doubleSlab, stacked).setRegistryName(block.getRegistryName()));
}

public static void registerRender(Block block)
{
	Item item = Item.getItemFromBlock(block);
	ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(block.getRegistryName(), "normal"));
}

Names of the .json files

 

 

blockstates

  • slab_double_maple
  • slab_half_maple

models/item

  • maple_slab

 

 

 

 

 

I should mention that I have many blocks in my mod that works, however I can't seem to get these slabs to work.

Link to comment
Share on other sites

Can you post the log where it tells you what the issue is?

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Can you post the log where it tells you what the issue is?

[16:53:21] [Client thread/ERROR] [FML]: Could not load vanilla model parent 'em:block/slab_half_maple' for 'net.minecraft.client.renderer.block.model.ModelBlock@6e767943

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model em:block/slab_half_maple with loader VanillaLoader.INSTANCE, skipping

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]

at net.minecraftforge.client.model.ModelLoaderRegistry.getModelOrLogError(ModelLoaderRegistry.java:203) [ModelLoaderRegistry.class:?]

at net.minecraftforge.client.model.ModelLoader$VanillaModelWrapper.getTextures(ModelLoader.java:478) [ModelLoader$VanillaModelWrapper.class:?]

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:163) [ModelLoaderRegistry.class:?]

at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:317) [ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:170) [ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:147) [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:122) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:540) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_77]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_77]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_77]

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_77]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_77]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_77]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_77]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: java.io.FileNotFoundException: em:models/block/slab_half_maple.json

at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:68) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:311) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.access$1100(ModelLoader.java:118) ~[ModelLoader.class:?]

at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:868) ~[ModelLoader$VanillaLoader.class:?]

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]

... 23 more

Link to comment
Share on other sites

[16:53:21] [Client thread/ERROR] [FML]: Could not load vanilla model parent 'em:block/slab_half_maple' for 'net.minecraft.client.renderer.block.model.ModelBlock@6e767943

There's an error in your JSON file, show it.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

[16:53:21] [Client thread/ERROR] [FML]: Could not load vanilla model parent 'em:block/slab_half_maple' for 'net.minecraft.client.renderer.block.model.ModelBlock@6e767943

There's an error in your JSON file, show it.

 

I don't understand how there can be an error in that, but I digress. Here's the file.

{
    "parent": "block/half_slab",
    "textures": {
        "bottom": "em:blocks/planks_maple",
        "top": "em:blocks/planks_maple",
        "side": "em:blocks/planks_maple"
    }
}

 

I should mention that em:blocks/planks_maple is the exact same I use for a block and it's texture works fine, just so we can rule that out :)

Link to comment
Share on other sites

Could still use a little help here :)

Is block/half_slab a block json?

 

Yes it is, the vanilla slabs use it as well

Is the json in modid:block/json

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Could still use a little help here :)

Is block/half_slab a block json?

 

Yes it is, the vanilla slabs use it as well

Is the json in modid:block/json

 

Should it have to be in my mods assets folder, if I reference it from it's vanilla location, because that makes no sense to me, as I have done this with other models that worked fine

Link to comment
Share on other sites

Could still use a little help here :)

Is block/half_slab a block json?

 

Yes it is, the vanilla slabs use it as well

Is the json in modid:block/json

 

Should it have to be in my mods assets folder, if I reference it from it's vanilla location, because that makes no sense to me, as I have done this with other models that worked fine

I meant yours not the vanilla i should have specified.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Could still use a little help here :)

Is block/half_slab a block json?

 

Yes it is, the vanilla slabs use it as well

Is the json in modid:block/json

 

Should it have to be in my mods assets folder, if I reference it from it's vanilla location, because that makes no sense to me, as I have done this with other models that worked fine

I meant yours not the vanilla i should have specified.

 

Well I haven't made a copy of it into my own folder, if that's what you mean. Should I try that?

Link to comment
Share on other sites

Your json not the parent. em:block/slab_half_maple.json

 

I just noticed some of the naming was a bit wrong, but after fixing that, the model still isn't rendering correctly. Still checking all of the naming right now. But I do believe I've gotten all of them

Link to comment
Share on other sites

Your json not the parent. em:block/slab_half_maple.json

Could it be the way I register the render that's the problem?

How do you register the renderer ModelLoader.serCustomModelResourceLocation(...) in preInit?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Your json not the parent. em:block/slab_half_maple.json

Could it be the way I register the render that's the problem?

How do you register the renderer ModelLoader.serCustomModelResourceLocation(...) in preInit?

I use this method to register my renders and yes it's in preInit :)

public static void registerRender(Block block)
{
	Item item = Item.getItemFromBlock(block);
	ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(block.getRegistryName(), "normal"));
}

 

What I find somewhat wierd is that the item is rendering fine in hand, but not when I place it, so I would think that I'm doing something wrong, I just can't figure out what it is  :-\

Link to comment
Share on other sites

Sooo...question.

Why are you using Item.getItemFromBlock when you're the one who had to create the item in the first place?

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

Show us your blockstate file. You only provided a model file for your block.

 

If you use the non-forge json method you need:

-a blockstate .json file

-a block model .json file

-a item model .json file

 

If you use the forge version (wich i recommend) you only need the blockstate file and you do everything inside that.

 

But first show us your blockstate file

Link to comment
Share on other sites

Show us your blockstate file. You only provided a model file for your block.

 

If you use the non-forge json method you need:

-a blockstate .json file

-a block model .json file

-a item model .json file

 

If you use the forge version (wich i recommend) you only need the blockstate file and you do everything inside that.

 

But first show us your blockstate file

 

slab_half_maple.json

{
    "variants": {
        "half=bottom": { "model": "em:slab_half_maple" },
        "half=top": { "model": "em:slab_upper_maple" }
    }
}

slab_double_maple.json

{
    "variants": {
        "normal": { "model": "em:planks_maple" }
    }
}

 

I'm using the traditional way, mostly to test if everything works, and after that's all good, I mostly try and convert it over to the forge version. Before, in this case, making more slabs.

Link to comment
Share on other sites

i see you have this error:

 

Caused by: java.io.FileNotFoundException: em:models/block/slab_half_maple.json

 

This means you do not have that file or it isn't in the right place!

 

Yeah, at the time I had some files named wrong, however that is corrected. Yet it still doesn't work.

 

Here's the newest log.

 

 

[Client thread/ERROR] [FML]: Exception loading model for variant em:slab_half_maple#half=top,variant=false for blockstate "em:slab_half_maple[half=top,variant=false]"

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model em:slab_half_maple#half=top,variant=false with loader VariantLoader.INSTANCE, skipping

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]

at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:241) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:145) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:229) ~[ModelLoader.class:?]

at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:146) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:132) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:113) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:799) [Minecraft.class:?]

at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:338) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:561) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_77]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_77]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_77]

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_77]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_77]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_77]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_77]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException

at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?]

at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1183) ~[ModelLoader$VariantLoader.class:?]

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]

... 24 more

 

 

 

I hope this is alright. But here's a picture of the problem, in the picture is only a single slab placed. I can walk over it as a normal slab and everything seems to be fine, except the texture. This is just to illustrate my problem, if someone was a bit unaware :)

http://imgur.com/a/LISWv

Link to comment
Share on other sites

Your blockstate file is missing a variant, "half=top,variant=false"

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

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.



×
×
  • Create New...

Important Information

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