Jump to content

[1.16.5] Entity model floating in air


stopper

Recommended Posts

My model for some reason floating in air.

2021-05-30_19_29_22.thumb.png.ee7444901a22c50987ea9b8d013836cb.png2021-05-30_19_29_16.thumb.png.ca4ea32dded26702d570e851c39334f0.png

Renderer:

Spoiler

public class CarRenderer extends MobRenderer<Car, CarModel> {
    public static final ResourceLocation TEXTURE = new ResourceLocation("testcar", "textures/entities/car.png");

    public CarRenderer(EntityRendererManager manager) {
        super(manager, new CarModel(), 0.5f);
    }

    @Override
    public ResourceLocation getTextureLocation(Car p_110775_1_) {
        return TEXTURE;
    }
}

 

Model:

Spoiler

public class CarModel extends EntityModel<Car> {
	private final ModelRenderer bb_main;

	public CarModel() {
		bb_main = new ModelRenderer(this);
		bb_main.setTexSize(40, 25);
		bb_main.texOffs(0, 0).addBox(-4.0F, -2.0F, -6.0F, 8.0F, 1.0F, 12.0F, 0.0F, false);
		bb_main.texOffs(0, 13).addBox(-3.0F, -6.0F, -5.0F, 6.0F, 4.0F, 8.0F, 0.0F, false);
		bb_main.texOffs(28, 13).addBox(-5.0F, -3.0F, 3.0F, 1.0F, 3.0F, 3.0F, 0.0F, false);
		bb_main.texOffs(28, 13).addBox(-5.0F, -3.0F, -6.0F, 1.0F, 3.0F, 3.0F, 0.0F, false);
		bb_main.texOffs(28, 13).addBox(4.0F, -3.0F, -6.0F, 1.0F, 3.0F, 3.0F, 0.0F, false);
		bb_main.texOffs(28, 13).addBox(4.0F, -3.0F, 3.0F, 1.0F, 3.0F, 3.0F, 0.0F, false);
	}

	@Override
	public void setupAnim(Car p_225597_1_, float p_225597_2_, float p_225597_3_, float p_225597_4_, float p_225597_5_, float p_225597_6_) {}

	@Override
	public void renderToBuffer(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
		bb_main.render(matrixStack, buffer, packedLight, packedOverlay, red, green, blue, alpha);
	}
}

 

Entity:

Spoiler

public class Car extends MonsterEntity {
    public Car(EntityType<? extends MonsterEntity> type, World world) {
        super(type, world);
    }

    @Override
    protected void registerGoals() {
        this.goalSelector.addGoal(1, new SwimGoal(this));
        this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.5d, true));
        this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, true));
        this.goalSelector.addGoal(2, new LookAtGoal(this, PlayerEntity.class, 8.0F));
        this.goalSelector.addGoal(4, new OpenDoorGoal(this, false));
        this.goalSelector.addGoal(3, new WaterAvoidingRandomWalkingGoal(this, 1.0d));
        this.goalSelector.addGoal(3, new LookRandomlyGoal(this));
    }

    public static AttributeModifierMap.MutableAttribute createMobAttributes() {
        return MonsterEntity.createMonsterAttributes()
                .add(Attributes.ATTACK_DAMAGE, 6.0D)
                .add(Attributes.MAX_HEALTH, 8.0D)
                .add(Attributes.FOLLOW_RANGE, 40.0D);
    }
}

 

 

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.