Last active
August 15, 2019 11:26
-
-
Save arjolpanci/71230de0484594007d24cf52dd694e2e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package teabx.vanillaextended.entities; | |
import net.minecraft.entity.EntityType; | |
import net.minecraft.entity.ILivingEntityData; | |
import net.minecraft.entity.SharedMonsterAttributes; | |
import net.minecraft.entity.SpawnReason; | |
import net.minecraft.entity.ai.goal.*; | |
import net.minecraft.entity.monster.MonsterEntity; | |
import net.minecraft.entity.player.PlayerEntity; | |
import net.minecraft.nbt.CompoundNBT; | |
import net.minecraft.util.DamageSource; | |
import net.minecraft.world.DifficultyInstance; | |
import net.minecraft.world.IWorld; | |
import net.minecraft.world.World; | |
import net.minecraft.world.chunk.Chunk; | |
import javax.annotation.Nullable; | |
public class LostMiner extends MonsterEntity { | |
public LostMiner(EntityType<? extends MonsterEntity> type, World world) { | |
super((EntityType<? extends MonsterEntity>) EntityRegistry.LOST_MINER, world); | |
} | |
@Override | |
public boolean canSpawn(IWorld worldIn, SpawnReason spawnReasonIn) { | |
if(worldIn.getLight(this.getPosition()) > 7 || this.posY > 40.0D){ | |
return false; | |
} | |
return true; | |
} | |
@Override | |
protected void registerGoals() { | |
this.goalSelector.addGoal(0, new SwimGoal(this)); | |
this.goalSelector.addGoal(8, new RandomWalkingGoal(this, 1.0D)); | |
this.goalSelector.addGoal(8, new LookAtGoal(this, PlayerEntity.class, 8.0F)); | |
this.goalSelector.addGoal(8, new LookRandomlyGoal(this)); | |
this.goalSelector.addGoal(6, new WaterAvoidingRandomWalkingGoal(this, 1.0D)); | |
this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, true)); | |
} | |
@Override | |
protected void registerAttributes() { | |
super.registerAttributes(); | |
this.getAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(35.0D); | |
this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue((double)1.0F); | |
this.getAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(3.0D); | |
this.getAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(2.0D); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment