Jump to content

[1.10.2] [Solved] Custom leaves causes server crash


Erfurt

Recommended Posts

Hey guys,

 

I have a problem with some custom leaves that causes a server crash shortly after being placed by a player. This is my first attempt at adding in custom trees, so most likely it's a mistake in my class. At the moment I'm not done making all the components for my custom trees, like saplings, gen and other stuff, so I'm not sure if the leaves will cause a crash when the game adds the trees, or if it's only a problem when a player places the leaves.

 

Here's the crash report

 

 

---- Minecraft Crash Report ----

// On the bright side, I bought you a teddy bear!

 

Time: 20-10-16 22:03

Description: Exception ticking world

 

java.lang.IllegalArgumentException: Cannot get property PropertyBool{name=check_decay, clazz=class java.lang.Boolean, values=[true, false]} as it does not exist in BlockStateContainer{block=em:leaves_poplar, properties=[]}

at net.minecraft.block.state.BlockStateContainer$StateImplementation.getValue(BlockStateContainer.java:196)

at net.minecraft.block.BlockLeaves.updateTick(BlockLeaves.java:71)

at net.minecraft.block.Block.randomTick(Block.java:581)

at net.minecraft.world.WorldServer.updateBlocks(WorldServer.java:490)

at net.minecraft.world.WorldServer.tick(WorldServer.java:227)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:772)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536)

at java.lang.Thread.run(Thread.java:745)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Thread: Server thread

Stacktrace:

at net.minecraft.block.state.BlockStateContainer$StateImplementation.getValue(BlockStateContainer.java:196)

at net.minecraft.block.BlockLeaves.updateTick(BlockLeaves.java:71)

at net.minecraft.block.Block.randomTick(Block.java:581)

at net.minecraft.world.WorldServer.updateBlocks(WorldServer.java:490)

at net.minecraft.world.WorldServer.tick(WorldServer.java:227)

 

-- Affected level --

Details:

Level name: Test flat

All players: 1 total; [EntityPlayerMP['Player326'/36, l='Test flat', x=-315,64, y=4,00, z=350,06]]

Chunk stats: ServerChunkCache: 625 Drop: 0

Level seed: 2931191489390516976

Level generator: ID 01 - flat, ver 0. Features enabled: false

Level generator options: 3;minecraft:bedrock,2*minecraft:dirt,minecraft:grass;1;village

Level spawn location: World: (-310,4,332), Chunk: (at 10,0,12 in -20,20; contains blocks -320,0,320 to -305,255,335), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)

Level time: 118431 game time, 1000 day time

Level dimension: 0

Level storage version: 0x04ABD - Anvil

Level weather: Rain time: 1 (now: false), thunder time: 1 (now: false)

Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true

Stacktrace:

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:772)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536)

at java.lang.Thread.run(Thread.java:745)

 

-- System Details --

Details:

Minecraft Version: 1.10.2

Operating System: Windows 10 (amd64) version 10.0

Java Version: 1.8.0_77, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 596290704 bytes (568 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP 9.32 Powered by Forge 12.18.1.2011 4 mods loaded, 4 mods active

States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

UCHIJAAAA mcp{9.19} [Minecraft Coder Pack] (minecraft.jar)

UCHIJAAAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.1.2011.jar)

UCHIJAAAA Forge{12.18.1.2011} [Minecraft Forge] (forgeSrc-1.10.2-12.18.1.2011.jar)

UCHIJAAAA em{1.0.b} [Eadore mod] (bin)

Loaded coremods (and transformers):

GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.

Profiler Position: N/A (disabled)

Player Count: 1 / 8; [EntityPlayerMP['Player326'/36, l='Test flat', x=-315,64, y=4,00, z=350,06]]

Type: Integrated Server (map_client.txt)

Is Modded: Definitely; Client brand changed to 'fml,forge'

 

 

 

I would think that you guys would like to see the leaves class aswell.

 

 

public class EadoreLeaves extends BlockLeaves
{

public EadoreLeaves(String name)
{
	this.setUnlocalizedName(name);
	this.setRegistryName(name);
}

@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
	return Blocks.LEAVES.getBlockLayer();
}

public boolean isOpaqueCube(IBlockState state)
{
	return Blocks.LEAVES.isOpaqueCube(state);
}

@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
{
	return Blocks.LEAVES.shouldSideBeRendered(state, world, pos, side);
}

@Override
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
{
	return Arrays.asList(new ItemStack(this, 1));
}

@Override
public EnumType getWoodType(int meta)
{
	return null;
}

}

 

 

Link to comment
Share on other sites

java.lang.IllegalArgumentException: Cannot get property PropertyBool{name=check_decay, clazz=class java.lang.Boolean, values=[true, false]} as it does not exist in BlockStateContainer{block=em:leaves_poplar, properties=[]}

Seems pretty obvious to me: you should add the leaf properties to your leaf block. Look at

BlockOldLeaf

or [/code]BlockNewLeaf[/code] for reference.

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

java.lang.IllegalArgumentException: Cannot get property PropertyBool{name=check_decay, clazz=class java.lang.Boolean, values=[true, false]} as it does not exist in BlockStateContainer{block=em:leaves_poplar, properties=[]}

Seems pretty obvious to me: you should add the leaf properties to your leaf block. Look at

BlockOldLeaf

or [/code]BlockNewLeaf[/code] for reference.

 

Well... What seems obvious to you, might not be to someone who have never done it before... However, I'm not sure what to add. As I can see, I need to add something like this

{
public static final PropertyEnum<BlockPlanks.EnumType> VARIANT = PropertyEnum.<BlockPlanks.EnumType>create("variant", BlockPlanks.EnumType.class, new Predicate<BlockPlanks.EnumType>()
    {
        public boolean apply(@Nullable BlockPlanks.EnumType p_apply_1_)
        {
            return p_apply_1_.getMetadata() >= 4;
        }
    });

    public BlockNewLeaf()
    {
        this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockPlanks.EnumType.ACACIA).withProperty(CHECK_DECAY, Boolean.valueOf(true)).withProperty(DECAYABLE, Boolean.valueOf(true)));
    }
public IBlockState getStateFromMeta(int meta)
    {
        return this.getDefaultState().withProperty(VARIANT, this.getWoodType(meta)).withProperty(DECAYABLE, Boolean.valueOf((meta & 4) == 0)).withProperty(CHECK_DECAY, Boolean.valueOf((meta &  > 0));
    }

    /**
     * Convert the BlockState into the correct metadata value
     */
    public int getMetaFromState(IBlockState state)
    {
        int i = 0;
        i = i | ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4;

        if (!((Boolean)state.getValue(DECAYABLE)).booleanValue())
        {
            i |= 4;
        }

        if (((Boolean)state.getValue(CHECK_DECAY)).booleanValue())
        {
            i |= 8;
        }

        return i;
    }
protected BlockStateContainer createBlockState()
    {
        return new BlockStateContainer(this, new IProperty[] {VARIANT, CHECK_DECAY, DECAYABLE});
    }
}

 

However, this is from

BlockNewLeaf

class, and I can see that it uses an EnumType from BlockPlanks. Can I do it without an EnumType? Or do I have to make my own? I'm not adding my custom leaves as subBlocks, does that make a difference?

 

I know I'm a noob right now, but as I mentioned in OP, this is my first try at adding leaves, and I'm still learning.

Link to comment
Share on other sites

you need to look at BlockOldLeaf and see how they do it then do the same.

 

Also when you register your model you need to ignore the decay and check decay properties otherwise it will tell you it can't find the properties.

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Link to comment
Share on other sites

you need to look at BlockOldLeaf and see how they do it then do the same.

 

Also when you register your model you need to ignore the decay and check decay properties otherwise it will tell you it can't find the properties.

 

If I ignore decay and check decay, doesn't that mean, that my custom leaves wouldn't behave as the vanilla leaves?

Link to comment
Share on other sites

they behave like normal leaves.

 

you need to ignore those properties because when you register the model the model loader thinks those are model states  but in fact they are used to control leaf decay so are meta properties in this case.

 

if you don't ignore them you need to create a blockstate that has both those properties as true and false is stupid. you need like 8 states for a leaf model that only needs 1 state.

 

ModelLoader.setCustomStateMapper(MyLeafBlock, new StateMap.Builder().ignore(new IProperty[] {MyLeafBlock.DECAYABLE}).ignore(new IProperty[] {MyLeafBlock.CHECK_DECAY}).build());

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Link to comment
Share on other sites

Have a look at my leaf block custom base leaves block I created that can be extended and worked into any custom leaf you need. 

 

I also solved the fancy transparent leaves issue . When you turn fancy on leaves become transparent.

 

However you may still need to figure out how I register the model, the block and how my mod is structured coz i  got my own thing going . So you STILL need to learn to do all that yourself . If you just copy paste you won't understand anything.

 

https://github.com/trollworkout/technorcery/blob/master/src/main/java/com/technorcery/common/blocks/LeafBlock.java

 

 

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Link to comment
Share on other sites

Have a look at my leaf block custom base leaves block I created that can be extended and worked into any custom leaf you need. 

 

I also solved the fancy transparent leaves issue . When you turn fancy on leaves become transparent.

 

However you may still need to figure out how I register the model, the block and how my mod is structured coz i  got my own thing going . So you STILL need to learn to do all that yourself . If you just copy paste you won't understand anything.

 

https://github.com/trollworkout/technorcery/blob/master/src/main/java/com/technorcery/common/blocks/LeafBlock.java

 

Believe it or not, I actually had this almost done the same way as you, at a previous time, where it didn't work, but I was missing the CustomStateMapper. And it seems to have done the trick, so I thank you very much for your help :)

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.