package ru.theklimot.npc.mobs;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackMelee;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.EntityEntryBuilder;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import ru.theklimot.npc.Main;
import ru.theklimot.npc.gui.SkolGui;
public class EntitySmallHerobrine extends EntityMob {
//��� ���. ����(���� � ��)
public static int ADD_DAMAGE = 15;
/*�����������*/
public EntitySmallHerobrine(World world) {
super(world);
setCustomNameTag("Путешественник");
setAlwaysRenderNameTag(true);
setSize(0.6F, 1.98F);//������ ����
}
/*����������� � ���������� �������*/
public EntitySmallHerobrine(World world, double x, double y, double z) {
super(world);
setSize(0.6F, 1.98F);//������ ����
this.canBeAttackedWithItem();
this.canBePushed();
}
@Override
protected void applyEntityAttributes() {
/*������� ���� ����� ��� ����������� ���������(����. ��, ��������, ���� �����, �����, �������� ����� � ��.)*/
super.applyEntityAttributes();
//������������� ��������
this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(35.0D);//������ ������ = 35 ������
this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.0D);//�������� ����(��� �������: ������� ����� = 0.23D)
this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(0.0D);//���� �������� = 1.5 ��������(� �������� = 2D)
this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(2.0D);//����� ����(�� �� ������� ���� �� ����)
this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(12398122.0D);
this.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).setBaseValue(3.0D);
this.getEntityAttribute(SharedMonsterAttributes.ARMOR_TOUGHNESS).setBaseValue(0.0D);
}
@Override
public void onUpdate(){
super.onUpdate();
motionY = 0;
motionX = 0;
motionZ = 0;
this.isAirBorne = true;
}
@Override
public void addVelocity(double x, double y, double z)
{
this.motionX += x;
this.motionY += y;
this.motionZ += z;
this.isAirBorne = true;
}
@Override
protected void initEntityAI() {
/*������ �������� ����
* 1 �������� - ���������
* 2 �������� - �������� ����� �� EntityAIBase
*/
this.tasks.addTask(0, new EntityAISwimming(this));//������� �� ���
targetTasks.addTask(5, new EntityAIHurtByTarget(this, false));
this.tasks.addTask(1, new EntityAIAttackMelee(this, 0.0D, false));//����� �������� ���
this.tasks.addTask(2, new EntityAIWander(this, 0.0D));//��� ������������
this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));//������� �� EntityPlayer(�����)
this.tasks.addTask(4, new EntityAILookIdle(this));//����� ������ - ������� ������������� ������
}
@SideOnly(Side.CLIENT)
public boolean processInteract(EntityPlayer player, EnumHand hand)
{
if(this.getEntityWorld().isRemote)
{
Minecraft.getMinecraft().displayGuiScreen(new SkolGui());
//player.openGui(GuardsCraft.instance, 1, this.getEntityWorld(), 0, 0, 0);
//player.openGui(GuardsCraft.instance, GUI_ID, world, this.chunkCoordX, this.chunkCoordY, this.chunkCoordZ);
//player.openGui(GuardsCraft.instance, GUI_ID, world, 153, 81, 251);
//return super.processInteract(player, hand);
return true;
}
else { return false; }
}
@Override
public int getMaxSpawnedInChunk() {
/*������� ��������� � �����*/
return 25;
}
}