aboutsummaryrefslogtreecommitdiff
path: root/azalea/src
diff options
context:
space:
mode:
Diffstat (limited to 'azalea/src')
-rw-r--r--azalea/src/auto_tool.rs4
-rw-r--r--azalea/src/container.rs16
-rw-r--r--azalea/src/pathfinder/mod.rs15
-rw-r--r--azalea/src/pathfinder/simulation.rs10
4 files changed, 16 insertions, 29 deletions
diff --git a/azalea/src/auto_tool.rs b/azalea/src/auto_tool.rs
index 77345acc..e5a627ba 100644
--- a/azalea/src/auto_tool.rs
+++ b/azalea/src/auto_tool.rs
@@ -1,5 +1,5 @@
use azalea_block::{Block, BlockState};
-use azalea_client::{inventory::InventoryComponent, Client};
+use azalea_client::{inventory::Inventory, Client};
use azalea_entity::{FluidOnEyes, Physics};
use azalea_inventory::{ItemSlot, Menu};
use azalea_registry::{DataComponentKind, Fluid};
@@ -18,7 +18,7 @@ impl AutoToolClientExt for Client {
fn best_tool_in_hotbar_for_block(&self, block: BlockState) -> BestToolResult {
let mut ecs = self.ecs.lock();
let (inventory, physics, fluid_on_eyes) =
- self.query::<(&InventoryComponent, &Physics, &FluidOnEyes)>(&mut ecs);
+ self.query::<(&Inventory, &Physics, &FluidOnEyes)>(&mut ecs);
let menu = &inventory.inventory_menu;
accurate_best_tool_in_hotbar_for_block(block, menu, physics, fluid_on_eyes)
diff --git a/azalea/src/container.rs b/azalea/src/container.rs
index c354390e..c9283b6b 100644
--- a/azalea/src/container.rs
+++ b/azalea/src/container.rs
@@ -1,7 +1,7 @@
use std::fmt::Formatter;
use azalea_client::{
- inventory::{CloseContainerEvent, ContainerClickEvent, InventoryComponent},
+ inventory::{CloseContainerEvent, ContainerClickEvent, Inventory},
packet_handling::game::PacketEvent,
Client,
};
@@ -65,9 +65,7 @@ impl ContainerClientExt for Client {
}
let ecs = self.ecs.lock();
- let inventory = ecs
- .get::<InventoryComponent>(self.entity)
- .expect("no inventory");
+ let inventory = ecs.get::<Inventory>(self.entity).expect("no inventory");
if inventory.id == 0 {
None
} else {
@@ -87,9 +85,7 @@ impl ContainerClientExt for Client {
/// and [`Menu::slots`].
fn open_inventory(&mut self) -> Option<ContainerHandle> {
let ecs = self.ecs.lock();
- let inventory = ecs
- .get::<InventoryComponent>(self.entity)
- .expect("no inventory");
+ let inventory = ecs.get::<Inventory>(self.entity).expect("no inventory");
if inventory.id == 0 {
Some(ContainerHandle::new(0, self.clone()))
@@ -105,9 +101,7 @@ impl ContainerClientExt for Client {
/// your own inventory.
fn get_open_container(&self) -> Option<ContainerHandleRef> {
let ecs = self.ecs.lock();
- let inventory = ecs
- .get::<InventoryComponent>(self.entity)
- .expect("no inventory");
+ let inventory = ecs.get::<Inventory>(self.entity).expect("no inventory");
if inventory.id == 0 {
None
@@ -157,7 +151,7 @@ impl ContainerHandleRef {
pub fn menu(&self) -> Option<Menu> {
let ecs = self.client.ecs.lock();
let inventory = ecs
- .get::<InventoryComponent>(self.client.entity)
+ .get::<Inventory>(self.client.entity)
.expect("no inventory");
// this also makes sure we can't access the inventory while a container is open
diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs
index becc163d..cb6ba2bb 100644
--- a/azalea/src/pathfinder/mod.rs
+++ b/azalea/src/pathfinder/mod.rs
@@ -25,7 +25,7 @@ use crate::ecs::{
};
use crate::pathfinder::moves::PathfinderCtx;
use crate::pathfinder::world::CachedWorld;
-use azalea_client::inventory::{InventoryComponent, InventorySet, SetSelectedHotbarSlotEvent};
+use azalea_client::inventory::{Inventory, InventorySet, SetSelectedHotbarSlotEvent};
use azalea_client::mining::{Mining, StartMiningBlockEvent};
use azalea_client::movement::MoveEventsSet;
use azalea_client::{InstanceHolder, StartSprintEvent, StartWalkEvent};
@@ -201,7 +201,7 @@ fn goto_listener(
Option<&ExecutingPath>,
&Position,
&InstanceName,
- &InventoryComponent,
+ &Inventory,
)>,
instance_container: Res<InstanceContainer>,
) {
@@ -364,7 +364,7 @@ fn path_found_listener(
&mut Pathfinder,
Option<&mut ExecutingPath>,
&InstanceName,
- &InventoryComponent,
+ &Inventory,
)>,
instance_container: Res<InstanceContainer>,
mut commands: Commands,
@@ -576,12 +576,7 @@ fn check_node_reached(
}
fn check_for_path_obstruction(
- mut query: Query<(
- &Pathfinder,
- &mut ExecutingPath,
- &InstanceName,
- &InventoryComponent,
- )>,
+ mut query: Query<(&Pathfinder, &mut ExecutingPath, &InstanceName, &Inventory)>,
instance_container: Res<InstanceContainer>,
) {
for (pathfinder, mut executing_path, instance_name, inventory) in &mut query {
@@ -688,7 +683,7 @@ fn tick_execute_path(
&Physics,
Option<&Mining>,
&InstanceHolder,
- &InventoryComponent,
+ &Inventory,
)>,
mut look_at_events: EventWriter<LookAtEvent>,
mut sprint_events: EventWriter<StartSprintEvent>,
diff --git a/azalea/src/pathfinder/simulation.rs b/azalea/src/pathfinder/simulation.rs
index e8ba4dbd..a24a1acb 100644
--- a/azalea/src/pathfinder/simulation.rs
+++ b/azalea/src/pathfinder/simulation.rs
@@ -2,9 +2,7 @@
use std::sync::Arc;
-use azalea_client::{
- inventory::InventoryComponent, packet_handling::game::SendPacketEvent, PhysicsState,
-};
+use azalea_client::{inventory::Inventory, packet_handling::game::SendPacketEvent, PhysicsState};
use azalea_core::{position::Vec3, resource_location::ResourceLocation, tick::GameTick};
use azalea_entity::{
attributes::AttributeInstance, Attributes, EntityDimensions, LookDirection, Physics, Position,
@@ -22,7 +20,7 @@ pub struct SimulatedPlayerBundle {
pub physics_state: PhysicsState,
pub look_direction: LookDirection,
pub attributes: Attributes,
- pub inventory: InventoryComponent,
+ pub inventory: Inventory,
}
impl SimulatedPlayerBundle {
@@ -41,7 +39,7 @@ impl SimulatedPlayerBundle {
speed: AttributeInstance::new(0.1),
attack_speed: AttributeInstance::new(4.0),
},
- inventory: InventoryComponent::default(),
+ inventory: Inventory::default(),
}
}
}
@@ -108,7 +106,7 @@ fn create_simulation_player_complete_bundle(
partial_instance: Arc::new(RwLock::new(PartialInstance::default())),
instance: instance.clone(),
},
- InventoryComponent::default(),
+ Inventory::default(),
)
}