Jump to content

Recommended Posts

Posted (edited)

Hello I have an error that I can not solve which causes another error

ERROR :
 

java\net\mcreator\harmorvillager\client\renderer\ArmorRiderTESTRenderer.java:28: error: cannot find symbol 
        super(context, new ModelArmoredRider<>(context.bakeLayer(ModelLayers.PLAYER_OUTER_ARMOR)), 0.5F); 
                                                                 ^ 
  symbol:   variable ModelLayers 
  location: class ArmorRiderTESTRenderer

CODE :
 

package net.mod.harmorvillager.client.renderer;

import javax.annotation.Nullable;

import com.mojang.blaze3d.vertex.PoseStack;

import net.minecraft.client.model.HumanoidArmorModel;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.HumanoidMobRenderer;
import net.minecraft.client.resources.model.ModelLayers;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.HumanoidArm;
import net.minecraft.world.item.CrossbowItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.UseAnim;

import net.mcreator.harmorvillager.entity.ArmorRiderTESTEntity;
import net.mcreator.harmorvillager.client.model.ModelArmoredRider;
import net.mcreator.harmorvillager.client.model.ArmoredRiderArmorModel;

public class ArmorRiderTESTRenderer extends HumanoidMobRenderer<ArmorRiderTESTEntity, HumanoidModel<ArmorRiderTESTEntity>> {
    private final HumanoidModel<ArmorRiderTESTEntity> normal = this.getModel();

    public ArmorRiderTESTRenderer(EntityRendererProvider.Context context) {
        super(context, new ModelArmoredRider<>(context.bakeLayer(ModelLayers.PLAYER_OUTER_ARMOR)), 0.5F);
        this.addLayer(new HumanoidArmorLayer<>(this, new ArmoredRiderArmorModel<>(context.bakeLayer(ModelLayers.PLAYER_INNER_ARMOR)), new ArmoredRiderArmorModel<>(context.bakeLayer(ModelLayers.PLAYER_OUTER_ARMOR))));
    }

    @Override
    public void render(ArmorRiderTESTEntity entityIn, float entityYaw, float partialTicks, PoseStack matrixStackIn, MultiBufferSource bufferIn, int packedLightIn) {
        this.setModelVisibilities(entityIn);
        super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);
    }

    private void setModelVisibilities(ArmorRiderTESTEntity entityIn) {
        HumanoidModel<ArmorRiderTESTEntity> ridermodel = this.getModel();
        ItemStack itemstack = entityIn.getMainHandItem();
        ItemStack itemstack1 = entityIn.getOffhandItem();
        ridermodel.setAllVisible(true);
        HumanoidModel.ArmPose bipedmodel$armpose = this.getArmPose(entityIn, itemstack, itemstack1,
                InteractionHand.MAIN_HAND);
        HumanoidModel.ArmPose bipedmodel$armpose1 = this.getArmPose(entityIn, itemstack, itemstack1,
                InteractionHand.OFF_HAND);
        ridermodel.crouching = entityIn.isCrouching();
        if (entityIn.getMainArm() == HumanoidArm.RIGHT) {
            ridermodel.rightArmPose = bipedmodel$armpose;
            ridermodel.leftArmPose = bipedmodel$armpose1;
        } else {
            ridermodel.rightArmPose = bipedmodel$armpose1;
            ridermodel.leftArmPose = bipedmodel$armpose;
        }
    }

    private HumanoidModel.ArmPose getArmPose(ArmorRiderTESTEntity entityIn, ItemStack itemStackMain, ItemStack itemStackOff,
            InteractionHand handIn) {
        HumanoidModel.ArmPose bipedmodel$armpose = HumanoidModel.ArmPose.EMPTY;
        ItemStack itemstack = handIn == InteractionHand.MAIN_HAND ? itemStackMain : itemStackOff;
        if (!itemstack.isEmpty()) {
            bipedmodel$armpose = HumanoidModel.ArmPose.ITEM;
            if (entityIn.getUseItemRemainingTicks() > 0) {
                UseAnim useaction = itemstack.getUseAnimation();
                switch (useaction) {
                    case BLOCK:
                        bipedmodel$armpose = HumanoidModel.ArmPose.BLOCK;
                        break;
                    case BOW:
                        bipedmodel$armpose = HumanoidModel.ArmPose.BOW_AND_ARROW;
                        break;
                    case SPEAR:
                        bipedmodel$armpose = HumanoidModel.ArmPose.THROW_SPEAR;
                        break;
                    case CROSSBOW:
                        if (handIn == entityIn.getUsedItemHand()) {
                            bipedmodel$armpose = HumanoidModel.ArmPose.CROSSBOW_CHARGE;
                        }
                        break;
                    default:
                        bipedmodel$armpose = HumanoidModel.ArmPose.EMPTY;
                        break;
                }
            } else {
                boolean flag1 = itemStackMain.getItem() instanceof CrossbowItem;
                boolean flag2 = itemStackOff.getItem() instanceof CrossbowItem;
                if (flag1 && entityIn.isAggressive()) {
                    bipedmodel$armpose = HumanoidModel.ArmPose.CROSSBOW_HOLD;
                }

                if (flag2 && itemStackMain.getItem().getUseAnimation(itemStackMain) == UseAnim.NONE
                        && entityIn.isAggressive()) {
                    bipedmodel$armpose = HumanoidModel.ArmPose.CROSSBOW_HOLD;
                }
            }
        }
        return bipedmodel$armpose;
    }

    @Override
    protected void scale(ArmorRiderTESTEntity entitylivingbaseIn, PoseStack matrixStackIn, float partialTickTime) {
        matrixStackIn.scale(0.9375F, 0.9375F, 0.9375F);
    }

    @Nullable
    @Override
   public ResourceLocation getTextureLocation(ArmorRiderTESTEntity entity) {
		return new ResourceLocation("harmorvillager:textures/entities/armoredvillager.png");
	}
}

 

Edited by olzi
Posted (edited)

https://forums.minecraftforge.net/topic/125895-helphello-i-have-an-error-in-my-mod-i-made-a-sword-with-a-better-range/?do=findComment&comment=542502
 

Quote

If you are posting compiler errors you are in the wrong forum.

You want a learning java forum.

You cannot keep posting these kind of errors in this forum.

You need to spend the time to learn java. Buy a book or whatever you need to learn the language.

 

You have the wrong package for that class

Quote

import net.minecraft.client.resources.model.ModelLayers;

import net.minecraft.client.model.geom.ModelLayers;

 

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

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.