Jump to content

Recommended Posts

Posted

Yes, you need to extend

BlockSlab

for slabs. Vanilla has several examples of this.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Ok i think i'm almost there.

How do i register it now? Since registerBlock is deprecated.

 

I did it like this in 1.7.10:

 

  Reveal hidden contents

 

 

But how it's done in 1.10+?

 

 

Posted

Alright and how would the json file look like?

 

i tried this for halfslab

 

  Reveal hidden contents

 

and this for doubleslab:

 

  Reveal hidden contents

 

 

Posted

I could really need some help. I have really no clue how to create slabs in 1.10+

This is as far i could get:

 

BlockCustomSlab:

 

  Reveal hidden contents

 

 

BlockCustomHalfSlab:

 

  Reveal hidden contents

 

 

BlockCustomDoubleSlab:

 

  Reveal hidden contents

 

 

and here my ModBlocks class:

 

  Reveal hidden contents

 

I also want to know how to get the forge style .json file right.

As for now this is what it does now:

 

-The slab in the inventory has no texture

-When placed down the slab has the right texture.

-The slabs do not stack on eachother.

-I have some errors about the model

 

[Client thread/ERROR] [FML]: Exception loading model for variant tem:BlockChalkstoneHalfSlab#half=top,variant=true for blockstate "tem:BlockChalkstoneHalfSlab[half=top,variant=true]"

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model tem:BlockChalkstoneHalfSlab#half=top,variant=true with loader VariantLoader.INSTANCE, skipping

 

 

log:

 

  Reveal hidden contents

 

Posted

You need to use

ItemSlab

instead of

ItemBlock

for the

Item

form of your

Block

. You should only register an

Item

for your half slab

Block

, not for the double slab.

 

  Quote

[00:15:15] [Client thread/ERROR] [FML]: Exception loading model for variant tem:BlockChalkstoneHalfSlab#inventory for item "tem:BlockChalkstoneHalfSlab", normal location exception:

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model tem:item/BlockChalkstoneHalfSlab with loader VanillaLoader.INSTANCE, skipping

...

Caused by: java.io.FileNotFoundException: tem:models/item/BlockChalkstoneHalfSlab.json

 

...

 

[00:15:15] [Client thread/ERROR] [FML]: Exception loading model for variant tem:BlockChalkstoneHalfSlab#inventory for item "tem:BlockChalkstoneHalfSlab", blockstate location exception:

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model tem:BlockChalkstoneHalfSlab#inventory with loader VariantLoader.INSTANCE, skipping

...

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

The model you registered for your

Item

doesn't exist as an item model or blockstates variant.

 

  Quote
[00:15:15] [Client thread/ERROR] [FML]: Exception loading model for variant tem:BlockChalkstoneHalfSlab#half=top,variant=true for blockstate "tem:BlockChalkstoneHalfSlab[half=top,variant=true]"

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model tem:BlockChalkstoneHalfSlab#half=top,variant=true with loader VariantLoader.INSTANCE, skipping

...

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

 

...

 

[00:15:15] [Client thread/ERROR] [FML]: Exception loading model for variant tem:BlockChalkstoneHalfSlab#half=bottom,variant=true for blockstate "tem:BlockChalkstoneHalfSlab[half=bottom,variant=true]"

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model tem:BlockChalkstoneHalfSlab#half=bottom,variant=true with loader VariantLoader.INSTANCE, skipping

...

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

You didn't specify the

half=top,variant=true

and

half=bottom,variant=true

variants in your blockstates file.

 

The whole point of Forge's blockstates format is that you can specify the effect of each property value individually rather than specifying every possible combination of property values.

 

You can see the blockstates files for my mod's slabs here: double, half.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

What do you mean with 'you didn't specify'?

Isn't it what i do then?

 

I tried this now:

{
    "forge_marker": 1,
    "defaults": {
        "textures": {
            "top": "tem:blocks/chalkstone",
            "bottom": "tem:blocks/chalkstone",
            "side": "tem:blocks/chalkstone"
        }
    },
    "variants": {
        "half": {
            "bottom": {
                "model": "minecraft:half_slab"
            },
            "top": {
                "model": "minecraft:upper_slab"
            }
        "variant": {
            "true": {
                "textures": {
                    "all": "tem:blocks/chalkstone"
                }
            },
            "false": {
                "textures": {
                    "all": "tem:blocks/chalkstone"
                }
            }
        }
        
    }
}

But it still gives me the same errors.

Posted
  On 10/10/2016 at 3:07 PM, winnetrie said:

What do you mean with 'you didn't specify'?

Your blockstates file didn't include those variants.

 

 

  Quote

I tried this now:

{
    "forge_marker": 1,
    "defaults": {
        "textures": {
            "top": "tem:blocks/chalkstone",
            "bottom": "tem:blocks/chalkstone",
            "side": "tem:blocks/chalkstone"
        }
    },
    "variants": {
        "half": {
            "bottom": {
                "model": "minecraft:half_slab"
            },
            "top": {
                "model": "minecraft:upper_slab"
            }
        "variant": {
            "true": {
                "textures": {
                    "all": "tem:blocks/chalkstone"
                }
            },
            "false": {
                "textures": {
                    "all": "tem:blocks/chalkstone"
                }
            }
        }
        
    }
}

But it still gives me the same errors.

That should work for the block models, though there's no point in setting a texture (

all

) if it's never used by the model.

minecraft:half_slab

and

minecraft:upper_slab

only use the

top

,

bottom

and

side

textures. The blockstates file I linked sets the

all

texture because it also sets

top

,

bottom

and

side

to use the

all

texture in the

defaults

section.

 

Which models aren't working? Post the new FML log (from logs/fml-client-latest.log).

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

They do stack on eachother now, so the slabs are working.

They have no texture right now. none of them.

 

 

  Reveal hidden contents

 

Posted
  Quote
[18:30:08] [Client thread/ERROR] [FML]: Exception loading blockstate for the variant tem:BlockChalkstoneHalfSlab#half=top,variant=true:

java.lang.Exception: Could not load model definition for variant tem:BlockChalkstoneHalfSlab

...

Caused by: java.lang.RuntimeException: Encountered an exception when loading model definition of 'tem:BlockChalkstoneHalfSlab' from: 'tem:blockstates/BlockChalkstoneHalfSlab.json' in resourcepack: 'FMLFileResourcePack:Tim's Expansion Mod'

...

Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 18 column 10

 

Your blockstates file has a syntax error. If your IDE doesn't show you JSON syntax errors, you can use JSONLint to find them.

 

The log you posted shows errors for the double slab's item models, but not the half slab's. This tells me that you either removed the

Item

registration for the wrong

Block

or you didn't remove either

Item

and didn't post all of the errors. It's still the same error as before: the item model you specified doesn't exist.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

I'm getting closer now. the .json files starts to make sense now.

I'm still not done.

The slabs can be placed down and can be stacked and have a the right texture.

Yet if i give myself the doubleslab with the command, it has no texture and when placed down crashes the game:

 

crash when placing double slab:

 

  Reveal hidden contents

 

 

What i also see now is this:

 

[23:10:25] [Client thread/WARN]: Unable to resolve texture due to upward reference: #all in minecraft:models/block/cube_all

[23:10:25] [Client thread/WARN]: Unable to resolve texture due to upward reference: #all in minecraft:models/block/cube_all

[23:10:25] [Client thread/WARN]: Unable to resolve texture due to upward reference: #all in minecraft:models/block/cube_all

[23:10:25] [Client thread/WARN]: Unable to resolve texture due to upward reference: #all in minecraft:models/block/cube_all

[23:10:25] [Client thread/WARN]: Unable to resolve texture due to upward reference: #all in minecraft:models/block/cube_all

[23:10:25] [Client thread/WARN]: Unable to resolve texture due to upward reference: #all in minecraft:models/block/cube_all

[23:10:25] [Client thread/WARN]: Unable to resolve texture due to upward reference: #all in minecraft:models/block/cube_all

Why is that?

 

Here a picture:

 

  Reveal hidden contents

 

 

Edit:

I removed the itemblock for chalkstonedoubleslab from the registry and also the

render register for chalkstonedoubleslab.

 

This removes completely an item for it from the game. I'm not sure this is the right way?

On the other side, no 1 is going to miss it, because noone is using doubleslabs or am i wrong?

Posted

Unable to resolve texture reference is that there is an unspecified texture in the model/blockstate.

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.

Posted

You're not meant to have an

Item

form of the double slab

Block

, only the single slab needs one.

BlockSlab#onBlockPlaced

depends on the

Block

having the

BlockSlab.HALF

property, which double slabs don't have.

 

Post the latest blockstates file for your double slab.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
  On 10/11/2016 at 6:17 AM, Choonster said:

You're not meant to have an

Item

form of the double slab

Block

, only the single slab needs one.

BlockSlab#onBlockPlaced

depends on the

Block

having the

BlockSlab.HALF

property, which double slabs don't have.

 

Post the latest blockstates file for your double slab.

 

Oh ok, i know that in the past mods had them in the game and i'm pretty sure minecraft did too.

I don't know why anyone would add this to the game and like you said it's not meant to be there.

So that means i'm pretty done with slabs i think?

here are my latest files:

 

halfslab file:

 

  Reveal hidden contents

 

 

double slab file:

 

 

  Reveal hidden contents

 

Thank you for linking that jsonlint page, very usefull!

 

1 more question.

I now used this:

"inventory": {
            "model": "minecraft:half_slab"
        }

to get the item form for it.

I had this error in the log about"inventory", so i added it to fix this.

I think there has to be a better way, not sure how to link to the half=bottom variants.

 

I know this has to do with this:

ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(),"inventory"));

Because i have set it to "inventory", but can i reference it to half bottom also? If so , how?

 

Then i have another question also.

A block can hold 16 metadata. A slab uses already 2 to determine if it's bottom or top.

So that means i can use the same slab to hold 8 different types.

Is it better to make use of this or can i just make a new block for each different slab?

Does this affect anything? Like more memory usage or something?

 

Posted
  On 10/11/2016 at 7:11 PM, winnetrie said:

1 more question.

I now used this:

"inventory": {
            "model": "minecraft:half_slab"
        }

to get the item form for it.

I had this error in the log about"inventory", so i added it to fix this.

I think there has to be a better way, not sure how to link to the half=bottom variants.

 

I know this has to do with this:

ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(),"inventory"));

Because i have set it to "inventory", but can i reference it to half bottom also? If so , how?

 

The second argument of the

ModelResourceLocation

is the variant, this corresponds to a variant in your blockstates file. Use

"half=bottom,variant=true"

as the variant to use that variant of the blockstates file as the model.

 

  Quote

Then i have another question also.

A block can hold 16 metadata. A slab uses already 2 to determine if it's bottom or top.

So that means i can use the same slab to hold 8 different types.

Is it better to make use of this or can i just make a new block for each different slab?

Does this affect anything? Like more memory usage or something?

 

It's best to group related blocks into variants of a single

Block

instance where possible to reduce the number of block IDs you use. The block ID limit is rather high (4095), so it won't affect everyone using your mod; but there have been large modpacks in the past that reached the limit.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
  On 10/11/2016 at 7:32 PM, Choonster said:

The second argument of the

ModelResourceLocation

is the variant, this corresponds to a variant in your blockstates file. Use

"half=bottom,variant=true"

as the variant to use that variant of the blockstates file as the model.

 

Aha! Didn't knew it can be done like this. That's opens alot of possebilities! Thank you!

 

  Quote

It's best to group related blocks into variants of a single

Block

instance where possible to reduce the number of block IDs you use. The block ID limit is rather high (4095), so it won't affect everyone using your mod; but there have been large modpacks in the past that reached the limit.

Alright i'll try to use this.

Posted

So i was trying to make slabs with different textures using the metadata.

I succeeded to do so, but now they don't stack anymore.

 

 

  Reveal hidden contents

 

Posted

You need to properly implement

BlockSlab#getTypeForItem

by returning the

EnumType

for the

ItemStack

's metadata. You also need to properly implement

Block#damageDropped

by returning the item metadata to drop (this should be the metadata value of the

EnumType

).

 

Your

Block#getStateFromMeta

and

Block#getMetaFromState

implementations are incorrect. You need to use bitwise operations to combine and extract the properties from the metadata. I suggest you look at

BlockStoneSlabNew

for an example of this.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

I have looked into  the minecraft class and i changed mine to this:

 

  Reveal hidden contents

 

 

This now throws an error when the slab is placed:

[10:46:10] [Client thread/FATAL]: Unreported exception thrown!
java.lang.IllegalArgumentException: Cannot set property PropertyEnum{name=type, clazz=class winnetrie.tem.blocks.BlockChalkstoneBlockSlab$EnumType, values=[raw, smooth, bricked]} to null on block tem:chalkstonehalfslab, it is not an allowed value
at net.minecraft.block.state.BlockStateContainer$StateImplementation.withProperty(BlockStateContainer.java:222) ~[blockStateContainer$StateImplementation.class:?]
at winnetrie.tem.blocks.BlockChalkstoneBlockSlab.getStateFromMeta(BlockChalkstoneBlockSlab.java:73) ~[blockChalkstoneBlockSlab.class:?]
at net.minecraft.block.Block.onBlockPlaced(Block.java:807) ~[block.class:?]
at net.minecraft.block.BlockSlab.onBlockPlaced(BlockSlab.java:75) ~[blockSlab.class:?]
at net.minecraft.item.ItemBlock.onItemUse(ItemBlock.java:58) ~[itemBlock.class:?]
at net.minecraft.item.ItemSlab.onItemUse(ItemSlab.java:83) ~[itemSlab.class:?]
at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:159) ~[itemStack.class:?]
at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:486) ~[PlayerControllerMP.class:?]
at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1603) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2281) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2058) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1846) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1118) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:406) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_73]
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_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_73]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
at GradleStart.main(GradleStart.java:26) [start/:?]

 

 

Posted

private static final BlockChalkstoneBlockSlab.EnumType[] META_LOOKUP = new BlockChalkstoneBlockSlab.EnumType[values().length];

 

Am i wrong saying that this array is full of nulls?

Try doing this in byMetadata(int meta) in the Enum Class:

 

public static BlockChalkstoneBlockSlab.EnumType byMetadata(int meta)
{
if (meta < 0 || meta >= META_LOOKUP.length)
            {
                meta = 0;
            }

            return values()[meta];
        }

Posted

Oh yes, right....

 

I did:

public static BlockChalkstoneBlockSlab.EnumType byMetadata(int meta)
        {
            if (meta < 0 || meta >= META_LOOKUP.length)
            {
                meta = 0;
            }

            return META_LOOKUP[meta];
        }
    static
        {
            for (BlockChalkstoneBlockSlab.EnumType types : values())
            {
                META_LOOKUP[types.getID()] = types;
            }
        }

It's working now properly. Thank you!

 

EDIT:

i also added this now:

@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
    {
        return Item.getItemFromBlock(ModBlocks.brickedclayslab1);
    }
@Override
public int quantityDropped(Random random)
    {
        return this.isDouble() ? 2 : 1;
    }

@Override
public int damageDropped (IBlockState state){
	return ((BlockBrickedClayBlockSlab1.EnumType) state.getValue(TYPE)).getID();

}

I didn't added it before because it wasn't important at that point.

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.