Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package com.typewritermc.entity.entries.entity.minecraft

import com.github.retrooper.packetevents.protocol.entity.type.EntityTypes
import com.typewritermc.core.books.pages.Colors
import com.typewritermc.core.entries.Ref
import com.typewritermc.core.entries.emptyRef
import com.typewritermc.core.extension.annotations.Entry
import com.typewritermc.core.extension.annotations.OnlyTags
import com.typewritermc.core.extension.annotations.Tags
import com.typewritermc.core.utils.point.Position
import com.typewritermc.engine.paper.entry.entity.FakeEntity
import com.typewritermc.engine.paper.entry.entity.SimpleEntityDefinition
import com.typewritermc.engine.paper.entry.entity.SimpleEntityInstance
import com.typewritermc.engine.paper.entry.entries.*
import com.typewritermc.engine.paper.utils.Sound
import com.typewritermc.entity.entries.data.minecraft.applyGenericEntityData
import com.typewritermc.entity.entries.data.minecraft.living.AgeableProperty
import com.typewritermc.entity.entries.data.minecraft.living.applyAgeableData
import com.typewritermc.entity.entries.data.minecraft.living.applyLivingEntityData
import com.typewritermc.entity.entries.entity.WrapperFakeEntity
import org.bukkit.entity.Player

@Entry("camel_definition", "A camel entity", Colors.ORANGE, "hugeicons:camel")
@Tags("camel_definition")
/**
* The `CamelDefinition` class is an entry that shows up as a camel in-game.
*
* ## How could this be used?
* This could be used to create a camel entity.
*/
class CamelDefinition(
override val id: String = "",
override val name: String = "",
override val displayName: Var<String> = ConstVar(""),
override val sound: Sound = Sound.EMPTY,
@OnlyTags("generic_entity_data", "living_entity_data", "mob_data", "ageable_data", "camel_data")
override val data: List<Ref<EntityData<*>>> = emptyList(),
) : SimpleEntityDefinition {
override fun create(player: Player): FakeEntity = CamelEntity(player)
}

@Entry("camel_instance", "An instance of a camel entity", Colors.YELLOW, "hugeicons:camel")
class CamelInstance(
override val id: String = "",
override val name: String = "",
override val definition: Ref<CamelDefinition> = emptyRef(),
override val spawnLocation: Position = Position.ORIGIN,
@OnlyTags("generic_entity_data", "living_entity_data", "mob_data", "ageable_data", "camel_data")
override val data: List<Ref<EntityData<*>>> = emptyList(),
override val activity: Ref<out SharedEntityActivityEntry> = emptyRef(),
) : SimpleEntityInstance
private class CamelEntity(player: Player) : WrapperFakeEntity(
EntityTypes.CAMEL,
player,
) {
override fun applyProperty(property: EntityProperty) {
when (property) {
is AgeableProperty -> applyAgeableData(entity, property)
else -> {}
}
if (applyGenericEntityData(entity, property)) return
if (applyLivingEntityData(entity, property)) return
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.typewritermc.entity.entries.entity.minecraft

import com.github.retrooper.packetevents.protocol.entity.type.EntityTypes
import com.typewritermc.core.books.pages.Colors
import com.typewritermc.core.entries.Ref
import com.typewritermc.core.entries.emptyRef
import com.typewritermc.core.extension.annotations.Entry
import com.typewritermc.core.extension.annotations.OnlyTags
import com.typewritermc.core.extension.annotations.Tags
import com.typewritermc.core.utils.point.Position
import com.typewritermc.engine.paper.entry.entity.FakeEntity
import com.typewritermc.engine.paper.entry.entity.SimpleEntityDefinition
import com.typewritermc.engine.paper.entry.entity.SimpleEntityInstance
import com.typewritermc.engine.paper.entry.entries.*
import com.typewritermc.engine.paper.utils.Sound
import com.typewritermc.entity.entries.data.minecraft.applyGenericEntityData
import com.typewritermc.entity.entries.data.minecraft.living.AgeableProperty
import com.typewritermc.entity.entries.data.minecraft.living.applyAgeableData
import com.typewritermc.entity.entries.data.minecraft.living.applyLivingEntityData
import com.typewritermc.entity.entries.entity.WrapperFakeEntity
import org.bukkit.entity.Player

@Entry("donkey_definition", "A donkey entity", Colors.ORANGE, "healthicons:animal-donkey-outline")
@Tags("donkey_definition")
/**
* The `DonkeyDefinition` class is an entry that shows up as a donkey in-game.
*
* ## How could this be used?
* This could be used to create a donkey entity.
*/
class DonkeyDefinition(
override val id: String = "",
override val name: String = "",
override val displayName: Var<String> = ConstVar(""),
override val sound: Sound = Sound.EMPTY,
@OnlyTags("generic_entity_data", "living_entity_data", "mob_data", "ageable_data", "donkey_data")
override val data: List<Ref<EntityData<*>>> = emptyList(),
) : SimpleEntityDefinition {
override fun create(player: Player): FakeEntity = DonkeyEntity(player)
}

@Entry("donkey_instance", "An instance of a donkey entity", Colors.YELLOW, "healthicons:animal-donkey-outline")
class DonkeyInstance(
override val id: String = "",
override val name: String = "",
override val definition: Ref<DonkeyDefinition> = emptyRef(),
override val spawnLocation: Position = Position.ORIGIN,
@OnlyTags("generic_entity_data", "living_entity_data", "mob_data", "ageable_data", "donkey_data")
override val data: List<Ref<EntityData<*>>> = emptyList(),
override val activity: Ref<out SharedEntityActivityEntry> = emptyRef(),
) : SimpleEntityInstance
private class DonkeyEntity(player: Player) : WrapperFakeEntity(
EntityTypes.DONKEY,
player,
) {
override fun applyProperty(property: EntityProperty) {
if (applyGenericEntityData(entity, property)) return
if (applyLivingEntityData(entity, property)) return
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package com.typewritermc.entity.entries.entity.minecraft

import com.github.retrooper.packetevents.protocol.entity.type.EntityTypes
import com.typewritermc.core.books.pages.Colors
import com.typewritermc.core.entries.Ref
import com.typewritermc.core.entries.emptyRef
import com.typewritermc.core.extension.annotations.Entry
import com.typewritermc.core.extension.annotations.OnlyTags
import com.typewritermc.core.extension.annotations.Tags
import com.typewritermc.core.utils.point.Position
import com.typewritermc.engine.paper.entry.entity.FakeEntity
import com.typewritermc.engine.paper.entry.entity.SimpleEntityDefinition
import com.typewritermc.engine.paper.entry.entity.SimpleEntityInstance
import com.typewritermc.engine.paper.entry.entries.*
import com.typewritermc.engine.paper.utils.Sound
import com.typewritermc.entity.entries.data.minecraft.applyGenericEntityData
import com.typewritermc.entity.entries.data.minecraft.living.AgeableProperty
import com.typewritermc.entity.entries.data.minecraft.living.applyAgeableData
import com.typewritermc.entity.entries.data.minecraft.living.applyLivingEntityData
import com.typewritermc.entity.entries.entity.WrapperFakeEntity
import org.bukkit.entity.Player

@Entry("pig_definition", "A pig entity", Colors.ORANGE, "icon-park-solid:pig")
@Tags("pig_definition")
/**
* The `PigDefinition` class is an entry that shows up as a pig in-game.
*
* ## How could this be used?
* This could be used to create a pig entity.
*/
class PigDefinition(
override val id: String = "",
override val name: String = "",
override val displayName: Var<String> = ConstVar(""),
override val sound: Sound = Sound.EMPTY,
@OnlyTags("generic_entity_data", "living_entity_data", "mob_data", "ageable_data", "pig_data")
override val data: List<Ref<EntityData<*>>> = emptyList(),
) : SimpleEntityDefinition {
override fun create(player: Player): FakeEntity = PigEntity(player)
}

@Entry("pig_instance", "An instance of a pig entity", Colors.YELLOW, "icon-park-solid:pig")
class PigInstance(
override val id: String = "",
override val name: String = "",
override val definition: Ref<PigDefinition> = emptyRef(),
override val spawnLocation: Position = Position.ORIGIN,
@OnlyTags("generic_entity_data", "living_entity_data", "mob_data", "ageable_data", "pig_data")
override val data: List<Ref<EntityData<*>>> = emptyList(),
override val activity: Ref<out SharedEntityActivityEntry> = emptyRef(),
) : SimpleEntityInstance
private class PigEntity(player: Player) : WrapperFakeEntity(
EntityTypes.PIG,
player,
) {
override fun applyProperty(property: EntityProperty) {
when (property) {
is AgeableProperty -> applyAgeableData(entity, property)
else -> {}
}
if (applyGenericEntityData(entity, property)) return
if (applyLivingEntityData(entity, property)) return
}
}
Loading