![JAR search and dependency download from the Maven repository](/logo.png)
cn.nukkit.entity.EntityCreature Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of powernukkit Show documentation
Show all versions of powernukkit Show documentation
A Minecraft Bedrock Edition server software implementation made in Java from scratch which supports all new features.
package cn.nukkit.entity;
import cn.nukkit.Player;
import cn.nukkit.api.PowerNukkitDifference;
import cn.nukkit.api.PowerNukkitOnly;
import cn.nukkit.api.Since;
import cn.nukkit.item.Item;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.math.Vector3;
import cn.nukkit.nbt.tag.CompoundTag;
import javax.annotation.Nonnull;
/**
* @author MagicDroidX (Nukkit Project)
*/
@PowerNukkitDifference(since = "1.4.0.0-PN", info = "Implements EntityNameable only in PowerNukkit")
public abstract class EntityCreature extends EntityLiving implements EntityNameable {
public EntityCreature(FullChunk chunk, CompoundTag nbt) {
super(chunk, nbt);
}
// Armor stands, when implemented, should also check this.
@Override
public boolean onInteract(Player player, Item item, Vector3 clickedPos) {
if (item.getId() == Item.NAME_TAG) {
return applyNameTag(player, item);
}
return false;
}
@PowerNukkitOnly
@Since("1.4.0.0-PN")
@Override
public final boolean playerApplyNameTag(@Nonnull Player player, @Nonnull Item item) {
return applyNameTag(player, item);
}
// Structured like this so I can override nametags in player and dragon classes
// without overriding onInteract.
@Since("1.4.0.0-PN")
protected boolean applyNameTag(@Nonnull Player player, @Nonnull Item item){
// The code was moved to the default block of that interface
return EntityNameable.super.playerApplyNameTag(player, item);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy