Skip to content

Commit

Permalink
Removed unneeded code
Browse files Browse the repository at this point in the history
  • Loading branch information
OfficialKris committed Feb 22, 2025
1 parent 6ba7192 commit 8111724
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 104 deletions.
30 changes: 0 additions & 30 deletions pumpkin/src/net/packet/play.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1131,36 +1131,6 @@ impl Player {
if let Some(held) = self.inventory().lock().await.held_item() {
server.item_registry.on_use(&held.item, self, server).await;
}
// self.world()
// .await
// .play_sound(
// Sound::EntitySplashPotionThrow,
// pumpkin_data::sound::SoundCategory::Players,
// &self.living_entity.entity.pos.load(),
// )
// .await;

// let entity_position = self.living_entity.entity.pos.load();
// let pitch = self.living_entity.entity.pitch.load();
// let yaw = self.living_entity.entity.yaw.load();
// let head = self.living_entity.entity.head_yaw.load();
// log::info!("pitch: {}", pitch);
// log::info!("yaw: {}", yaw);
// log::info!("head: {}", head);
// log::info!("before: {:?}", entity_position.y);
// log::info!(
// "standing eye height: {:?}",
// self.living_entity.entity.standing_eye_height
// );
// let offset_position = entity_position.add_raw(
// 0.0,
// f64::from(self.living_entity.entity.standing_eye_height),
// 0.0,
// );
// log::info!("after: {:?}", offset_position.y);
// server
// .add_potion_entity(EntityType::POTION, offset_position, pitch, yaw)
// .await;
}

pub async fn handle_set_held_item(&self, held: SSetHeldItem) {
Expand Down
74 changes: 0 additions & 74 deletions pumpkin/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ use crossbeam::atomic::AtomicCell;
use key_store::KeyStore;
use pumpkin_config::{ADVANCED_CONFIG, BASIC_CONFIG};
use pumpkin_data::entity::EntityType;
use pumpkin_data::world::WorldEvent;
use pumpkin_inventory::drag_handler::DragHandler;
use pumpkin_inventory::{Container, OpenContainer};
use pumpkin_protocol::client::login::CEncryptionRequest;
use pumpkin_protocol::client::play::CLevelEvent;
use pumpkin_protocol::{ClientPacket, client::config::CPluginMessage};
use pumpkin_registry::{DimensionType, Registry};
use pumpkin_util::math::boundingbox::{BoundingBox, EntityDimensions};
Expand Down Expand Up @@ -292,78 +290,6 @@ impl Server {
.cloned()
}

// TODO: refactor
pub async fn add_potion_entity(
&self,
entity_type: EntityType,
location: Vector3<f64>,
_pitch: f32,
_yaw: f32,
) -> (Arc<Entity>, Arc<World>, uuid::Uuid) {
let world = &self.worlds.read().await[0];
let new_uuid = uuid::Uuid::new_v4();
let entity_id = self.new_entity_id();

// TODO: this should be resolved to a integer using a macro when calling this function
let bounding_box_size = EntityDimensions {
width: entity_type.dimension[0],
height: entity_type.dimension[1],
};

let bounding_box =
BoundingBox::new_from_pos(location.x, location.y, location.z, &bounding_box_size);

// let bounding_box_size = BoundingBoxSize {
// width: 0.6,
// height: 1.8,
// };

let entity = Arc::new(Entity::new(
entity_id,
None,
new_uuid,
world.clone(),
location,
entity_type,
1.62,
AtomicCell::new(bounding_box),
AtomicCell::new(bounding_box_size),
true,
));

entity.set_pos(location);

// let entity_direction = Vector3::new_from_euler(yaw.into(), pitch.into());

// world.add_entity(&entity.clone(), entity_direction).await;

let threaded_entity = entity.clone();
let threaded_location = location;
let threaded_world = world.clone();
tokio::spawn(async move {
tokio::time::sleep(tokio::time::Duration::from_millis(2000)).await;
// TODO: calculate position of final block, should be based on ticks no separate thread
let landed_block_position = BlockPos(Vector3 {
x: threaded_location.x as i32,
y: (threaded_location.y - 1.62) as i32,
z: threaded_location.z as i32,
});
threaded_world
.broadcast_packet_all(&CLevelEvent::new(
WorldEvent::InstantSplashPotionSplashed as i32,
landed_block_position,
// TODO: RGB color as an integer (e.g. 8364543 for #7FA1FF).
8_364_543,
false,
))
.await;
threaded_entity.remove().await;
// current_living_entities.remove(&living_entity.entity.entity_uuid);
});

(entity, world.clone(), new_uuid)
}

/// Returns the first id with a matching location and block type. If this is used with unique
/// blocks, the output will return a random result.
pub async fn get_container_id(&self, location: BlockPos, block: Block) -> Option<u32> {
Expand Down

0 comments on commit 8111724

Please sign in to comment.