Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/runConfigurations/MainKt.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/main/kotlin/io/github/dockyardmc/entity/Entity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
val stuckArrows: Bindable<Int> = bindablePool.provideBindable(0)
var gravityTickCount = 0

val maxHealth get() = health.defaultValue

val potionEffects: BindableMap<PotionEffect, AppliedPotionEffect> = bindablePool.provideBindableMap()
val isInvisible: Bindable<Boolean> = bindablePool.provideBindable(false)
val isGlowing: Bindable<Boolean> = bindablePool.provideBindable(false)
Expand Down Expand Up @@ -193,6 +195,11 @@
teleport(newLoc)
}

open fun lookAt(targetLocation: Location) {
val newLoc = this.location.setDirection(targetLocation.toVector3d() - (this.location).toVector3d())

Check warning on line 199 in src/main/kotlin/io/github/dockyardmc/entity/Entity.kt

View check run for this annotation

codefactor.io / CodeFactor

src/main/kotlin/io/github/dockyardmc/entity/Entity.kt#L199

Parentheses in (this.location) are unnecessary and can be replaced with: this.location. (detekt.UnnecessaryParentheses)
teleport(newLoc)
}

open fun lookAtClientside(target: Entity, player: Player) {
lookAtClientside(target, listOf(player))
}
Expand Down
119 changes: 0 additions & 119 deletions src/main/kotlin/io/github/dockyardmc/entity/TestZombie.kt

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/kotlin/io/github/dockyardmc/entity/Warden.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import io.github.dockyardmc.protocol.packets.play.clientbound.EntityEvent
import io.github.dockyardmc.registry.EntityTypes
import io.github.dockyardmc.registry.registries.EntityType

open class Warden(location: Location): Entity(location) {
open class Warden(location: Location) : Entity(location) {
override var type: EntityType = EntityTypes.WARDEN
override val health: Bindable<Float> = Bindable(500f)
override var inventorySize: Int = 0
Expand All @@ -27,7 +27,7 @@ open class Warden(location: Location): Entity(location) {

fun playAnimation(animation: WardenAnimation) {

when(animation) {
when (animation) {
WardenAnimation.EMERGE -> pose.value = EntityPose.EMERGING
WardenAnimation.ROAR -> pose.value = EntityPose.ROARING
WardenAnimation.SNIFF -> pose.value = EntityPose.SNIFFING
Expand Down
33 changes: 33 additions & 0 deletions src/main/kotlin/io/github/dockyardmc/entity/Zombie.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package io.github.dockyardmc.entity

import cz.lukynka.bindables.Bindable
import io.github.dockyardmc.entity.metadata.EntityMetaValue
import io.github.dockyardmc.entity.metadata.EntityMetadata
import io.github.dockyardmc.entity.metadata.EntityMetadataType
import io.github.dockyardmc.location.Location
import io.github.dockyardmc.protocol.packets.play.clientbound.ClientboundPlayerAnimationPacket
import io.github.dockyardmc.protocol.packets.play.clientbound.EntityAnimation
import io.github.dockyardmc.registry.EntityTypes
import io.github.dockyardmc.registry.registries.EntityType

open class Zombie(location: Location) : Entity(location) {
override var type: EntityType = EntityTypes.ZOMBIE
override val health: Bindable<Float> = bindablePool.provideBindable(20f)
override var inventorySize: Int = 0

val raisedArms: Bindable<Boolean> = bindablePool.provideBindable(false)

fun swingHands() {
this.sendPacketToViewers(ClientboundPlayerAnimationPacket(this, EntityAnimation.SWING_MAIN_ARM))
}

init {
raisedArms.valueChanged { event ->
if (event.newValue) {
this.metadata[EntityMetadataType.ZOMBIE_RAISED_ARMS] = EntityMetadata(EntityMetadataType.ZOMBIE_RAISED_ARMS, EntityMetaValue.BYTE, 0x0)
} else {
this.metadata.remove(EntityMetadataType.ZOMBIE_RAISED_ARMS)
}
}
}
}
124 changes: 0 additions & 124 deletions src/main/kotlin/io/github/dockyardmc/entity/ai/AIManager.kt

This file was deleted.

Loading
Loading