Jump to content

[1.14.4] [SOLVED] Rendering layer (model) with transparency on player and holding an item makes the texture solid


Recommended Posts

Posted (edited)

When I hold an item in my hand, the model's texture which I want to be transparent becomes solid. Is there any way to fix this? (Having the texture transparent and rendering it with an alpha of 1.0F has the same result as having it solid and rendering it with a lower alpha)

 

Layer code:

@OnlyIn(Dist.CLIENT)
public class LayerSusanoo extends LayerRenderer<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> {
	
	public LayerSusanoo(
			IEntityRenderer<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> entityRendererIn) {
		super(entityRendererIn);
	}
	
	private static final ResourceLocation cage = new ResourceLocation(Main.modid, "textures/layers/player/susanoo/cage.png");

	@Override
	public void render(AbstractClientPlayerEntity entityIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, 
			float netHeadYaw, float headPitch, float scale) {
		IPlayerKgCap kgcap = PlayerKgCapStorage.getCapability(entityIn);
		IPlayerAnimCap animcap = PlayerAnimCapStorage.getCapability(entityIn);
		if (kgcap.getSusanooActive()) {
			if (kgcap.getSusanooSize() == 1) {
				GlStateManager.pushMatrix();
				ModelSusanooCage modelSusanooCage = new ModelSusanooCage();
				GL11.glColor4f(kgcap.getSusanooColorR()/255F, kgcap.getSusanooColorG()/255F, kgcap.getSusanooColorB()/255F, 0.2F);
				this.bindTexture(cage);
				modelSusanooCage.isSitting = this.getEntityModel().isSitting;
				modelSusanooCage.isChild = this.getEntityModel().isChild;
				modelSusanooCage.setLivingAnimations(entityIn, limbSwing, limbSwingAmount, partialTicks);
				modelSusanooCage.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
				GlStateManager.popMatrix();
			}
		}
	}
	
	@Override
	public boolean shouldCombineTextures() {
		return false;
	}

}

 

2019-10-26_00.35.34.png

2019-10-26_00.35.37.png

Edited by FlashHUN
marked as solved
Posted

Your code never enables alpha.

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.

Posted
8 hours ago, FlashHUN said:

Is there any way to fix this?

As Draco said you need to enable alpha via the GLStateManager in your code then disable it after your code runs.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
9 hours ago, Draco18s said:

Your code never enables alpha.

 

4 hours ago, Animefan8888 said:

As Draco said you need to enable alpha via the GLStateManager in your code then disable it after your code runs.

Ah, thank you guys! That solved it.

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.