use of net.minecraft.entity.ExperienceOrbEntity in project bewitchment by MoriyaShiine.
the class SmeltItemsRitualFunction method tick.
@Override
public void tick(World world, BlockPos glyphPos, BlockPos effectivePos, boolean catFamiliar) {
int radius = catFamiliar ? 9 : 3;
if (!world.isClient) {
if (world.getTime() % 20 == 0) {
for (ItemEntity itemEntity : world.getEntitiesByType(EntityType.ITEM, new Box(effectivePos).expand(radius, 0, radius), entity -> true)) {
if (world.random.nextFloat() < 1 / 4f) {
world.getRecipeManager().listAllOfType(RecipeType.SMELTING).forEach(smeltingRecipe -> {
for (Ingredient ingredient : smeltingRecipe.getIngredients()) {
if (ingredient.test(itemEntity.getStack())) {
world.playSound(null, itemEntity.getBlockPos(), SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1, 1);
ItemScatterer.spawn(world, itemEntity.getX(), itemEntity.getY(), itemEntity.getZ(), smeltingRecipe.getOutput().copy());
world.spawnEntity(new ExperienceOrbEntity(world, itemEntity.getX(), itemEntity.getY(), itemEntity.getZ(), 1));
itemEntity.getStack().decrement(1);
}
}
});
}
}
}
} else {
world.addParticle(ParticleTypes.FLAME, effectivePos.getX() + MathHelper.nextDouble(world.random, -radius, radius), effectivePos.getY() + 0.5, effectivePos.getZ() + MathHelper.nextDouble(world.random, -radius, radius), 0, 0, 0);
}
}
use of net.minecraft.entity.ExperienceOrbEntity in project wildmod by Osmiooo.
the class FrogMateGoal method breed.
protected void breed() {
ServerPlayerEntity serverPlayerEntity = this.animal.getLovingPlayer();
if (serverPlayerEntity == null && this.mate.getLovingPlayer() != null) {
serverPlayerEntity = this.mate.getLovingPlayer();
}
if (serverPlayerEntity != null) {
serverPlayerEntity.incrementStat(Stats.ANIMALS_BRED);
Criteria.BRED_ANIMALS.trigger(serverPlayerEntity, this.animal, this.mate, (PassiveEntity) null);
}
this.frog.becomePregnant(true);
this.animal.resetLoveTicks();
this.mate.resetLoveTicks();
Random random = this.animal.getRandom();
if (this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
this.world.spawnEntity(new ExperienceOrbEntity(this.world, this.animal.getX(), this.animal.getY(), this.animal.getZ(), random.nextInt(7) + 1));
}
}
use of net.minecraft.entity.ExperienceOrbEntity in project Biome-Makeover by Lemonszz.
the class ToadEntity method breed.
public void breed(ServerWorld serverWorld, AnimalEntity other) {
ServerPlayerEntity player = this.getLovingPlayer();
if (player == null && other.getLovingPlayer() != null) {
player = other.getLovingPlayer();
}
if (player != null) {
player.incrementStat(Stats.ANIMALS_BRED);
Criteria.BRED_ANIMALS.trigger(player, this, other, null);
}
setHasBaby(true);
this.setBreedingAge(6000);
other.setBreedingAge(6000);
this.resetLoveTicks();
other.resetLoveTicks();
serverWorld.sendEntityStatus(this, (byte) 18);
if (serverWorld.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
serverWorld.spawnEntity(new ExperienceOrbEntity(serverWorld, this.getX(), this.getY(), this.getZ(), this.getRandom().nextInt(7) + 1));
}
}
use of net.minecraft.entity.ExperienceOrbEntity in project Biome-Makeover by Lemonszz.
the class MushroomVillagerEntity method afterUsing.
protected void afterUsing(TradeOffer offer) {
if (offer.shouldRewardPlayerExperience()) {
int i = 3 + this.random.nextInt(4);
this.world.spawnEntity(new ExperienceOrbEntity(this.world, this.getX(), this.getY() + 0.5D, this.getZ(), i));
}
}
Aggregations