-
-
Notifications
You must be signed in to change notification settings - Fork 95
[Entity] Add new entities to the EntityExtension #368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7492d65
Add Camel, Donkey and PigEntity
Marten-Mrfc 3b8ed5b
Add agable data to donkey
Marten-Mrfc 2a2befc
Merge branch 'develop' into features/entities
Marten-Mrfc 7f9d0d3
[AI] Add entity copilot instructions
Marten-Mrfc a09fe05
[Entity] Update Camel, Pig, Donkey
Marten-Mrfc 56f10ab
[Entity] Add panda entity
Marten-Mrfc 1b6bd1a
[Entity] Add goat entity
Marten-Mrfc 293ce7b
[Entity] Add polarbear entity
Marten-Mrfc 36dbd4a
[entity] Add sniffer entity
Marten-Mrfc 4c8dd56
Add panda pose data
Marten-Mrfc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
...Extension/src/main/kotlin/com/typewritermc/entity/entries/entity/minecraft/CamelEntity.kt
This file contains hidden or 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
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 | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...xtension/src/main/kotlin/com/typewritermc/entity/entries/entity/minecraft/DonkeyEntity.kt
This file contains hidden or 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
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 | ||
Marten-Mrfc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
64 changes: 64 additions & 0 deletions
64
...tyExtension/src/main/kotlin/com/typewritermc/entity/entries/entity/minecraft/PigEntity.kt
This file contains hidden or 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
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 | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.