beep
This commit is contained in:
parent
7a7139c48c
commit
2d5858bd29
@ -6,6 +6,7 @@ import net.minecraft.network.syncher.EntityDataSerializers
|
||||
import net.minecraft.network.syncher.SynchedEntityData
|
||||
import net.minecraft.server.level.ServerBossEvent
|
||||
import net.minecraft.server.level.ServerLevel
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.sounds.SoundEvent
|
||||
import net.minecraft.sounds.SoundEvents
|
||||
import net.minecraft.sounds.SoundSource
|
||||
@ -33,12 +34,9 @@ import net.minecraft.world.entity.projectile.SmallFireball
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.phys.Vec3
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.isFire
|
||||
import ru.dbotthepony.mc.otm.registry.MNames
|
||||
import ru.dbotthepony.mc.otm.registry.game.MSoundEvents
|
||||
import java.util.*
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
||||
val idleState = AnimationState()
|
||||
@ -75,7 +73,6 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
||||
return entityData.get(IS_CHARGING)
|
||||
}
|
||||
|
||||
|
||||
override fun registerGoals() {
|
||||
goalSelector.addGoal(7, LookAtPlayerGoal(this, Player::class.java, 8f))
|
||||
goalSelector.addGoal(3, NearestAttackableTargetGoal(this, LivingEntity::class.java, 10, true, true) { entity ->
|
||||
@ -89,6 +86,7 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
||||
goalSelector.addGoal(2, RammingGoal(this))
|
||||
goalSelector.addGoal(2, StayNearGoal(this))
|
||||
goalSelector.addGoal(2, BlazeFireballGoal(this))
|
||||
|
||||
targetSelector.addGoal(1, HurtByTargetGoal(this))
|
||||
}
|
||||
|
||||
@ -98,7 +96,7 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun getHurtSound(damageSource: net.minecraft.world.damagesource.DamageSource): SoundEvent {
|
||||
override fun getHurtSound(damageSource: DamageSource): SoundEvent {
|
||||
return SoundEvents.HEAVY_CORE_BREAK
|
||||
}
|
||||
|
||||
@ -108,25 +106,20 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
||||
|
||||
//fire inv
|
||||
//there should be a better way
|
||||
override fun isInvulnerableTo(source: DamageSource): Boolean {
|
||||
return source.isFire || super.isInvulnerableTo(source)
|
||||
}
|
||||
|
||||
override fun hurt(source: DamageSource, amount: Float): Boolean {
|
||||
if (source.isFire) return false
|
||||
return super.hurt(source, amount)
|
||||
override fun fireImmune(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
///boss healthbar
|
||||
private val bossEvent: ServerBossEvent =
|
||||
ServerBossEvent(TranslatableComponent(MNames.ENFORCER), BossEvent.BossBarColor.RED, BossEvent.BossBarOverlay.PROGRESS)
|
||||
|
||||
override fun startSeenByPlayer(player: net.minecraft.server.level.ServerPlayer) {
|
||||
override fun startSeenByPlayer(player: ServerPlayer) {
|
||||
super.startSeenByPlayer(player)
|
||||
bossEvent.addPlayer(player)
|
||||
}
|
||||
|
||||
override fun stopSeenByPlayer(player: net.minecraft.server.level.ServerPlayer) {
|
||||
override fun stopSeenByPlayer(player: ServerPlayer) {
|
||||
super.stopSeenByPlayer(player)
|
||||
bossEvent.removePlayer(player)
|
||||
}
|
||||
@ -134,9 +127,13 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
||||
override fun aiStep() {
|
||||
super.aiStep()
|
||||
bossEvent.progress = this.health / this.maxHealth
|
||||
|
||||
if (!this.isOnFire) {
|
||||
this.clearFire()
|
||||
}
|
||||
}
|
||||
|
||||
override fun die(cause: net.minecraft.world.damagesource.DamageSource) {
|
||||
override fun die(cause: DamageSource) {
|
||||
super.die(cause)
|
||||
bossEvent.removeAllPlayers()
|
||||
}
|
||||
@ -198,7 +195,7 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
||||
level().addFreshEntity(fireball)
|
||||
}
|
||||
|
||||
//charge attack, could possibly leave a smoke trail too idk
|
||||
//charge attack
|
||||
class RammingGoal(private val mob: Enforcer) : Goal() {
|
||||
private var target: LivingEntity? = null
|
||||
|
||||
@ -211,7 +208,7 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
||||
private val maxChargeTime = 40
|
||||
private var chargeDir: Vec3? = null
|
||||
private var cooldown = 0
|
||||
private val minCooldown = 20
|
||||
private val minCooldown = 35
|
||||
private val maxCooldown = 60
|
||||
private var isCharging = false
|
||||
|
||||
@ -281,7 +278,7 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
||||
stop()
|
||||
return
|
||||
}
|
||||
mob.playSound(MSoundEvents.ANDROID_JUMP_BOOST, 1.0f, 1.0f)
|
||||
mob.playSound(MSoundEvents.ENFORCER_CHARGE, 1.0f, 1.0f)
|
||||
}
|
||||
|
||||
val dir = chargeDir ?: return
|
||||
@ -310,7 +307,7 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
||||
|
||||
target.push(knockback.x, 0.5, knockback.z)
|
||||
|
||||
val damageAmount = 10.0f
|
||||
val damageAmount = 14.0f
|
||||
target.hurt(mob.damageSources().mobAttack(mob), damageAmount)
|
||||
|
||||
stop()
|
||||
@ -400,6 +397,12 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
||||
if (fireTick > 0){
|
||||
fireTick --
|
||||
|
||||
|
||||
if (fireTick >= 19){
|
||||
mob.playSound(MSoundEvents.ENFORCER_BEEP, 1.0f, 1.0f)
|
||||
}
|
||||
|
||||
|
||||
if (fireTick == 15){
|
||||
mob.shootFireball(0.5f)
|
||||
//could have a better firing sound
|
||||
|
@ -28,6 +28,8 @@ object MSoundEvents {
|
||||
val LOADER_AMBIENT by make("loader_ambient")
|
||||
|
||||
val ENFORCER_ALERT by make("enforcer_alert")
|
||||
val ENFORCER_CHARGE by make("enforcer_charge")
|
||||
val ENFORCER_BEEP by make("enforcer_beep")
|
||||
|
||||
fun register(bus: IEventBus) {
|
||||
registry.register(bus)
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user