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);
}
}
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;
}
}
}
}
Aggregations