Jump to content

Recommended Posts

Posted (edited)

Hello. I'm trying to make a custom tree. For now I maded the log(that extends BlockLog) and the leaves(extends BlockLeaves).

When I place the actual block game crashes saying it has not log axis ecc... 

Same for leaves.

How can I setup these things? I have seen a tutorial how to do it with metadata but i want a single item.

Thanks for the help.

Edited by nov4e
Posted

Post your code and the crash. You probably want to extend the base log and leaves classes rather than the vanilla ones that have the variants hardcoded

About Me

  Reveal hidden contents

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

Well, I fixed this error. I just setted the blockstates with enum axis ec...

But I have another issue. First of all, these are the classes:

 

GenerateMysticTree, the tree WorldGenAbstractTree class.

  Reveal hidden contents

MysticSaplingWood, The sapling class:

  Reveal hidden contents

 

The issue is that when the sapling grows it doesnt grows but theres a crash:

  Quote
[15:12:02] [Server thread/FATAL] [minecraft/MinecraftServer]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class com.minecraft.exa.trees.GenerateMysticTree
	at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_191]
	at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_191]
	at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798) [MinecraftServer.class:?]
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) [MinecraftServer.class:?]
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_191]
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.minecraft.exa.trees.GenerateMysticTree
	at com.minecraft.exa.block.MysticSaplingWood.generateTree(MysticSaplingWood.java:100) ~[MysticSaplingWood.class:?]
	at com.minecraft.exa.block.MysticSaplingWood.grow(MysticSaplingWood.java:144) ~[MysticSaplingWood.class:?]
	at net.minecraft.item.ItemDye.applyBonemeal(ItemDye.java:131) ~[ItemDye.class:?]
	at net.minecraft.item.ItemDye.onItemUse(ItemDye.java:62) ~[ItemDye.class:?]
	at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:876) ~[ForgeHooks.class:?]
	at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:200) ~[ItemStack.class:?]
	at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:518) ~[PlayerInteractionManager.class:?]
	at net.minecraft.network.NetHandlerPlayServer.processTryUseItemOnBlock(NetHandlerPlayServer.java:769) ~[NetHandlerPlayServer.class:?]
	at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:68) ~[CPacketPlayerTryUseItemOnBlock.class:?]
	at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:13) ~[CPacketPlayerTryUseItemOnBlock.class:?]
	at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_191]
	at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_191]
	at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
	... 5 more

 

Expand  

Thanks for all the help given. 

Posted
  On 4/18/2019 at 11:11 PM, diesieben07 said:

The crash you reported does not happen with that repository. Instead I get a NullPointerException, because you never assign a value to ModBlocks.MYSTIC_LOG, but try to use it.

Expand  

In ModBlocks I assigned MYSTIC_LOG to new MysticLogWood() (line 31)

Posted

1. Update your repo.

2. "exa" is not a good mod id; 3 characters long name can cause conflicts.

3. This method is unnecessary; just do something like:

modBlocks.add(STATIC_BLOCK_HOLDER = new MyBlockThingy("blah"));

4. These loggings at info level are pointless; the player doesn't care what state mods are at, and logging random stuff at info level can clog up the log easily.

  • Like 1

Some tips:

  Reveal hidden contents

 

Posted
  On 4/19/2019 at 8:50 AM, DavidM said:

modBlocks.add(STATIC_BLOCK_HOLDER = new MyBlockThingy("blah"));

Expand  

@ObjectHolder instead pls

About Me

  Reveal hidden contents

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
  On 4/19/2019 at 8:50 AM, DavidM said:

1. Update your repo.

Expand  

Its updated

 

  On 4/19/2019 at 8:50 AM, DavidM said:

2. "exa" is not a good mod id; 3 characters long name can cause conflicts.

Expand  

Just why. There are no mods called exa

  On 4/19/2019 at 8:50 AM, DavidM said:

This method is unnecessary; just do something like:

modBlocks.add(STATIC_BLOCK_HOLDER = new MyBlockThingy("blah"));
Expand  

Why do I have to do that? Its just the same thing.

  On 4/19/2019 at 8:50 AM, DavidM said:

4. These loggings at info level are pointless; the player doesn't care what state mods are at, and logging random stuff at info level can clog up the log easily.

Expand  

I will remove them, its just for help me while developing.

Posted
  On 4/19/2019 at 9:30 AM, nov4e said:

Just why. There are no mods called exa

Expand  

3 letters is still a bit too short to be unique. I also have no idea what “exa” means - you should be able to look at the modid and get a rough understanding of what the mod does & the modid and mod name should be really similar.

  On 4/19/2019 at 9:30 AM, nov4e said:

Why do I have to do that? Its just the same thing.

Expand  

Do you know what @ObjectHolder is? Do you know what static initialisers are? Do you know why static initialisers are bad for Modding? Well, here’s a paragraph explaining all of them.

 

Bad and improper registration code is the leading cause of bad and/or broken mods. These bad/broken mods can also break other mods that are doing everything right *and* improper registration stops Forge from being able to implement useful new features. These features that could be implemented by Forge include dynamically reloading the registries (adding/removing items while the game is running) and even adding/removing entire mods without restarting the game. Forge has wanted to enable these features for more than 4 years now, but mods that do their registration in the wrong way has been stopping this from happening.

For Forge to be able to do this (and for registry replacements to work properly) Mods need to instantiate and register their objects in the correct registry event. They also need to use references to their objects that can change as mods are loaded & unloaded (and registry replacements are activated/deactivated). Mods can do this by using the @ObjectHolder annotation (which automatically fills fields with the appropriate values after each registry event fires) or manually by setting their fields after all other registration has been done (by subscribing to the registry event and running after everything else). Mods that create and/or register their objects with static initialisers stop Forge from being able to do cool stuff AND they can break unexpectedly and uncontrollably if/when their registration classes are loaded before the expected time (you have no control over when your classes are loaded). Static initialisers are initialising objects inside a “static {}” block or doing “static Object object = new Object();” in a class.

About Me

  Reveal hidden contents

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
  On 4/19/2019 at 9:30 AM, nov4e said:

Just why. There are no mods called exa

Expand  

This is not original but:

TiC is the name of a mod; its mod ID is tconstruct.

IC2 is the name of a mod; its mod ID is industrialcraft2.

 

  On 4/19/2019 at 9:30 AM, nov4e said:

Why do I have to do that? Its just the same thing.

Expand  

Creating an extra method just to assign a reference to a variable is unwise (considering memory usage, code readability and design pattern), especially when the Java language's syntax allows you to do it inline.

 

  On 4/19/2019 at 10:24 AM, nov4e said:

But how can I fix the problem related to the tree gen?

Expand  

Please update your crash log; the old one no longer applies to your updated repo (line numbers have changed).

Some tips:

  Reveal hidden contents

 

Posted
  On 4/19/2019 at 10:36 AM, DavidM said:

Please update your crash log; the old one no longer applies to your updated repo (line numbers have changed).

Expand  

Everything is fixed now. Setting the @ObjectHolder now for some reason works

Posted (edited)

1. I'm pretty sure the string given to @ObjectHolder should include the mod id of your mod to avoid conflict.

2. Personally, I would avoid storing references to the same block in both a static field and a list; only one of them is needed (preferably the static field with @ObjectHolder).

3.

  Quote

withProperty(STAGE, Integer.valueOf(0)))

Expand  
  Quote

withProperty(DECAYABLE, Boolean.valueOf(true)))

Expand  

Wut? I’m pretty sure you can just use literals here.

Edited by DavidM

Some tips:

  Reveal hidden contents

 

Posted
  On 4/19/2019 at 1:21 PM, DavidM said:

Wut? I’m pretty sure you can just use literals here.

Expand  

You can, but vanilla uses boxed values because it was written before autoboxing was a thing. 

  • Like 1

About Me

  Reveal hidden contents

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
  On 4/20/2019 at 9:07 AM, diesieben07 said:

Vanilla does not used boxed values. But vanilla code is decompiled, so autoboxing (which is done by the Java compiler) cannot be distinguished from manual boxing.

Expand  

TIL. I thought autoboxing was done by the JVM for some reason. It makes a lot more sense that it’s the compiler though.

About Me

  Reveal hidden contents

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.