Skip to content

Commit

Permalink
Added some ContainerSetDataPacket constants
Browse files Browse the repository at this point in the history
  • Loading branch information
dktapps committed Aug 8, 2017
1 parent b4c2305 commit 3ad1b1b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
16 changes: 13 additions & 3 deletions src/pocketmine/network/mcpe/protocol/ContainerSetDataPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,28 @@
class ContainerSetDataPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::CONTAINER_SET_DATA_PACKET;

public $windowid;
const PROPERTY_FURNACE_TICK_COUNT = 0;
const PROPERTY_FURNACE_LIT_TIME = 1;
const PROPERTY_FURNACE_LIT_DURATION = 2;
//TODO: check property 3
const PROPERTY_FURNACE_FUEL_AUX = 4;

const PROPERTY_BREWING_STAND_BREW_TIME = 0;
const PROPERTY_BREWING_STAND_FUEL_AMOUNT = 1;
const PROPERTY_BREWING_STAND_FUEL_TOTAL = 2;

public $windowId;
public $property;
public $value;

protected function decodePayload(){
$this->windowid = $this->getByte();
$this->windowId = $this->getByte();
$this->property = $this->getVarInt();
$this->value = $this->getVarInt();
}

protected function encodePayload(){
$this->putByte($this->windowid);
$this->putByte($this->windowId);
$this->putVarInt($this->property);
$this->putVarInt($this->value);
}
Expand Down
8 changes: 4 additions & 4 deletions src/pocketmine/tile/Furnace.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,14 @@ public function onUpdate() : bool{
$windowId = $player->getWindowId($this->getInventory());
if($windowId > 0){
$pk = new ContainerSetDataPacket();
$pk->windowid = $windowId;
$pk->property = 0; //Smelting
$pk->windowId = $windowId;
$pk->property = ContainerSetDataPacket::PROPERTY_FURNACE_TICK_COUNT; //Smelting
$pk->value = $this->namedtag->CookTime->getValue();
$player->dataPacket($pk);

$pk = new ContainerSetDataPacket();
$pk->windowid = $windowId;
$pk->property = 1; //Fire icon
$pk->windowId = $windowId;
$pk->property = ContainerSetDataPacket::PROPERTY_FURNACE_LIT_TIME;
$pk->value = $this->namedtag->BurnTicks->getValue();
$player->dataPacket($pk);
}
Expand Down

3 comments on commit 3ad1b1b

@Muqsit
Copy link
Member

@Muqsit Muqsit commented on 3ad1b1b Aug 8, 2017

Choose a reason for hiding this comment

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

Wait... now I'm confused between namedtags and this packet. :|

@Sandertv
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't we all confused this update? :')

@dktapps
Copy link
Member Author

@dktapps dktapps commented on 3ad1b1b Aug 8, 2017

Choose a reason for hiding this comment

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

This packet isn't new, it's very old in fact. It just hasn't really gotten any attention until now.

Please sign in to comment.