Hello, I Am Experiencing A(n) Crafting Bug In My Local Hosted Minecraft Server. Every Time I Try To Craft Something Vanilla OR A Custom Crafted Recipe, It Seems To Be Working, Than It Retracts The Item Back Into Their Original Material(s). Please Help With My Issue. - DANRULEZ123
I found out an issue when I tried to use the custom crafting recipe i made, the issue was because i had more than exactly one of the item. try crafting with exactly the amount rather than just stacking fifty or something like how Vanilla works, say a diamond sword should use exactly two diamonds and one stick in their corresponding slots. Hope this helps.
Also, what I found out was when I used excessive enchants (over than vanilla max level). Or say, I added Custom Lore, etc. the error happens again, and I'm getting frustrated, I tried debugging by using many different recipes and checking on CraftItemEvent, and it doesn't seem to work except for the custom name only, this can be a big issue I think. Here's my entire code, I had a bunch of Dummies to test if the enchantments, or lore, or whatever works, but it seemed to me that only setCustomName() works. Might want to look into this. EDIT: I mean, they work, but only Custom Names would craft, add Enchantments or set Lore would cancel the crafting @DANRULEZ123 might want to check this out. Also, I'm on my actual server testing this out, like, hosted on my VPS, not local. So if you guys blame it for being a local server then, I'm suggesting that it has the same bug even on my VPS. Test these crafting recipes out in http://mps.uhc.us.to, it doesn't work for me. PHP: <?phpdeclare(strict_types=1);# MADE BY:# ______# / \ # /$$$$$$ | __ __ __ __ __ ______ ______ _______ ______# $$ \__$$/ / | / | / |/ | / | / \ / \ / \ / \# $$ \ $$ | $$ | $$ |$$ | $$ |/$$$$$$ |/$$$$$$ |$$$$$$$ |/$$$$$$ |# $$$$$$ |$$ | $$ | $$ |$$ | $$ |$$ | $$/ $$ $$ |$$ | $$ |$$ $$ |# / \__$$ |$$ \_$$ \_$$ |$$ \__$$ |$$ | $$$$$$$$/ $$ | $$ |$$$$$$$$/# $$ $$/ $$ $$ $$/ $$ $$ |$$ | $$ |$$ | $$ |$$ |# $$$$$$/ $$$$$/$$$$/ $$$$$$$ |$$/ $$$$$$$/ $$/ $$/ $$$$$$$/# / \__$$ | # $$ $$/ # $$$$$$/ namespace Swyrene\CustomCraft;use pocketmine\block\Block;use pocketmine\block\BlockFactory;use pocketmine\command\{Command, CommandSender};use pocketmine\event\block\BlockFormEvent;use pocketmine\event\Listener;use pocketmine\level\sound\FizzSound;use pocketmine\plugin\PluginBase;use pocketmine\utils\{Config, TextFormat as TF};use pocketmine\event\block\BlockBreakEvent;use pocketmine\item\Item;use pocketmine\math\Vector3;use pocketmine\item\enchantment\Enchantment;use pocketmine\item\enchantment\EnchantmentInstance;use pocketmine\inventory\ShapedRecipe;use pocketmine\event\inventory\CraftItemEvent;class CustomCraft extends PluginBase implements Listener { public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); # Obsidian Pickaxe $lp = Item::get(Item::DIAMOND_PICKAXE); $lp->setCustomName(TF::RESET.TF::RED."Obsidian Pickaxe"); $lpeff = new EnchantmentInstance(Enchantment::getEnchantment(Enchantment::EFFICIENCY)); $lpeff->setLevel(100); $lpunb = new EnchantmentInstance(Enchantment::getEnchantment(Enchantment::UNBREAKING)); $lpunb->setLevel(100); $lp->addEnchantment($lpeff); $lp->setLore([ TF::RESET.TF::LIGHT_PURPLE."Made with extereme heat, lava, iron, water, and sticks...", TF::RESET.TF::RED."The Obsidian Pickaxe".TF::RESET.TF::LIGHT_PURPLE." Destroys down anything it touches in an instant!", TF::RESET.TF::YELLOW."\nGives a 5 second haste upon breaking a block!" ]); $lpr = new ShapedRecipe(["AAA"," B "," B "],["A"=>Item::get(Item::OBSIDIAN),"B"=>Item::get(Item::STICK)],[$lp]); $lpr->registerToCraftingManager($this->getServer()->getCraftingManager()); #Dummy Item A $dummy = Item::get(Item::STONE); $dummy->setCustomName(TF::RESET.TF::LIGHT_PURPLE."Dummy"); $dummyr = new ShapedRecipe(["AAA","AAA","AAA"],["A"=>Item::get(Item::DIRT)],[$dummy]); $dummyr->registerToCraftingManager($this->getServer()->getCraftingManager()); # Dummy Item B $dummyb = Item::get(Item::STONE); $dummyb->setCustomName(TF::RESET.TF::LIGHT_PURPLE."Dummy"); $dummybeff = new EnchantmentInstance(Enchantment::getEnchantment(Enchantment::EFFICIENCY)); $dummybeff->setLevel(100); $dummyb->addEnchantment($dummybeff); $dummybr = new ShapedRecipe(["AAA","AAA","AAA"],["A"=>Item::get(Item::STONE)],[$dummyb]); $dummybr->registerToCraftingManager($this->getServer()->getCraftingManager()); # Dummy Item C $dummyc = Item::get(Item::STONE); $dummyc->setCustomName(TF::RESET.TF::LIGHT_PURPLE."Dummy"); $dummyc->setLore([ TF::RESET.TF::LIGHT_PURPLE."Dummy Item, Dispose of this..." ]); $dummycr = new ShapedRecipe(["AAA","AAA","AAA"],["A"=>Item::get(Item::STICK)],[$dummyc]); $dummycr->registerToCraftingManager($this->getServer()->getCraftingManager()); # Dummy Item D $dummyd = Item::get(Item::STONE); $dummyd->setCustomName(TF::RESET.TF::LIGHT_PURPLE."Dummy"); $dummydeff = new EnchantmentInstance(Enchantment::getEnchantment(Enchantment::EFFICIENCY)); $dummydeff->setLevel(100); $dummyd->addEnchantment($dummydeff); $dummyd->setLore([ TF::RESET.TF::LIGHT_PURPLE."Dummy Item, Dispose of this..." ]); $dummydr = new ShapedRecipe(["AAA","AAA","AAA"],["A"=>Item::get(Item::COAL)],[$dummyd]); $dummydr->registerToCraftingManager($this->getServer()->getCraftingManager()); } public function onCraft(CraftItemEvent $event){ $event->getLogger()->info(TF::YELLOW . "[Debug]" . TF::LIGHT_PURPLE . "CraftItemEvent Confirmed, crafted item: " . $event->getOutputs()); }} Also, to be honest, this should probably be moved to the Plugins->Development section.