package [Link].
Entities;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].*;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class EntityVessel extends EntitySpellcasterIllager {
public static final ResourceLocation LOOT = new
ResourceLocation([Link], "entities/Vessel");
private static final DataParameter<Integer> ENTITY =
[Link]([Link], [Link]);
private static final DataParameter<Boolean> INACTIVE =
[Link]([Link], [Link]);
private float previousYaw = -1F;
private float previousPitch = -1F;
private EntityVesselHead targetedEntity;
public EntityVessel(World world) {
super(world);
[Link](0.8F, 2.5F);
[Link] = new AIMoveControl(this);
[Link] = 30;
}
protected void initEntityAI()
{
[Link](0, new EntityAISwimming(this));
[Link](4, new AIShootHead());
[Link](4, new AIBallin());
[Link](5, new AIDuplicate());
[Link](6, new AISummonGhosts());
[Link](8, new AIMoveRandom(this));
[Link](7, new EntityAIWanderAvoidWater(this, 1.0D));
[Link](9, new EntityAIWatchClosest(this, [Link],
8.0F, 1.0F));
[Link](1, new EntityAIHurtByTarget(this, true,
[Link]));
[Link](2, (new EntityAINearestAttackableTarget<>(this,
[Link], true)).setUnseenMemoryTicks(100));
[Link](3, (new EntityAINearestAttackableTarget<>(this,
[Link], false)).setUnseenMemoryTicks(100));
[Link](2, (new EntityAINearestAttackableTarget<>(this,
[Link], false)));
}
protected void applyEntityAttributes()
{
[Link]();
[Link](SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.7D);
[Link](SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(16.0D);
[Link](SharedMonsterAttributes.MAX_HEALTH).setBaseValue(60.0D +
[Link]);
}
protected void entityInit() {
[Link]();
[Link](ENTITY, 0);
[Link](INACTIVE, false);
}
private void setTargetedEntity(int entityId)
{
[Link](ENTITY, entityId);
}
public boolean hasTargetedEntity()
{
return [Link](ENTITY) != 0;
}
@Nullable
public EntityVesselHead getTargetedEntity()
{
if (![Link]())
{
return null;
}
else if ([Link])
{
if ([Link] != null)
{
return [Link];
}
else
{
Entity entity =
[Link]([Link](ENTITY));
if (entity instanceof EntityVesselHead)
{
[Link] = (EntityVesselHead) entity;
return [Link];
}
else
{
return null;
}
}
}
else
{
return [Link];
}
}
public void move(MoverType type, double x, double y, double z)
{
[Link](type, x, y, z);
[Link]();
}
public void onUpdate() {
[Link]();
[Link](true);
if([Link]() != null &&
[Link]().ticksExisted >= 60 && [Link]){
[Link](0);
}
if([Link]()){
[Link]().setPath(null, 0);
[Link](true);
[Link](true);
if([Link] == -1F) {
[Link] = [Link];
[Link] = [Link];
}
[Link]([Link], [Link]);
}
else {
[Link](false);
[Link](false);
[Link] = -1F;
[Link] = -1F;
}
}
public void onLivingUpdate(){
[Link]();
if([Link]() && ![Link]){
[Link](true);
} else {
if(![Link]) {
[Link](false);
}
}
}
@Override
protected SoundEvent getSpellSound() {
return null;
}
protected boolean canDespawn()
{
return false;
}
protected int decreaseAirSupply(int air)
{
return air;
}
public void fall(float distance, float damageMultiplier)
{
}
public boolean attackEntityFrom(DamageSource source, float amount)
{
if ([Link](source) || [Link]())
{
return false;
}
else
{
return [Link](source, amount);
}
}
public void addPotionEffect(PotionEffect potioneffectIn)
{
}
class AISummonGhosts extends [Link]{
private AISummonGhosts(){
}
public boolean shouldExecute()
{
if (![Link]())
{
return false;
}
if([Link]()){
return false;
}
else
{
int i =
[Link]([Link],
[Link]().grow(16.0D)).size();
return [Link](7) + 1 > i;
}
}
@Override
protected void castSpell() {
for (int i = 0; i < 3; ++i) {
BlockPos blockpos = (new BlockPos([Link])).add(-2 +
[Link](5), 1, -2 + [Link](5));
EntityGhost ghost = new EntityGhost([Link]);
[Link](blockpos, 0.0F, 0.0F);
[Link]([Link](blockpos),
null);
[Link](ghost);
}
}
@Override
protected int getCastingTime() {
return 100;
}
@Override
protected int getCastingInterval() {
return 800;
}
@Nullable
@Override
protected SoundEvent getSpellPrepareSound() {
return SoundEvents.EVOCATION_ILLAGER_PREPARE_SUMMON;
}
@Override
protected SpellType getSpellType() {
return SpellType.SUMMON_VEX;
}
@Override
public void resetTask() {
[Link]();
[Link]([Link]);
}
}
class AIDuplicate extends [Link]{
private AIDuplicate(){
}
public boolean shouldExecute()
{
if (![Link]())
{
return false;
}
if([Link]() > ([Link]() /
2F)){
return false;
}
else
{
int i =
[Link]([Link],
[Link]().grow(16.0D)).size();
return [Link](12) + 1 > i;
}
}
@Override
protected void castSpell() {
for (int i = 0; i < 8; ++i) {
BlockPos blockpos = (new BlockPos([Link])).add(-2 +
[Link](5), 1, -2 + [Link](5));
EntityFakeDuplicate illusion = new
EntityFakeDuplicate([Link]);
[Link](blockpos, 0.0F, 0.0F);
[Link]([Link]);
[Link](400);
[Link]([Link](blockpos),
null);
[Link](illusion);
}
}
@Override
protected int getCastingTime() {
return 100;
}
@Override
protected int getCastingInterval() {
return 800;
}
@Nullable
@Override
protected SoundEvent getSpellPrepareSound() {
return SoundEvents.ENTITY_ILLAGER_PREPARE_MIRROR;
}
@Override
protected SpellType getSpellType() {
return [Link];
}
@Override
public void resetTask() {
[Link]();
[Link]([Link]);
}
}
class AIBallin extends [Link]{
private AIBallin(){
}
@Override
protected void castSpell() {
double d0 = 10D - [Link];
double d1 = [Link] + [Link];
double d2 = 10D - [Link];
float f = (float) MathHelper.atan2( 10.0F - [Link],
10.0F - [Link]);
for (int i = 0; i < 5; ++i) {
float f2 = f + (float)i * (float)[Link] * 0.6F + ((float)[Link] *
0.6F);
EntityBall ball = new EntityBall([Link],
[Link]);
[Link](d0 + (double)[Link](f2) * (i + 1 * 10000D), d1,
d2 + (double)[Link](f2) * (i + 1 * 10000D), 0.8F, 0.0F);
[Link]([Link](4));
if(![Link]) {
[Link](ball);
}
}
}
@Override
protected int getCastingTime() {
return 100;
}
@Override
protected int getCastingInterval() {
return 400;
}
@Nullable
@Override
protected SoundEvent getSpellPrepareSound() {
return SoundEvents.ENTITY_ILLAGER_PREPARE_MIRROR;
}
@Override
protected SpellType getSpellType() {
return [Link];
}
@Override
public void resetTask() {
[Link]();
[Link]([Link]);
}
}
class AIShootHead extends [Link]{
private AIShootHead(){
}
@Override
protected void castSpell() {
EntityLivingBase entitylivingbase =
[Link]();
if(entitylivingbase != null) {
double d1 = [Link] - [Link];
double d2 = [Link]().minY + (double)
([Link] / 2.0F) - ([Link] + (double)
([Link] / 2.0F));
double d3 = [Link] - [Link];
EntityVesselHead vesselHead = new EntityVesselHead(world,
[Link], d1, d2, d3);
[Link]([Link],
[Link] + [Link](), [Link]);
[Link]([Link]());
[Link](vesselHead);
}
}
@Override
protected int getCastingTime() {
return 100;
}
@Override
protected int getCastingInterval() {
return 200;
}
@Nullable
@Override
protected SoundEvent getSpellPrepareSound() {
return null;
}
@Override
protected SpellType getSpellType() {
return SpellType.SUMMON_VEX;
}
@Override
public void resetTask() {
[Link]();
[Link]([Link]);
}
}
public void notifyDataManagerChange(DataParameter<?> key)
{
[Link](key);
if ([Link](key))
{
[Link] = null;
}
}
public float getEyeHeight()
{
return 0.9F;
}
public void setInactive(boolean i){
[Link](INACTIVE, i);
}
public boolean isInactive(){
return [Link](INACTIVE);
}
public void writeEntityToNBT(NBTTagCompound compound) {
[Link](compound);
[Link]("Inactive", [Link]());
}
public void readEntityFromNBT(NBTTagCompound compound) {
[Link](compound);
[Link]([Link]("Inactive"));
}
@Override
@Nullable
protected ResourceLocation getLootTable() { return LOOT; }
@Override
protected SoundEvent getAmbientSound() { return ModSounds.VESSEL_IDLE; }
@Override
protected SoundEvent getHurtSound(DamageSource damageSourceIn) { return
ModSounds.VESSEL_HURT; }
@Override
protected SoundEvent getDeathSound() { return ModSounds.VESSEL_DEATH; }
protected float getSoundVolume()
{
return 0.5F;
}
}