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

Hello, I was trying to make a flower block, everything went fine until I excuted the program and tested it out. Once in game, both the flower block and the potted flower block was the expected cross model but with a black background instead of transparent background. Anyone have a solution to this? I was using Forge 1.18.2.

The texture for the flower also have a transparent background in the image editor.

The code for the flower:

public static final RegistryObject<Block> FROZEN_ROSE = registerBlock("frozen_rose", () -> new
            FlowerBlock(MobEffects.MOVEMENT_SLOWDOWN, 5, BlockBehaviour.Properties.copy(Blocks.DANDELION).noOcclusion()),
            CreativeModeTab.TAB_DECORATIONS);

Code for potted flower:

public static final RegistryObject<Block> POTTED_FROZEN_ROSE = registerBlockWithoutBlockItem("potted_frozen_rose", () -> new
                    FlowerPotBlock(() -> ((FlowerPotBlock) Blocks.FLOWER_POT), ModBlocks.FROZEN_ROSE,
            BlockBehaviour.Properties.copy(Blocks.POTTED_DANDELION).noOcclusion()));

Code for the RenderType under FMLClientSetupEvent:

private void clientSetup(final FMLClientSetupEvent event) {
        ItemBlockRenderTypes.setRenderLayer(ModBlocks.FROZEN_ROSE.get(), RenderType.cutout());
        ItemBlockRenderTypes.setRenderLayer(ModBlocks.POTTED_FROZEN_ROSE.get(), RenderType.cutout());
    }

I've also checked the JSON files, and they are all error free. Anyone have a solution to my issue here? Any help provided would be really appreciated!

  • Author
2 hours ago, Zacomat said:

the json is error free but do you have the line "render_type": "cutout" in your model class?

You mean under "models/block/blockname.json" or the main class? If so, the line "render_type":"cutout" doesn't work if written inside the json files and I have already included RenderType.cutout() under FMLClientSetupEvent in my main class.

  • Author
2 hours ago, Zacomat said:

 

I was referring to version 1.20.1. I apologize for mentioning the wrong version.

It's alright. But do you have a solution to my version?

you already have it.  you set RenderType.cutout()  in FMLClientSetupEvent. 
find out why that code doesn't execute.

  • Author
3 hours ago, MFMods said:

you already have it.  you set RenderType.cutout()  in FMLClientSetupEvent. 
find out why that code doesn't execute.

I already looked around and dug the external libraries, but found no solution. Also, if I can figure out why it doesn't execute, I won't be asking here.

your client setup method looks fine.
did you add it as a listener in main mod class constructor?

DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> FMLJavaModLoadingContext.get().getModEventBus().addListener(ClientEvents::clientSetup));

(replace clientevents with how you called that class)

  • Author
10 hours ago, MFMods said:

your client setup method looks fine.
did you add it as a listener in main mod class constructor?

DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> FMLJavaModLoadingContext.get().getModEventBus().addListener(ClientEvents::clientSetup));

(replace clientevents with how you called that class)

I looked back, and realised I forgot to put "eventBus.addListener(this::clientSetup);" in my main constructor. And I fixed it :)

Anyways, thank you for you time.

do not keep client-only code in your main mod class or any class that has anything else in it.

it needs to be a separate class with client things (ItemBlockRenderTypes.setRenderLayer call etc.) and nothing else. on a dedicated server, it needs to stay unloaded.

to subscribe to an event, use the annotation (preferred way) or the line i gave you above. do not call addListener unconditionally.

  • Author
13 hours ago, MFMods said:

do not keep client-only code in your main mod class or any class that has anything else in it.

it needs to be a separate class with client things (ItemBlockRenderTypes.setRenderLayer call etc.) and nothing else. on a dedicated server, it needs to stay unloaded.

to subscribe to an event, use the annotation (preferred way) or the line i gave you above. do not call addListener unconditionally.

Ok noted, thank you.

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.