Skip to content
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

added block_in_hitbox config option #63

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
72aacb4
added tripwire hook, and litte dev cmd
EwanFox Jan 3, 2022
77dc54c
fixed cmd crashing plot if holding nothing
EwanFox Jan 3, 2022
5f37867
remove debug lines
EwanFox Jan 3, 2022
3cc59c3
fix issue #58
EwanFox Jan 19, 2022
5c084d3
really fixed it this time
EwanFox Jan 20, 2022
faa398e
Merge branch 'master' of https://github.com/MCHPR/MCHPRS into bugthing
EwanFox Feb 9, 2022
1315f96
Merge branch 'master' of https://github.com/MCHPR/MCHPRS into bugthing
EwanFox Mar 22, 2022
4867e79
added block_in_hitbox config option
EwanFox Mar 22, 2022
31a5bec
Merge pull request #1 from BananaSquares/block_in_hitbox
EwanFox Mar 22, 2022
57352eb
Merge branch 'master' of https://github.com/BananaSquares/MCHPRS
EwanFox Mar 22, 2022
ed56ab4
added block_in_hitbox config option
EwanFox Mar 22, 2022
c2ac413
Merge branch 'master' of https://github.com/MCHPR/MCHPRS into block_i…
EwanFox Jun 25, 2022
21b51e6
Merge branch 'block_in_hitbox' of https://github.com/BananaSquares/MC…
EwanFox Jun 25, 2022
9317a36
fixing
EwanFox Jun 25, 2022
d3dd4f0
finally fix(rebase later)
EwanFox Jun 25, 2022
22c87af
Delete cargo.lock~
EwanFox Jun 27, 2022
418098d
finally fix, rebase later
EwanFox Jun 27, 2022
36c3f93
Merge branch 'block_in_hitbox' into master
EwanFox Jun 27, 2022
7114d1b
Merge branch 'MCHPR:master' into block_in_hitbox
EwanFox Jun 27, 2022
bfb1499
Delete .cargo.lock.un~
EwanFox Jun 27, 2022
d2bea2c
Delete config.rs~
EwanFox Jun 27, 2022
0a4cb37
Delete .config.rs.un~
EwanFox Jun 27, 2022
2f22b86
format
EwanFox Jun 27, 2022
5f6de09
Merge branch 'master' of https://github.com/MCHPR/MCHPRS into block_i…
EwanFox Jun 27, 2022
79120cf
Merge branch 'block_in_hitbox' of https://github.com/BananaSquares/MC…
EwanFox Jun 27, 2022
8a7bfaf
Delete vim files
EwanFox Jun 27, 2022
cd0368d
Display redpiler flags on scoreboard
StackDoubleFlow Jun 25, 2022
4b94882
Update all redstone wire blocks if redpiler optimizations were enabled
StackDoubleFlow Jun 25, 2022
5e3af7a
Add io-only redpiler flag
StackDoubleFlow Jun 25, 2022
898ac87
Fix slabs saving in schematics
StackDoubleFlow Jun 25, 2022
a7f2efd
Remove Scoreboard::truncate
StackDoubleFlow Jun 25, 2022
2aca353
Don't yield on unlimited tps
StackDoubleFlow Jun 25, 2022
264526b
Update dependencies
StackDoubleFlow Jun 25, 2022
1d57eeb
Add container replace command and rustfmt
StackDoubleFlow Jun 25, 2022
b8ffe08
format
EwanFox Jun 27, 2022
53f4394
Merge remote-tracking branch 'origin/master' into block_in_hitbox
EwanFox Jun 27, 2022
32a008a
Merge branch 'block_in_hitbox' of https://github.com/BananaSquares/MC…
EwanFox Jun 27, 2022
a232122
Merge branch 'block_in_hitbox' of https://github.com/BananaSquares/MC…
EwanFox Jun 27, 2022
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
Binary file added src/.items.rs.un~
Binary file not shown.
14 changes: 9 additions & 5 deletions src/blocks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -935,11 +935,11 @@ impl Block {
},
},
Item::TripwireHook {} => match context.block_face {
BlockFace::Bottom | BlockFace::Top => Block::Air {},
direction => Block::TripwireHook {
direction: direction.to_direction(),
},
},
BlockFace::Top | BlockFace::Bottom => Block::Air {},
face => Block::TripwireHook {
direction: face.to_direction(),
}
}
Item::StoneButton {} => {
let button_face = match context.block_face {
BlockFace::Top => ButtonFace::Floor,
Expand Down Expand Up @@ -1201,6 +1201,10 @@ impl Block {
let bottom_block = world.get_block(pos.offset(BlockFace::Bottom));
bottom_block.is_cube()
}
Block::TripwireHook { direction, .. } => {
let parent_block = world.get_block(pos.offset(direction.opposite().block_face()));
parent_block.is_cube()
}
Block::RedstoneWallTorch { facing, .. } | Block::WallSign { facing, .. } => {
let parent_block = world.get_block(pos.offset(facing.opposite().block_face()));
parent_block.is_cube()
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/redstone/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ impl Block {
dust_power: bool,
) -> u8 {
match self {

Block::RedstoneTorch { lit: true } => 15,
Block::RedstoneWallTorch { lit: true, facing } if facing.block_face() != side => 15,
Block::RedstoneBlock {} => 15,
Expand Down Expand Up @@ -161,7 +162,6 @@ fn diode_get_input_strength(world: &impl World, pos: BlockPos, facing: BlockDire
}
power
}

#[derive(Copy, Clone, Debug, PartialEq, BlockProperty, BlockTransform)]
pub struct RedstoneRepeater {
pub delay: u8,
Expand Down
3 changes: 2 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@ gen_config! {
bungeecord: bool = false,
whitelist: bool = false,
schemati: bool = true,
luckperms: Option<PermissionsConfig> = None
luckperms: Option<PermissionsConfig> = None,
block_in_hitbox: bool = true
}
10 changes: 9 additions & 1 deletion src/items.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use serde::{Deserialize, Serialize};

use crate::blocks::{Block, BlockColorVariant, BlockDirection, BlockFace, BlockPos, ContainerType};
use crate::config::CONFIG;
use crate::network::packets::clientbound::{COpenSignEditor, ClientBoundPacket};
use crate::plot::Plot;
use crate::world::World;


#[derive(PartialEq, Copy, Clone)]
pub enum ActionResult {
Success,
Expand Down Expand Up @@ -99,7 +101,13 @@ impl ItemStack {
let use_pos = context.block_pos;
let use_block = plot.world.get_block(use_pos);
let block_pos = context.block_pos.offset(context.block_face);

let mut top_pos = plot.players[context.player_idx].pos.block_pos();
top_pos.y = top_pos.y + 1;
if (block_pos == plot.players[context.player_idx].pos.block_pos() || block_pos == top_pos)
&& !CONFIG.block_in_hitbox
{
return false;
}
let can_place =
self.item_type.is_block() && plot.world.get_block(block_pos).can_place_block_in();

Expand Down
1 change: 1 addition & 0 deletions src/network/packets/serverbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ impl ServerBoundPacket for SRequest {
}
}


pub struct SPing {
pub payload: i64,
}
Expand Down
12 changes: 12 additions & 0 deletions src/plot/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,18 @@ impl Plot {
};
self.change_player_gamemode(player, gamemode);
}
"/whatamiholding" => {
if args.len() != 0 {
self.players[player].send_error_message("Usage: /whatamiholding");
return false;
}
let slot = self.players[player].selected_slot + 36;
let item = self.players[player].inventory[slot as usize].as_ref();
if item.is_some() {

self.players[player].send_system_message(&item.unwrap().item_type.get_id().to_string());
}
}
"/container" => {
if args.len() != 2 {
self.players[player].send_error_message("Usage: /container [type] [power]");
Expand Down