Search in sources :

Example 1 with HorseEntity

use of net.minecraft.entity.passive.HorseEntity in project Biome-Makeover by Lemonszz.

the class HorseHatFeatureRenderer method render.

@Override
public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, HorseEntity entity, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
    if (((HorseHat) entity).hasHat()) {
        matrices.scale(1.05F, 1.05F, 1.05F);
        CowboyHatModel<HorseEntity> hatModel = new CowboyHatModel<>();
        ((ModelPart) ((HorseEntityModel) this.getContextModel()).getHeadParts().iterator().next()).rotate(matrices);
        matrices.translate(0F, -0.23F, 0.15);
        matrices.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-25F));
        VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumers, hatModel.getLayer(this.getTexture(entity)), true, false);
        hatModel.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, 1F, 1F, 1F, 1F);
    }
}
Also used : HorseEntity(net.minecraft.entity.passive.HorseEntity) ModelPart(net.minecraft.client.model.ModelPart) HorseHat(party.lemons.biomemakeover.util.extensions.HorseHat) VertexConsumer(net.minecraft.client.render.VertexConsumer)

Example 2 with HorseEntity

use of net.minecraft.entity.passive.HorseEntity in project Biome-Makeover by Lemonszz.

the class PillagerSpawnerMixin method spawnMixin.

@Inject(at = @At("HEAD"), method = "spawnPillager", cancellable = true)
private void spawnMixin(ServerWorld world, BlockPos pos, Random random, boolean captain, CallbackInfoReturnable<Boolean> cbi) {
    Biome biome = world.getBiome(pos);
    Biome.Category category = biome.getCategory();
    if (category == Biome.Category.MESA) {
        BlockState blockState = world.getBlockState(pos);
        if (!SpawnHelper.isClearForSpawn(world, pos, blockState, blockState.getFluidState(), BMEntities.COWBOY)) {
            cbi.setReturnValue(false);
            return;
        } else if (!PatrolEntity.canSpawn(BMEntities.COWBOY, world, SpawnReason.PATROL, pos, random)) {
            cbi.setReturnValue(false);
            return;
        } else {
            PatrolEntity patrolEntity = BMEntities.COWBOY.create(world);
            if (patrolEntity != null) {
                HorseEntity horseEntity = EntityType.HORSE.create(world);
                horseEntity.updatePosition(pos.getX(), pos.getY(), pos.getZ());
                horseEntity.initialize(world, world.getLocalDifficulty(pos), SpawnReason.PATROL, null, null);
                patrolEntity.startRiding(horseEntity);
                if (captain) {
                    patrolEntity.setPatrolLeader(true);
                    patrolEntity.setRandomPatrolTarget();
                    ((HorseHat) horseEntity).setHat();
                }
                ((HorseHat) horseEntity).setCowboySpawned();
                patrolEntity.updatePosition(pos.getX(), pos.getY(), pos.getZ());
                patrolEntity.initialize(world, world.getLocalDifficulty(pos), SpawnReason.PATROL, null, null);
                world.spawnEntityAndPassengers(horseEntity);
                cbi.setReturnValue(true);
                return;
            } else {
                cbi.setReturnValue(false);
                return;
            }
        }
    }
}
Also used : Biome(net.minecraft.world.biome.Biome) BlockState(net.minecraft.block.BlockState) HorseEntity(net.minecraft.entity.passive.HorseEntity) PatrolEntity(net.minecraft.entity.mob.PatrolEntity) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

HorseEntity (net.minecraft.entity.passive.HorseEntity)2 BlockState (net.minecraft.block.BlockState)1 ModelPart (net.minecraft.client.model.ModelPart)1 VertexConsumer (net.minecraft.client.render.VertexConsumer)1 PatrolEntity (net.minecraft.entity.mob.PatrolEntity)1 Biome (net.minecraft.world.biome.Biome)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1 HorseHat (party.lemons.biomemakeover.util.extensions.HorseHat)1