Jump to content

Recommended Posts

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!

Posted
  On 7/19/2023 at 5:31 PM, Zacomat said:

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

Expand  

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.

Posted
  On 7/21/2023 at 3:44 PM, MFMods said:

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

Expand  

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.

Posted

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)

Posted
  On 7/22/2023 at 7:35 AM, 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)

Expand  

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.

Posted

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.

Posted
  On 7/23/2023 at 6:17 AM, 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.

Expand  

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

×   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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hi everyone, I’m working on a Minecraft mod and encountering an issue with a custom sound not playing when triggered. Here’s the setup: Problem: * A custom sound (killstreak_music) should play when a milestone (5 kills) is reached, but it doesn’t trigger in-game. * The .ogg file is in the correct directory (assets/killstreaksword/sounds/) and registered in sounds.json. sounds.json: {   "killstreak_music": {     "sounds": ["Finale.ogg"]   } } The .ogg file plays fine in other media players, but the /playsound command doesn’t detect it. What I’ve Tried: * Confirmed file path and name match exactly. * Reloaded resources (F3 + T) and re-exported the file using Audacity. * Added debug logs to my code to verify if the sound event is being retrieved. Here’s the relevant part of my code where I attempt to play the sound:   private static final ResourceLocation SOUND_LOCATION = ResourceLocation.fromNamespaceAndPath("killstreaksword", "killstreak_music"); private void playKillstreakMusic(Level world, Player player) {     SoundEvent soundEvent = ForgeRegistries.SOUND_EVENTS.getValue(SOUND_LOCATION);     if (soundEvent == null) {         System.out.println("Sound event not found: " + SOUND_LOCATION);     } else {         world.playSound(null, player.getX(), player.getY(), player.getZ(), soundEvent, SoundSource.PLAYERS, 1.0F, 1.0F);     } }   Could this be a file encoding or registration issue? Are there additional steps I’m missing to ensure Minecraft detects the sound? Any guidance or suggestions would be greatly appreciated. Thanks in advance!
    • Hello everyone, friends and family, I hope this message finds you well. I’m writing to you from Alberton, Canada, and I feel it’s important to share my story with you, not just as a cautionary tale, but as a message of hope. As many of you know, I’m a doctor, and in 2024, I decided to try my hand at cryptocurrency trading. I had heard so much about how profitable it could be, and with a background in analytics and understanding of markets, I thought I could navigate the space safely. Unfortunately, things didn’t go as planned. I was targeted by scammers who posed as legitimate trading platforms, and I ended up losing a significant amount of money. It was a devastating experience, and at one point, I felt like there was no way to recover my funds. But by God’s grace, I was referred to Hackerzed Nemesis Recovery, who are among the best bitcoin recovery specialists in the world. Through their expertise, they used advanced forensic techniques to track down the fraudulent transactions and recover every penny I had lost. I can’t tell you how grateful I am for their help without them, I would still be in the dark, feeling helpless and defeated. This experience has taught me a valuable lesson that I want to pass on to you all: Be extremely cautious when it comes to investing in cryptocurrency, especially online. While the industry itself can offer opportunities, there are countless scams out there designed to prey on people’s hopes and investments. If you have already fallen victim to such schemes, whether in forex, cryptocurrency, or Ponzi schemes, I strongly urge you to seek professional help. That brings me to another point I want to highlight: if you've been defrauded, do not lose hope. There are dedicated recovery services, like Hackerzed Nemesis Recovery, who can assist you in reclaiming your lost funds. cryptocurrency is a complex and volatile market, and while it can be rewarding, it's essential to proceed with caution. I hope my experience serves as a reminder to stay vigilant and do thorough research before making any investment. Wishing you all safety and success in your financial endeavors!  
    • Yes it was the full log. I didnt remove or add anything and did just what you recommended me with AT launcher and it doesnt work still. It has the same problem. I attatched the log.  
    • Yes, I agree. Downloading bods         
    • When I open a world, it works fine. It only crashes when I place a create block down. It also crashes when I try to reopen the world that crashes. I already tried to reset the graphics drivers.
  • Topics

×
×
  • Create New...

Important Information

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