Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I am trying to add a custom tree trunk decorator to my custom tree which would put blocks around the trunk of the tree like cocoa beans. 

Edited by the_lizard_king

  • Author

I copied the cocoa placer but I'm not sure what to return here

protected TreeDecoratorType<?> type() {
	      return null;
	   }

I tried just TreeDecoratorType.COCOA but that didn't work

it's the TreeDecoratorType minecraft use it for Registry look how minecraft register/create them and copy the logic for your TrunkPlacer

Edited by Luis_ST

  • Author

I copied the TreeDecoratorType now it just crashes when I try to create a world with the message

"Can not register to a locked registry. Modder should use Forge Register methods."

here's my tree decorator type code

public class ModTreeDecoratorType<P extends TreeDecorator> extends ForgeRegistryEntry<ModTreeDecoratorType<?>> {
	public static final TreeDecoratorType<MushroomTrunkDecorator> TRUNK_MUSHROOM = register("trunk_mushroom", MushroomTrunkDecorator.CODEC);
	private final Codec<P> codec;

	   @SuppressWarnings("deprecation")
	private static <P extends TreeDecorator> TreeDecoratorType<P> register(String p_70053_, Codec<P> p_70054_) {
	      return Registry.register(Registry.TREE_DECORATOR_TYPES, p_70053_, new TreeDecoratorType<>(p_70054_));
	   }

	   public ModTreeDecoratorType(Codec<P> p_70050_) {
	      this.codec = p_70050_;
	   }

	   public Codec<P> codec() {
	      return this.codec;
	   }
}

 

ups sorry, i forgot that TreeDecoratorType use now the Forge Registry system you could simply extends TreeDecoratorType and register it like Block or Items via DeferredRegister or the RegistryEvents

Edited by Luis_ST

  • Author
13 hours ago, Luis_ST said:

ups sorry, i forgot that TreeDecoratorType use now the Forge Registry system you could simply extends TreeDecoratorType and register it like Block or Items via DeferredRegister or the RegistryEvents

thanks so much, that worked

  • the_lizard_king changed the title to [SOLVED][1.17.1]how do i make a custom tree decorator

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.