Package net.minecraft.entity.passive

Examples of net.minecraft.entity.passive.EntityTameable


    @SubscribeEvent
    public void interact(EntityInteractEvent event) {
        Entity entity = event.target;

        if (entity instanceof EntityTameable) {
            EntityTameable tameable = (EntityTameable) entity;
            String ownerId = tameable.func_152113_b();
            if (tameable.isTamed() && (ownerId == null || ownerId.trim().length() == 0)) {
                if (rand.nextInt(3) == 0) {
                    tameable.func_152115_b(event.entityPlayer.getUniqueID().toString());
                    playTameEffect(tameable, true);
                    tameable.func_70907_r().setSitting(true);
                    tameable.worldObj.setEntityState(tameable, (byte) 7);
                } else {
                    playTameEffect(tameable, false);
                    tameable.worldObj.setEntityState(tameable, (byte) 6);
                }
View Full Code Here


        return 60;
    }

    @Override
    public void onHackFinished(Entity entity, EntityPlayer player){
        EntityTameable tameable = (EntityTameable)entity;
        if(entity.worldObj.isRemote) {
            tameable.handleHealthUpdate((byte)7);
        } else {
            tameable.setPathToEntity((PathEntity)null);
            tameable.setAttackTarget((EntityLivingBase)null);
            tameable.setHealth(20.0F);
            tameable.func_152115_b(player.getUniqueID().toString());//setOwner
            entity.worldObj.setEntityState(tameable, (byte)7);
            tameable.setTamed(true);
        }
    }
View Full Code Here

TOP

Related Classes of net.minecraft.entity.passive.EntityTameable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.