mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 17:29:44 +00:00
Added Milk bucket to creative inventory
This commit is contained in:
parent
dfec44645b
commit
81fe98d4cc
@ -1832,7 +1832,8 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
$this->lastBreak = microtime(true);
|
$this->lastBreak = microtime(true);
|
||||||
break;
|
break;
|
||||||
case 5: //Shot arrow
|
case 5: //Shot arrow
|
||||||
if($this->startAction > -1 and $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION) and $this->inventory->getItemInHand()->getId() === Item::BOW){
|
if($this->startAction > -1 and $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION)){
|
||||||
|
if($this->inventory->getItemInHand()->getId() === Item::BOW) {
|
||||||
$bow = $this->inventory->getItemInHand();
|
$bow = $this->inventory->getItemInHand();
|
||||||
if ($this->isSurvival() and !$this->inventory->contains(Item::get(Item::ARROW, 0, 1))) {
|
if ($this->isSurvival() and !$this->inventory->contains(Item::get(Item::ARROW, 0, 1))) {
|
||||||
$this->inventory->sendContents($this);
|
$this->inventory->sendContents($this);
|
||||||
@ -1895,6 +1896,31 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}elseif($this->inventory->getItemInHand()->getId() === Item::BUCKET and $this->inventory->getItemInHand()->getDamage() === 1){ //Milk!
|
||||||
|
$this->server->getPluginManager()->callEvent($ev = new PlayerItemConsumeEvent($this, $this->inventory->getItemInHand()));
|
||||||
|
if($ev->isCancelled()){
|
||||||
|
$this->inventory->sendContents($this);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pk = new EntityEventPacket();
|
||||||
|
$pk->eid = $this->getId();
|
||||||
|
$pk->event = 9;
|
||||||
|
$pk->setChannel(Network::CHANNEL_WORLD_EVENTS);
|
||||||
|
$this->dataPacket($pk);
|
||||||
|
Server::broadcastPacket($this->getViewers(), $pk);
|
||||||
|
|
||||||
|
if ($this->isSurvival()) {
|
||||||
|
$slot = $this->inventory->getItemInHand();
|
||||||
|
--$slot->count;
|
||||||
|
$this->inventory->setItemInHand($slot, $this);
|
||||||
|
$this->inventory->addItem(Item::get(Item::BUCKET, 0, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->removeAllEffects();
|
||||||
|
}else{
|
||||||
|
$this->inventory->sendContents($this);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 6: //get out of the bed
|
case 6: //get out of the bed
|
||||||
$this->stopSleep();
|
$this->stopSleep();
|
||||||
@ -2222,25 +2248,6 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
$this->addEffect(Effect::getEffect(Effect::NAUSEA)->setAmplifier(1)->setDuration(15 * 20));
|
$this->addEffect(Effect::getEffect(Effect::NAUSEA)->setAmplifier(1)->setDuration(15 * 20));
|
||||||
$this->addEffect(Effect::getEffect(Effect::POISON)->setAmplifier(3)->setDuration(60 * 20));
|
$this->addEffect(Effect::getEffect(Effect::POISON)->setAmplifier(3)->setDuration(60 * 20));
|
||||||
}
|
}
|
||||||
}elseif($slot->getId() === Item::BUCKET and $slot->getId() === 1){ //Milk!
|
|
||||||
$this->server->getPluginManager()->callEvent($ev = new PlayerItemConsumeEvent($this, $slot));
|
|
||||||
if($ev->isCancelled()){
|
|
||||||
$this->inventory->sendContents($this);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$pk = new EntityEventPacket();
|
|
||||||
$pk->eid = $this->getId();
|
|
||||||
$pk->event = 9;
|
|
||||||
$pk->setChannel(Network::CHANNEL_WORLD_EVENTS);
|
|
||||||
$this->dataPacket($pk);
|
|
||||||
Server::broadcastPacket($this->getViewers(), $pk);
|
|
||||||
|
|
||||||
--$slot->count;
|
|
||||||
$this->inventory->setItemInHand($slot, $this);
|
|
||||||
$this->inventory->addItem(Item::get(Item::BUCKET, 0, 1));
|
|
||||||
|
|
||||||
$this->removeAllEffects();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -472,6 +472,7 @@ class Block extends Position implements Metadatable{
|
|||||||
//TODO [Item::POWERED_RAILS, 0],
|
//TODO [Item::POWERED_RAILS, 0],
|
||||||
[Item::TORCH, 0],
|
[Item::TORCH, 0],
|
||||||
[Item::BUCKET, 0],
|
[Item::BUCKET, 0],
|
||||||
|
[Item::BUCKET, 1],
|
||||||
[Item::BUCKET, 8],
|
[Item::BUCKET, 8],
|
||||||
[Item::BUCKET, 10],
|
[Item::BUCKET, 10],
|
||||||
[Item::TNT, 0],
|
[Item::TNT, 0],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user