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

Implement new 1.21 copper blocks #6366

Open
wants to merge 8 commits into
base: minor-next
Choose a base branch
from

Conversation

IvanCraft623
Copy link
Member

@IvanCraft623 IvanCraft623 commented Jun 23, 2024

Introduction

Implement the new 1.21 copper blocks types!!!

Changes

Gameplay

Blocks

  • Added the following new blocks:
    • All types of Copper Bulb
    • All types of Copper Door
    • All types of Copper Trapdoor
    • All types of Chiseled Copper
    • All types of Copper Grate

Tests

I tested this PR by doing the following (tick all that apply):

  • Playtesting using a Minecraft client (provide screenshots or a video)
    Copper blocks
  • Writing a test plugin (provide the code)
    • To be able to test Copper Bulb light activation I wrote this hack code:
public function onWorldSoundEvent(WorldSoundEvent $event) : void {
	$sound = $event->getSound();
	if (!($powerOn = $sound instanceof RedstonePowerOnSound) && !$sound instanceof RedstonePowerOffSound) {
		return;
	}

	$world = $event->getWorld();
	$block = $world->getBlock($event->getPosition());
	if (!$block instanceof Button) {
		return;
	}

	$support = $block->getSide(Facing::opposite($block->getFacing()));
	if (!$support instanceof CopperBulb) {
		return;
	}

	$world->setBlock($support->getPosition(), $support->togglePowered($powerOn));
}

@jasonw4331 jasonw4331 added Category: Gameplay Related to Minecraft gameplay experience Type: Enhancement Contributes features or other improvements to PocketMine-MP labels Jun 23, 2024
src/block/CopperDoor.php Outdated Show resolved Hide resolved
src/block/CopperTrapdoor.php Outdated Show resolved Hide resolved
Comment on lines +45 to +53
public function togglePowered(bool $powered) : self{
if($powered === $this->powered){
return $this;
}
if ($powered) {
$this->setLit(!$this->lit);
}
$this->setPowered($powered);
return $this;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name "toggle" suggest we don't have parameters and it just toggle the actual state ?

Comment on lines +1231 to +1242
Helper::selectCopperId($oxidation,
Ids::WAXED_CHISELED_COPPER,
Ids::WAXED_EXPOSED_CHISELED_COPPER,
Ids::WAXED_WEATHERED_CHISELED_COPPER,
Ids::WAXED_OXIDIZED_CHISELED_COPPER
) :
Helper::selectCopperId($oxidation,
Ids::CHISELED_COPPER,
Ids::EXPOSED_CHISELED_COPPER,
Ids::WEATHERED_CHISELED_COPPER,
Ids::OXIDIZED_CHISELED_COPPER
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent, maybe inline this lines ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More important that the code isn't inconveniently wide so it doesn't require horizontal scrolling.

Comment on lines +1248 to +1260
Helper::selectCopperId($oxidation,
Ids::WAXED_COPPER_GRATE,
Ids::WAXED_EXPOSED_COPPER_GRATE,
Ids::WAXED_WEATHERED_COPPER_GRATE,
Ids::WAXED_OXIDIZED_COPPER_GRATE
) :
Helper::selectCopperId($oxidation,
Ids::COPPER_GRATE,
Ids::EXPOSED_COPPER_GRATE,
Ids::WEATHERED_COPPER_GRATE,
Ids::OXIDIZED_COPPER_GRATE
)
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Comment on lines +1332 to +1342
Helper::selectCopperId($oxidation,
Ids::WAXED_COPPER_BULB,
Ids::WAXED_EXPOSED_COPPER_BULB,
Ids::WAXED_WEATHERED_COPPER_BULB,
Ids::WAXED_OXIDIZED_COPPER_BULB) :
Helper::selectCopperId($oxidation,
Ids::COPPER_BULB,
Ids::EXPOSED_COPPER_BULB,
Ids::WEATHERED_COPPER_BULB,
Ids::OXIDIZED_COPPER_BULB
))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment on lines +1351 to +1364
Helper::selectCopperId(
$oxidation,
Ids::WAXED_COPPER_DOOR,
Ids::WAXED_EXPOSED_COPPER_DOOR,
Ids::WAXED_WEATHERED_COPPER_DOOR,
Ids::WAXED_OXIDIZED_COPPER_DOOR
) :
Helper::selectCopperId(
$oxidation,
Ids::COPPER_DOOR,
Ids::EXPOSED_COPPER_DOOR,
Ids::WEATHERED_COPPER_DOOR,
Ids::OXIDIZED_COPPER_DOOR
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment on lines +1372 to +1386
new Writer($block->isWaxed() ?
Helper::selectCopperId(
$oxidation,
Ids::WAXED_COPPER_TRAPDOOR,
Ids::WAXED_EXPOSED_COPPER_TRAPDOOR,
Ids::WAXED_WEATHERED_COPPER_TRAPDOOR,
Ids::WAXED_OXIDIZED_COPPER_TRAPDOOR
) :
Helper::selectCopperId(
$oxidation,
Ids::COPPER_TRAPDOOR,
Ids::EXPOSED_COPPER_TRAPDOOR,
Ids::WEATHERED_COPPER_TRAPDOOR,
Ids::OXIDIZED_COPPER_TRAPDOOR
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Gameplay Related to Minecraft gameplay experience Type: Enhancement Contributes features or other improvements to PocketMine-MP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants