reset crafting type whenever resetting crafting arrays

This commit is contained in:
GameHerobrine 2025-05-10 04:41:55 +03:00
parent 2b38e4b20d
commit 6b0b1aa985

View file

@ -1975,6 +1975,7 @@ class Player{
}
$this->craftingItems = [];
$this->toCraft = [];
$this->craftingType = CraftingRecipes::TYPE_INVENTORY;
$packet->eid = $this->eid;
$data = [];
$data["eid"] = $packet->eid;
@ -2101,7 +2102,8 @@ class Player{
$packet->eid = $this->eid;
$this->craftingItems = [];
$this->toCraft = [];
$this->craftingType = CraftingRecipes::TYPE_INVENTORY;
switch($packet->action){
case 5: //Shot arrow
if($this->entity->inAction){
@ -2182,6 +2184,7 @@ class Player{
}
$this->craftingItems = [];
$this->toCraft = [];
$this->craftingType = CraftingRecipes::TYPE_INVENTORY;
$this->server->api->block->playerBlockBreak($this, $blockVector);
break;
case ProtocolInfo::PLAYER_ARMOR_EQUIPMENT_PACKET:
@ -2190,7 +2193,8 @@ class Player{
}
$this->craftingItems = [];
$this->toCraft = [];
$this->craftingType = CraftingRecipes::TYPE_INVENTORY;
$packet->eid = $this->eid;
for($i = 0; $i < 4; ++$i){
$s = $packet->slots[$i];
@ -2234,6 +2238,7 @@ class Player{
$data["action"] = $packet->action;
$this->craftingItems = [];
$this->toCraft = [];
$this->craftingType = CraftingRecipes::TYPE_INVENTORY;
$target = $this->server->api->entity->get($packet->target);
if($target instanceof Entity and $this->entity instanceof Entity and $this->gamemode !== VIEW and $this->blocked === false and ($target instanceof Entity) and $this->entity->distance($target) <= 8){
$data["targetentity"] = $packet->target;
@ -2261,6 +2266,7 @@ class Player{
}
$this->craftingItems = [];
$this->toCraft = [];
$this->craftingType = CraftingRecipes::TYPE_INVENTORY;
$this->checkSpawnPosition();
$this->teleport($this->spawnPosition, false, false, true, false);
@ -2299,6 +2305,7 @@ class Player{
}
$this->craftingItems = [];
$this->toCraft = [];
$this->craftingType = CraftingRecipes::TYPE_INVENTORY;
$packet->eid = $this->eid;
if($this->entity->inAction === true){
$this->entity->inAction = false;
@ -2359,6 +2366,7 @@ class Player{
$this->craftingItems = [];
$this->toCraft = [];
$this->craftingType = CraftingRecipes::TYPE_INVENTORY;
$data["eid"] = $packet->eid;
$data["unknown"] = $packet->unknown;
$data["item"] = $packet->item;
@ -2391,6 +2399,7 @@ class Player{
}
$this->craftingItems = [];
$this->toCraft = [];
$this->craftingType = CraftingRecipes::TYPE_INVENTORY;
if(trim($packet->message) != "" and strlen($packet->message) <= 255){
$message = $packet->message;
if($message[0] === "/"){ //Command
@ -2428,6 +2437,7 @@ class Player{
}
$this->craftingItems = [];
$this->toCraft = [];
$this->craftingType = CraftingRecipes::TYPE_INVENTORY;
if(isset($this->windows[$packet->windowid])){
if(is_array($this->windows[$packet->windowid])){
foreach($this->windows[$packet->windowid] as $ob){
@ -2484,6 +2494,7 @@ class Player{
}else{
$this->toCraft = [];
$this->craftingItems = [];
$this->craftingType = CraftingRecipes::TYPE_INVENTORY;
}
if(!isset($this->windows[$packet->windowid])){
break;
@ -2597,6 +2608,7 @@ class Player{
}
$this->craftingItems = [];
$this->toCraft = [];
$this->craftingType = CraftingRecipes::TYPE_INVENTORY;
$t = $this->server->api->tile->get(new Position($packet->x, $packet->y, $packet->z, $this->level));
if(($t instanceof Tile) and $t->class === TILE_SIGN){
if($t->data["creator"] !== $this->username){