Jump to content

SlimeRender Not working


ScottNicholson

Recommended Posts

So I am trying to just change the default texture of the slime, I created a custom entity that will do much more later on in the mod, but right now its just a basic slime that I want to change the texture of. I have attached my renderer code below, it is a copy and pasted version of the slimerenderer that vanilla has, except I changed my texture file. For some reason when the slime loads in, it has no texture. The code will work completely fine when I don't change the texture, it will spawn the custom mob as a regular green slime, I don't want to just create a texture pack either. Am I missing something? Thank you for any help you can provide!

@OnlyIn(Dist.CLIENT)
public class CustomSlimeRenderer extends MobRenderer<Slime, SlimeModel<Slime>> {
    private static final ResourceLocation SLIME_LOCATION = new ResourceLocation("assests/textures/entities/slime.png");

    public CustomSlimeRenderer(EntityRendererProvider.Context p_174391_) {
        super(p_174391_, new SlimeModel<>(p_174391_.bakeLayer(ModelLayers.SLIME)), 0.25F);
        this.addLayer(new SlimeOuterLayer<>(this, p_174391_.getModelSet()));
    }

    public void render(Slime p_115976_, float p_115977_, float p_115978_, PoseStack p_115979_, MultiBufferSource p_115980_, int p_115981_) {
        this.shadowRadius = 0.25F * (float)p_115976_.getSize();
        super.render(p_115976_, p_115977_, p_115978_, p_115979_, p_115980_, p_115981_);
    }

    protected void scale(Slime p_115983_, PoseStack p_115984_, float p_115985_) {
        float f = 0.999F;
        p_115984_.scale(0.999F, 0.999F, 0.999F);
        p_115984_.translate(0.0D, (double)0.001F, 0.0D);
        float f1 = (float)p_115983_.getSize();
        float f2 = Mth.lerp(p_115985_, p_115983_.oSquish, p_115983_.squish) / (f1 * 0.5F + 1.0F);
        float f3 = 1.0F / (f2 + 1.0F);
        p_115984_.scale(f3 * f1, 1.0F / f3 * f1, f3 * f1);
    }

    public ResourceLocation getTextureLocation(Slime p_115974_) {
        return SLIME_LOCATION;
    }
}
public class EntityRenderer extends CustomSlimeRenderer {

    public EntityRenderer(EntityRendererProvider.Context p_174391_) {
        super(p_174391_);
    }
}
@Mod.EventBusSubscriber(modid = SlimeMod.MOD_ID, bus= Mod.EventBusSubscriber.Bus.MOD,value = Dist.CLIENT)
public final class ModEvents {
    private ModEvents(){}
    
    @SubscribeEvent
    public static void registerRenderers(EntityRenderersEvent.RegisterRenderers event){
        event.registerEntityRenderer(ModeEntityTypes.DUNGEON_SLIME.get(), EntityRenderer::new);
    }

}

 

Link to comment
Share on other sites

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.