mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-01-31 19:16:44 +01:00
Add villagers to the list of entities that benefit from the crystal heart. Closes #184
This commit is contained in:
parent
10dc8ce6d7
commit
3bab3c4f56
1 changed files with 6 additions and 2 deletions
|
@ -20,6 +20,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.EndRodBlock;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.mob.MobEntity;
|
||||
import net.minecraft.entity.passive.MerchantEntity;
|
||||
import net.minecraft.entity.passive.TameableEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.*;
|
||||
|
@ -34,7 +35,9 @@ import net.minecraft.util.math.Vec3d;
|
|||
import net.minecraft.world.World;
|
||||
|
||||
public class CrystalHeartItem extends Item implements FloatingArtefactEntity.Artifact {
|
||||
static final Predicate<Entity> TARGET_PREDICATE = EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR.and(EntityPredicates.VALID_ENTITY).and(e -> (e instanceof PlayerEntity || e instanceof MobEntity));
|
||||
static final Predicate<Entity> TARGET_PREDICATE = EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR
|
||||
.and(EntityPredicates.VALID_ENTITY)
|
||||
.and(e -> (e instanceof PlayerEntity || e instanceof MobEntity));
|
||||
private static final Supplier<Map<Item, Item>> ITEM_MAP = Suppliers.memoize(() -> {
|
||||
return Map.of(
|
||||
Items.BUCKET, UItems.LOVE_BUCKET,
|
||||
|
@ -126,7 +129,8 @@ public class CrystalHeartItem extends Item implements FloatingArtefactEntity.Art
|
|||
|
||||
if (e instanceof PlayerEntity
|
||||
|| (living instanceof TameableEntity && ((TameableEntity)living).isTamed())
|
||||
|| (living instanceof Saddleable && ((Saddleable)living).isSaddled())) {
|
||||
|| (living instanceof Saddleable && ((Saddleable)living).isSaddled())
|
||||
|| (living instanceof MerchantEntity)) {
|
||||
if (living.getHealth() < living.getMaxHealth()) {
|
||||
outputs.add(living);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue