Skip to content

Fix/collisionbox 1.21.130#1

Open
dadodasyra wants to merge 9 commits intoHisteriaMC:masterfrom
ahnsunggwan45:fix/collisionbox-1.21.130
Open

Fix/collisionbox 1.21.130#1
dadodasyra wants to merge 9 commits intoHisteriaMC:masterfrom
ahnsunggwan45:fix/collisionbox-1.21.130

Conversation

@dadodasyra
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings December 24, 2025 10:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Customies to version 1.4.0 with support for Minecraft Bedrock Edition 1.21.130, introducing a comprehensive component-based architecture for both items and blocks. The changes represent a significant refactoring that modernizes the codebase and aligns it with the latest Minecraft Bedrock protocol requirements.

Key Changes:

  • Introduced a new block component system with components for collision boxes, selection boxes, geometry, lighting, friction, and other block properties
  • Extensively refactored item components, adding 15+ new components (ShooterComponent, RecordComponent, DyeableComponent, etc.) while removing deprecated ones
  • Overhauled the item and block registration system to use component-based architecture and proper creative inventory integration
  • Updated protocol handling to remove ItemComponentPacket in favor of embedding components directly in ItemTypeEntry

Reviewed changes

Copilot reviewed 62 out of 63 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
src/item/component/WearableComponent.php Added protection and dispensable parameters to support armor properties
src/item/component/UseModifiersComponent.php Reformatted and added default parameter for useDuration
src/item/component/UseDurationComponent.php Added default duration value and documentation
src/item/component/UseAnimationComponent.php Added animation type constants and documentation
src/item/component/ThrowableComponent.php Extended with launch power, draw duration, and scaling properties
src/item/component/StackedByDataComponent.php New component for controlling item stacking behavior
src/item/component/ShouldDespawnComponent.php New component for controlling item despawn behavior
src/item/component/ShooterComponent.php New component for bow/crossbow-like shooting mechanics
src/item/component/RenderOffsetsComponent.php Removed - functionality replaced by other components
src/item/component/RecordComponent.php New component for music disc items
src/item/component/RarityComponent.php Added default parameter and comprehensive documentation
src/item/component/ProjectileComponent.php Added minimumCriticalPower parameter for critical hit mechanics
src/item/component/MaxStackSizeComponent.php Added default value and documentation
src/item/component/LiquidClippedComponent.php New component for liquid interaction behavior
src/item/component/KnockbackResistanceComponent.php Removed - functionality moved to WearableComponent
src/item/component/InteractButtonComponent.php New component for touch control interact button customization
src/item/component/IconComponent.php Extended to support dyed and trim textures
src/item/component/HoverTextColorComponent.php New component for customizing item name color
src/item/component/HandEquippedComponent.php Added documentation for tool rendering
src/item/component/GlintComponent.php New component replacing FoilComponent
src/item/component/FuelComponent.php Added documentation for furnace fuel behavior
src/item/component/FoodComponent.php Extended with nutrition, saturation, and conversion properties
src/item/component/FoilComponent.php Removed - replaced by GlintComponent
src/item/component/EnchantableValueComponent.php New component with enchantability constants
src/item/component/EnchantableSlotComponent.php New component for enchantment slot restrictions
src/item/component/DyeableComponent.php New component for dyeable items
src/item/component/DurabilityComponent.php Extended with damage chance modifiers
src/item/component/DisplayNameComponent.php Added documentation for item naming
src/item/component/DiggerComponent.php Added use_efficiency parameter and documentation
src/item/component/DamageComponent.php Renamed from AttackDamageComponent with documentation
src/item/component/DamageAbsorptionComponent.php New component for armor damage absorption
src/item/component/CreativeGroupComponent.php Removed - integrated into factory registration
src/item/component/CreativeCategoryComponent.php Removed - integrated into factory registration
src/item/component/CooldownComponent.php Added category constants and documentation
src/item/component/ChargeableComponent.php Removed - functionality replaced by UseModifiersComponent
src/item/component/CanDestroyInCreativeComponent.php Code formatting and documentation updates
src/item/component/BundleInteractionComponent.php New component for bundle item mechanics
src/item/component/BlockPlacerComponent.php Refactored to use Block objects and added useOn functionality
src/item/component/ArmorComponent.php Removed - functionality moved to WearableComponent
src/item/component/AllowOffHandComponent.php Added documentation for off-hand placement
src/item/ItemComponentsTrait.php Refactored to return component arrays and simplified initialization
src/item/ItemComponents.php Updated interface to return component arrays instead of NBT
src/item/CustomiesItemFactory.php Major refactoring to support new component system and creative inventory integration
src/item/CreativeInventoryInfo.php Minor formatting update
src/block/component/SelectionBoxComponent.php New component for block selection box configuration
src/block/component/MaterialInstancesComponent.php New component for block material definitions
src/block/component/LightEmissionComponent.php New component for light emission properties
src/block/component/LightDampeningComponent.php New component for light dampening properties
src/block/component/GeometryComponent.php New component for custom block geometry
src/block/component/FrictionComponent.php New component for block friction properties
src/block/component/FlammableComponent.php New component for flammability properties
src/block/component/DisplayNameComponent.php New component for block display names
src/block/component/DestructibleByMiningComponent.php New component for mining hardness
src/block/component/DestructibleByExplosionComponent.php New component for explosion resistance
src/block/component/CollisionBoxComponent.php New component for entity collision configuration
src/block/component/BreathabilityComponent.php New component for breathability properties
src/block/component/BlockComponent.php New interface for block components
src/block/Model.php Removed - replaced by component system
src/block/CustomiesBlockFactory.php Refactored to use component system and creative inventory integration
src/block/BlockComponentsTrait.php New trait for block component management
src/block/BlockComponents.php New interface for blocks with components
src/CustomiesListener.php Simplified to remove ItemComponentPacket handling
plugin.yml Version bump to 1.4.0
Comments suppressed due to low confidence (1)

src/item/component/DamageComponent.php:12

  • The documentation contains a spelling error: "Intger" should be "Integer".

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

private bool|string $interactButton;

/**
* Ineract Button is a boolean or string that determines if the interact button is shown in touch controls, and what text is displayed on the button. When set to 'true', the default 'Use Item' text will be used.
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The documentation has a typo: "Ineract Button" should be "Interact Button".

Copilot uses AI. Check for mistakes.

/**
* Defines the area of the block that is selected by the player's cursor. If set to true, default values are used. If set to false, this block is not selectable by the player's cursor. If this component is omitted, default values are used.
* @param Vector3 $origin MMinimal position of the bounds of the selection box. "origin" is specified as [x, y, z] and must be in the range (-8, 0, -8) to (8, 16, 8), inclusive.
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The documentation contains a typo with extra space: "MMinimal position" should be "Minimal position".

Suggested change
* @param Vector3 $origin MMinimal position of the bounds of the selection box. "origin" is specified as [x, y, z] and must be in the range (-8, 0, -8) to (8, 16, 8), inclusive.
* @param Vector3 $origin Minimal position of the bounds of the selection box. "origin" is specified as [x, y, z] and must be in the range (-8, 0, -8) to (8, 16, 8), inclusive.

Copilot uses AI. Check for mistakes.
Comment on lines +22 to +25
public function __construct(bool $useSelectionBox = true, ?Vector3 $origin = new Vector3(-8.0, 0.0, -8.0), ?Vector3 $size = new Vector3(16.0, 16.0, 16.0)) {
$this->useSelectionBox = $useSelectionBox;
$this->origin = $origin;
$this->size = $size;
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The default parameter values use the new keyword in the function signature, which creates new Vector3 instances at compile time. This is a PHP 8.1+ feature that may cause issues. While it's syntactically valid in newer PHP versions, it means all function calls share the same default object instances, which could lead to unexpected behavior if the Vector3 objects are modified. Consider using null as the default and creating the Vector3 instances inside the constructor body instead.

Suggested change
public function __construct(bool $useSelectionBox = true, ?Vector3 $origin = new Vector3(-8.0, 0.0, -8.0), ?Vector3 $size = new Vector3(16.0, 16.0, 16.0)) {
$this->useSelectionBox = $useSelectionBox;
$this->origin = $origin;
$this->size = $size;
public function __construct(bool $useSelectionBox = true, ?Vector3 $origin = null, ?Vector3 $size = null) {
$this->useSelectionBox = $useSelectionBox;
$this->origin = $origin ?? new Vector3(-8.0, 0.0, -8.0);
$this->size = $size ?? new Vector3(16.0, 16.0, 16.0);

Copilot uses AI. Check for mistakes.
Comment on lines +25 to +28
public function __construct(bool $useCollisionBox = true, Vector3 $origin = new Vector3(-8.0, 0.0, -8.0), Vector3 $size = new Vector3(16.0, 16.0, 16.0)) {
$this->useCollisionBox = $useCollisionBox;
$this->origin = $origin;
$this->size = $size;
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The default parameter values use the new keyword in the function signature. This is a PHP 8.1+ feature that may cause issues because all function calls share the same default object instances. If the Vector3 objects are modified, it could lead to unexpected behavior. Consider using null as the default and creating the Vector3 instances inside the constructor body instead.

Suggested change
public function __construct(bool $useCollisionBox = true, Vector3 $origin = new Vector3(-8.0, 0.0, -8.0), Vector3 $size = new Vector3(16.0, 16.0, 16.0)) {
$this->useCollisionBox = $useCollisionBox;
$this->origin = $origin;
$this->size = $size;
public function __construct(bool $useCollisionBox = true, ?Vector3 $origin = null, ?Vector3 $size = null) {
$this->useCollisionBox = $useCollisionBox;
$this->origin = $origin ?? new Vector3(-8.0, 0.0, -8.0);
$this->size = $size ?? new Vector3(16.0, 16.0, 16.0);

Copilot uses AI. Check for mistakes.
};

CreativeInventory::getInstance()->add($item, $category, $group);
}
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The trailing whitespace after the closing brace should be removed for code cleanliness.

Suggested change
}
}

Copilot uses AI. Check for mistakes.
/**
* Rarity Component enables the specifying of the base rarity of an item.
* The rarity of the item will determine which color it uses for its name, unless the item has a HoverTextColor component specified, in which case that hover text color will take priority and be used instead of the rarity color.
* @param string $type Sets the base rarity of the item. The rarity of an item automatically increases when enchanted, either to Rare when the base rarity is Common or Uncommon, or Epic when the base rarity is Rare
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The parameter name in the documentation is incorrect. The parameter is named $rarity but the documentation refers to $type. The documentation should refer to the actual parameter name $rarity to maintain consistency.

Copilot uses AI. Check for mistakes.
* @param float $minimumCriticalPower Specifies how long a player must charge a projectile for it to critically hit
* @param string $projectileEntity Which entity is to be fired as a projectile
*/
public function __construct(float $minimumCriticalPower, string $projectileEntity) {
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

This is a breaking API change. The constructor signature has changed from __construct(string $projectileEntity) to __construct(float $minimumCriticalPower, string $projectileEntity), which will break existing code that uses this component. The new required parameter $minimumCriticalPower should either have a default value to maintain backward compatibility, or this breaking change should be clearly documented in the migration guide.

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +18
$this->useDuration = $useDuration;
$this->movementModifier = $movementModifier;
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The parameter order has been swapped from the original implementation. Previously it was __construct(private float $movementModifier, private float $useDuration), and now it's __construct(float $movementModifier, float $useDuration = 0) but the assignment in the constructor body is reversed: $this->useDuration is assigned first, then $this->movementModifier. This reversed assignment order compared to the parameter order can be confusing and is inconsistent with the parameter documentation order. The assignments should match the parameter order for better code readability.

Copilot uses AI. Check for mistakes.

if($this->getAttackPoints() > 0) {
$this->addComponent(new AttackDamageComponent($this->getAttackPoints() - 1));
$this->addComponent(new DamageComponent($this->getAttackPoints()));
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The damage calculation has changed from $this->getAttackPoints() - 1 to $this->getAttackPoints(). This is a breaking change that will affect all items using this trait. The previous implementation subtracted 1 from the attack points, likely to account for base damage. Removing this subtraction will increase the damage value sent to the client by 1 for all weapons. This should be verified to ensure it aligns with the intended behavior for Minecraft 1.21.130.

Suggested change
$this->addComponent(new DamageComponent($this->getAttackPoints()));
$this->addComponent(new DamageComponent($this->getAttackPoints() - 1));

Copilot uses AI. Check for mistakes.
$this->addComponent(new DestructibleByMiningComponent($this->getBreakInfo()->getHardness()));
$this->addComponent(new LightEmissionComponent($this->getLightLevel()));
$this->addComponent(new LightDampeningComponent($this->getLightFilter()));
$this->addComponent(new FrictionComponent($this->getFrictionFactor()));
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The FrictionComponent is being initialized with $this->getFrictionFactor(), but according to the FrictionComponent documentation, friction affects movement speed and higher values result in more friction. However, getFrictionFactor() typically returns a value where lower means less friction (more slippery). The component documentation says wood/dirt use 0.4 while ice uses 0.02, but PocketMine's getFrictionFactor() returns values where ice is typically 0.98 (very low friction). This suggests the value may need to be inverted or transformed (e.g., 1 - $this->getFrictionFactor()) to match Minecraft's friction model. Verify this is correct for the Bedrock protocol.

Suggested change
$this->addComponent(new FrictionComponent($this->getFrictionFactor()));
$this->addComponent(new FrictionComponent(1.0 - $this->getFrictionFactor()));

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants