Particles for 0.16

Added BlockForceFieldParticle, removed LargeExplodeParticle and added HugeExplodeSeedParticle
This commit is contained in:
Dylan K. Taylor 2016-11-12 21:05:01 +00:00 committed by GitHub
parent bd5bbbea10
commit 7314aaf7f7
4 changed files with 79 additions and 40 deletions

View File

@ -26,6 +26,7 @@ use pocketmine\command\CommandSender;
use pocketmine\event\TranslationContainer;
use pocketmine\item\Item;
use pocketmine\level\particle\AngryVillagerParticle;
use pocketmine\level\particle\BlockForceFieldParticle;
use pocketmine\level\particle\BubbleParticle;
use pocketmine\level\particle\CriticalParticle;
use pocketmine\level\particle\DustParticle;
@ -36,10 +37,10 @@ use pocketmine\level\particle\FlameParticle;
use pocketmine\level\particle\HappyVillagerParticle;
use pocketmine\level\particle\HeartParticle;
use pocketmine\level\particle\HugeExplodeParticle;
use pocketmine\level\particle\HugeExplodeSeedParticle;
use pocketmine\level\particle\InkParticle;
use pocketmine\level\particle\InstantEnchantParticle;
use pocketmine\level\particle\ItemBreakParticle;
use pocketmine\level\particle\LargeExplodeParticle;
use pocketmine\level\particle\LavaDripParticle;
use pocketmine\level\particle\LavaParticle;
use pocketmine\level\particle\Particle;
@ -130,10 +131,10 @@ class ParticleCommand extends VanillaCommand{
switch($name){
case "explode":
return new ExplodeParticle($pos);
case "largeexplode":
return new LargeExplodeParticle($pos);
case "hugeexplosion":
return new HugeExplodeParticle($pos);
case "hugeexplosionseed":
return new HugeExplodeSeedParticle($pos);
case "bubble":
return new BubbleParticle($pos);
case "splash":
@ -144,7 +145,7 @@ class ParticleCommand extends VanillaCommand{
case "crit":
return new CriticalParticle($pos);
case "smoke":
return new SmokeParticle($pos, $data !== null ? $data : 0);
return new SmokeParticle($pos, $data ?? 0);
case "spell":
return new EnchantParticle($pos);
case "instantspell":
@ -163,7 +164,7 @@ class ParticleCommand extends VanillaCommand{
case "lava":
return new LavaParticle($pos);
case "reddust":
return new RedstoneParticle($pos, $data !== null ? $data : 1);
return new RedstoneParticle($pos, $data ?? 1);
case "snowballpoof":
return new ItemBreakParticle($pos, Item::get(Item::SNOWBALL));
case "slime":
@ -179,9 +180,9 @@ class ParticleCommand extends VanillaCommand{
}
break;
case "heart":
return new HeartParticle($pos, $data !== null ? $data : 0);
return new HeartParticle($pos, $data ?? 0);
case "ink":
return new InkParticle($pos, $data !== null ? $data : 0);
return new InkParticle($pos, $data ?? 0);
case "droplet":
return new RainSplashParticle($pos);
case "enchantmenttable":
@ -190,6 +191,8 @@ class ParticleCommand extends VanillaCommand{
return new HappyVillagerParticle($pos);
case "angryvillager":
return new AngryVillagerParticle($pos);
case "forcefield":
return new BlockForceFieldParticle($pos, $data ?? 0);
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level\particle;
use pocketmine\math\Vector3;
class BlockForceFieldParticle extends GenericParticle{
public function __construct(Vector3 $pos, int $data = 0){
parent::__construct($pos, Particle::TYPE_BLOCK_FORCE_FIELD, $data); //TODO: proper encode/decode of data
}
}

View File

@ -23,8 +23,8 @@ namespace pocketmine\level\particle;
use pocketmine\math\Vector3;
class LargeExplodeParticle extends GenericParticle{
class HugeExplodeSeedParticle extends GenericParticle{
public function __construct(Vector3 $pos){
parent::__construct($pos, Particle::TYPE_LARGE_EXPLODE);
parent::__construct($pos, Particle::TYPE_HUGE_EXPLODE_SEED);
}
}
}

View File

@ -28,36 +28,42 @@ abstract class Particle extends Vector3{
const TYPE_BUBBLE = 1;
const TYPE_CRITICAL = 2;
const TYPE_SMOKE = 3;
const TYPE_EXPLODE = 4;
const TYPE_WHITE_SMOKE = 5;
const TYPE_FLAME = 6;
const TYPE_LAVA = 7;
const TYPE_LARGE_SMOKE = 8;
const TYPE_REDSTONE = 9;
const TYPE_ITEM_BREAK = 10;
const TYPE_SNOWBALL_POOF = 11;
const TYPE_LARGE_EXPLODE = 12;
const TYPE_HUGE_EXPLODE = 13;
const TYPE_MOB_FLAME = 14;
const TYPE_HEART = 15;
const TYPE_TERRAIN = 16;
const TYPE_TOWN_AURA = 17;
const TYPE_PORTAL = 18;
const TYPE_WATER_SPLASH = 19;
const TYPE_WATER_WAKE = 20;
const TYPE_DRIP_WATER = 21;
const TYPE_DRIP_LAVA = 22;
const TYPE_DUST = 23;
const TYPE_MOB_SPELL = 24;
const TYPE_MOB_SPELL_AMBIENT = 25;
const TYPE_MOB_SPELL_INSTANTANEOUS = 26;
const TYPE_INK = 27;
const TYPE_SLIME = 28;
const TYPE_RAIN_SPLASH = 29;
const TYPE_VILLAGER_ANGRY = 30;
const TYPE_VILLAGER_HAPPY = 31;
const TYPE_ENCHANTMENT_TABLE = 32;
const TYPE_BLOCK_FORCE_FIELD = 3;
const TYPE_SMOKE = 4;
const TYPE_EXPLODE = 5; //actually steam
const TYPE_WHITE_SMOKE = 6; //also steam, maybe bigger?
const TYPE_FLAME = 7;
const TYPE_LAVA = 8;
const TYPE_LARGE_SMOKE = 9;
const TYPE_REDSTONE = 10;
const TYPE_RISING_RED_DUST = 11;
const TYPE_ITEM_BREAK = 12;
const TYPE_SNOWBALL_POOF = 13;
const TYPE_HUGE_EXPLODE = 14;
const TYPE_HUGE_EXPLODE_SEED = 15;
const TYPE_MOB_FLAME = 16;
const TYPE_HEART = 17;
const TYPE_TERRAIN = 18;
const TYPE_SUSPENDED_TOWN = 19, TYPE_TOWN_AURA = 19;
const TYPE_PORTAL = 20;
const TYPE_SPLASH = 21, TYPE_WATER_SPLASH = 21;
const TYPE_WATER_WAKE = 22;
const TYPE_DRIP_WATER = 23;
const TYPE_DRIP_LAVA = 24;
const TYPE_FALLING_DUST = 25, TYPE_DUST = 25;
const TYPE_MOB_SPELL = 26;
const TYPE_MOB_SPELL_AMBIENT = 27;
const TYPE_MOB_SPELL_INSTANTANEOUS = 28;
const TYPE_INK = 29;
const TYPE_SLIME = 30;
const TYPE_RAIN_SPLASH = 31;
const TYPE_VILLAGER_ANGRY = 32;
const TYPE_VILLAGER_HAPPY = 33;
const TYPE_ENCHANTMENT_TABLE = 34;
const TYPE_TRACKING_EMITTER = 35;
const TYPE_NOTE = 36;
//37 yet another SpellParticle of some description
const TYPE_CARROT = 38;
/**
* @return DataPacket|DataPacket[]