Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ private function parseData(array $data) : void{
$itemPropertiesComponent->addComponent("hand_equipped", $trueTag);
}
if(isset($data["max_stack_size"])){
$itemPropertiesComponent->addComponent("max_stack_size", new IntTag($data["max_stack_size"]));
$this->max_stack_size = (int)$data["max_stack_size"];
$itemPropertiesComponent->addComponent("max_stack_size", new IntTag($this->max_stack_size));
}
// if(isset($data["mining_speed"])){
// $this->setMiningSpeed($data["mining_speed"]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ public function processComponent(CompoundTag $rootNBT) : void{
throw new InvalidNBTStateException("Component tree is not built");
}
$cooldownTag->setString("category", "attack"); // TODO: Find out this
$cooldownTag->setFloat("value", $this->cooldown / 20); // maybe in tick
$cooldownTag->setFloat("duration", $this->cooldown / 20); // maybe in tick
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,18 @@ final class DisplayNameComponent extends Component{
public function __construct(private readonly string $displayName){ }

public function getName() : string{
return "texture";
return "display_name";
}

public function buildComponent(CompoundTag $rootNBT) : void{
$componentTag = $rootNBT->getCompoundTag(Component::TAG_COMPONENTS);
if($componentTag === null){
throw new InvalidNBTStateException("Component tree is not built");
}
$componentTag->setTag(self::TAG_DISPLAY_NAME, CompoundTag::create());
$rootNBT->setTag(self::TAG_DISPLAY_NAME, CompoundTag::create());
}

public function processComponent(CompoundTag $rootNBT) : void{
$displayNameTag = $rootNBT->getCompoundTag(Component::TAG_COMPONENTS)?->getCompoundTag(self::TAG_DISPLAY_NAME);
$displayNameTag = $rootNBT->getCompoundTag(self::TAG_DISPLAY_NAME);
if($displayNameTag === null){
throw new InvalidNBTStateException("Component tree is not built");
}
$displayNameTag->setString("value", $this->displayName);
}
}
}