Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into light-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriTimoz committed Nov 13, 2023
2 parents adfd07f + 4bf53ad commit 9a43a43
Show file tree
Hide file tree
Showing 96 changed files with 1,696 additions and 362 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Run TODO to Issue"
on: ["push"]
jobs:
build:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- name: "TODO to Issue"
uses: "alstr/todo-to-issue-action@v4"
with:
IDENTIFIERS: '[{"name": "TODO", "labels": []}, {"name": "FIXME", "labels": ["bug"]}]'
ISSUE_TEMPLATE: "{{ title }}\n\n{{ body }}\n\n{{ url }}\n\n"
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ members = [
"minecraft-protocol",
"minecraft-protocol-derive",
"minecraft-server",
"minecraft-entities",
"minecraft-positions",
"tags-macros"
]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "minecraft-server-derive"
name = "minecraft-entities-derive"
version = "0.1.0"
edition = "2021"

Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions minecraft-entities/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "minecraft-entities"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
minecraft-protocol = { path = "../minecraft-protocol" }
minecraft-positions = { path = "../minecraft-positions" }
minecraft-entities-derive = { path="../minecraft-entities-derive" }
10 changes: 10 additions & 0 deletions minecraft-entities/src/animals/axolotl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use super::*;

#[derive(Default)]
#[inherit(Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Axolotl {
pub animal: Animal,
pub variant: u8,
pub playing_dead: bool,
pub spawn_from_bucket: bool,
}
9 changes: 9 additions & 0 deletions minecraft-entities/src/animals/bee.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use super::*;

#[derive(Default)]
#[inherit(Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Bee {
pub animal: Animal,
pub flag: u8,
pub anger_time: usize,
}
22 changes: 22 additions & 0 deletions minecraft-entities/src/animals/cat.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use super::*;

#[inherit(TameableAnimal, Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Cat {
pub tameable_animal: TameableAnimal,
pub variant: u8,
pub is_lying: bool,
pub is_relaxed: bool,
pub collar_color: u8,
}

impl Default for Cat {
fn default() -> Self {
Self {
tameable_animal: Default::default(),
variant: 0,
is_lying: false,
is_relaxed: false,
collar_color: 14,
}
}
}
7 changes: 7 additions & 0 deletions minecraft-entities/src/animals/chicken.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use super::*;

#[derive(Default)]
#[inherit(Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Chicken {
pub animal: Animal,
}
16 changes: 16 additions & 0 deletions minecraft-entities/src/animals/cow.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use super::*;

#[derive(Default)]
#[inheritable]
#[inherit(Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Cow {
pub animal: Animal,
}

#[derive(Default)]
#[inherit(Cow, Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]

pub struct Mooshroom {
pub cow: Cow,
pub variant: u8, // In the doc it is a string
}
7 changes: 7 additions & 0 deletions minecraft-entities/src/animals/donkey.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use super::*;

#[derive(Default)]
#[inherit(ChestedHorse, AbstractHorse, Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Donkey {
pub chested_horse: ChestedHorse,
}
42 changes: 42 additions & 0 deletions minecraft-entities/src/animals/fishes.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
use super::*;

#[derive(Default)]
#[inheritable]
#[inherit(WaterAnimal, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct AbstractFish {
pub water_animal: WaterAnimal,
pub from_bucket: bool,
}


#[derive(Default)]
#[inherit(AbstractFish, WaterAnimal, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Cod {
pub abstract_fish: AbstractFish,
}

#[derive(Default)]
#[inherit(AbstractFish, WaterAnimal, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct PufferFish {
pub abstract_fish: AbstractFish,
pub puff_state: usize,
}

#[derive(Default)]
#[inherit(AbstractFish, WaterAnimal, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Salmon {
pub abstract_fish: AbstractFish,
}

#[derive(Default)]
#[inherit(AbstractFish, WaterAnimal, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct TropicalFish {
pub abstract_fish: AbstractFish,
pub variant: usize,
}

#[derive(Default)]
#[inherit(AbstractFish, WaterAnimal, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Tadpole {
pub abstract_fish: AbstractFish,
}
12 changes: 12 additions & 0 deletions minecraft-entities/src/animals/fox.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use minecraft_protocol::packets::UUID;
use super::*;

#[derive(Default)]
#[inherit(Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Fox {
pub animal: Animal,
pub variant: u8,
pub mask: u8,
pub first_uuid: Option<UUID>,
pub second_uuid: Option<UUID>,
}
10 changes: 10 additions & 0 deletions minecraft-entities/src/animals/frog.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use minecraft_protocol::packets::UUID;
use super::*;

#[derive(Default)]
#[inherit(Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Frog {
pub animal: Animal,
pub variant: u8,
pub tongue_target: Option<usize>,
}
20 changes: 20 additions & 0 deletions minecraft-entities/src/animals/goat.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use super::*;

#[inherit(Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Goat {
pub animal: Animal,
pub is_screaming: bool,
pub has_left_horn: bool,
pub has_right_horn: bool,
}

impl Default for Goat {
fn default() -> Self {
Self {
animal: Animal::default(),
is_screaming: false,
has_left_horn: true,
has_right_horn: true,
}
}
}
9 changes: 9 additions & 0 deletions minecraft-entities/src/animals/hoglin.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use minecraft_protocol::packets::UUID;
use super::*;

#[derive(Default)]
#[inherit(Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Hoglin {
pub animal: Animal,
pub is_immune: bool,
}
51 changes: 51 additions & 0 deletions minecraft-entities/src/animals/horses.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
use super::*;

#[derive(Default)]
#[inheritable]
#[inherit(Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct AbstractHorse {
pub animal: Animal,
pub mask: u8,
}

#[derive(Default)]
#[inherit(AbstractHorse, Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Horse {
pub abstract_horse: AbstractHorse,
pub variant: usize,
}

#[derive(Default)]
#[inherit(AbstractHorse, Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct ZombieHorse {
pub abstract_horse: AbstractHorse,
}

#[derive(Default)]
#[inherit(AbstractHorse, Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct SkeletonHorse {
pub abstract_horse: AbstractHorse,
}

#[derive(Default)]
#[inherit(AbstractHorse, Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Camel {
pub abstract_horse: AbstractHorse,
pub is_dashing: bool,
pub last_pose_change_tick: usize,
}

#[derive(Default)]
#[inheritable]
#[inherit(AbstractHorse, Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct ChestedHorse {
pub abstract_horse: AbstractHorse,
pub has_chest: bool,
}

#[derive(Default)]
#[inheritable]
#[inherit(ChestedHorse, AbstractHorse, Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Mule {
pub chested_horse: ChestedHorse,
}
36 changes: 36 additions & 0 deletions minecraft-entities/src/animals/llama.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use super::*;

#[inheritable]
#[inherit(ChestedHorse, AbstractHorse, Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Llama {
pub chested_horse: ChestedHorse,
/// Strength (number of columns of 3 slots in the llama's inventory once a chest is equipped)
pub stength: u8,
/// Carpet color (a dye color, or -1 if no carpet equipped)
pub carpet_color: i16,
pub variant: u8,
}

impl Default for Llama {
fn default() -> Self {
Self {
chested_horse: ChestedHorse::default(),
stength: 0,
carpet_color: -1,
variant: 0,
}
}
}

#[derive(Default)]
#[inherit(Llama, ChestedHorse, AbstractHorse, Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct TraderLlama {
pub llama: Llama,
}


#[derive(Default)]
#[inherit(Entity)]
pub struct LlamaSpit {
pub entity: Entity,
}
68 changes: 68 additions & 0 deletions minecraft-entities/src/animals/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
use super::*;

mod sniffer;
pub use sniffer::*;
mod horses;
pub use horses::*;
mod donkey;
pub use donkey::*;
mod llama;
pub use llama::*;
mod axolotl;
pub use axolotl::*;
mod bee;
pub use bee::*;
mod fox;
pub use fox::*;
mod frog;
pub use frog::*;
mod ocelot;
pub use ocelot::*;
mod panda;
pub use panda::*;
mod pig;
pub use pig::*;
mod rabbit;
pub use rabbit::*;
mod turtle;
pub use turtle::*;
mod polar_bear;
pub use polar_bear::*;
mod chicken;
pub use chicken::*;
mod cow;
pub use cow::*;
mod hoglin;
pub use hoglin::*;
mod sheep;
pub use sheep::*;
mod strider;
pub use strider::*;
mod cat;
pub use cat::*;
mod wolf;
pub use wolf::*;
mod parrot;
pub use parrot::*;
mod goat;
pub use goat::*;
mod fishes;
pub use fishes::*;
mod water_animal;
pub use water_animal::*;

#[derive(Default)]
#[inheritable]
#[inherit(AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Animal {
pub ageable_mob: AgeableMob,
}

#[derive(Default)]
#[inheritable]
#[inherit(Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct TameableAnimal {
pub animal: Animal,
pub action_mask: u8,
pub owner: Option<UUID>,
}
9 changes: 9 additions & 0 deletions minecraft-entities/src/animals/ocelot.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use minecraft_protocol::packets::UUID;
use super::*;

#[derive(Default)]
#[inherit(Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Ocelot {
pub animal: Animal,
pub is_trusting: bool,
}
14 changes: 14 additions & 0 deletions minecraft-entities/src/animals/panda.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use minecraft_protocol::packets::UUID;
use super::*;

#[derive(Default)]
#[inherit(Animal, AgeableMob, PathfinderMob, Mob, LivingEntity, Entity)]
pub struct Panda {
pub animal: Animal,
pub breed_timer: u16,
pub sneeze_timer: u16,
pub eat_timer: u16,
pub main_gene: u8,
pub hidden_gene: u8,
pub action_mask: u8,
}
Loading

0 comments on commit 9a43a43

Please sign in to comment.