Jump to content

[SOLVED] [1.15.2] A texture issue with cross models?


MattNL

Recommended Posts

So, I'm having an... interesting bug, and, after about an hour, I'm not sure what's causing it. My rose texture is normal and transparent when held or in an item frame, but when placed, the transparency becomes black. I'm not sure if this is simply a bug with Forge, or if something significant changed from 1.15.1 to 1.15.2. I'm modding with version 31.0.16.

Blockstate:

{
    "variants": {
        "": { "model": "[NAMESPACE HERE]:block/rose" }
    }
}

 

Block Model:

{
    "parent": "block/cross",
    "textures": {
        "cross": "[NAMESPACE HERE]:block/rose"
    }
}

 

Item Model:

{
    "parent": "item/generated",
    "textures": {
        "layer0": "[NAMESPACE HERE]:block/rose"
     }
}

 

Item Registration (Not sure if this has anything to do with it because it's actually just a FlowerBlock):

new BlockItem(ModBlocks.rose, new Item.Properties().maxStackSize(64).group(ItemGroup.DECORATIONS)).setRegistryName("[NAMESPACE HERE]", "rose"),

 

2020-02-02_19.36.10.png

 

Thanks in advance! ?

Edited by MattNL
Link to comment
Share on other sites

  • MattNL changed the title to [1.15.2] A texture issue with cross models?

You didn't set your block (in the java code) to be transparent.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Well, what class does your block use? You showed your item registration, but not your block code.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Ok, I'm not sure.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

That helped a lot!

 

This is how I implemented it. I slightly modified the registerBlock function from here (Biomes of Plenty Mod [by Glitchfiend]):

https://github.com/Glitchfiend/BiomesOPlenty/commit/7b727bfbcfb9307a6d15efa15893fdd8f7721cd4

 

Here is a cropped sample of code for those struggling with the issue:

 

public static Block rose = null;
public static Block cyan_flower = null;

@Mod.EventBusSubscriber(modid = "[NAMESPACE HERE]", bus = Mod.EventBusSubscriber.Bus.MOD)
@ObjectHolder("[NAMESPACE HERE]")
public class ModBlocks {
  	rose = registerBlock(new FlowerBlock(Effects.SPEED, 6, Block.Properties.create(Material.PLANTS).doesNotBlockMovement().hardnessAndResistance(0.0F).sound(SoundType.PLANT)), "[NAMESPACE HERE]", "rose");
	cyan_flower = registerBlock(new FlowerBlock(Effects.SPEED, 6, Block.Properties.create(Material.PLANTS).doesNotBlockMovement().hardnessAndResistance(0.0F).sound(SoundType.PLANT)), "[NAMESPACE HERE]", "cyan_flower");

	if (FMLEnvironment.dist == Dist.CLIENT) {
		RenderTypeLookup.setRenderLayer(rose, RenderType.func_228643_e_());
		RenderTypeLookup.setRenderLayer(cyan_flower, RenderType.func_228643_e_());
	}
}

public static Block registerBlock(Block block, String namespace, String name)
{
	block.setRegistryName(namespace, name);
	ForgeRegistries.BLOCKS.register(block);
	return block;
}

 

For anyone who wants the functions for all of the RenderTypes:

 

func_228639_c_ = SOLID

func_228641_d_ = CUTOUT_MIPPED

func_228643_e_ = CUTOUT

func_228645_f_ = TRANSLUCENT

func_228647_g_ = TRANSLUCENT_NO CRUMBLING

func_228649_h_ = LEASH

func_228651_i_ = WATER_MASK

func_228653_j_ = GLINT

func_228655_k_ = ENTITY GLINT

func_228657_l_ = LIGHTNING

 

I hope this can be useful to anyone else struggling with the same issue!

 

Thanks very much!

2020-02-05_19.10.30.png

Edited by MattNL
Slightly modified code to have better flexibility
Link to comment
Share on other sites

  • MattNL changed the title to [SOLVED] [1.15.2] A texture issue with cross models?

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.



×
×
  • Create New...

Important Information

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