the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "net.minecraft.world.level.h"
3#include "net.minecraft.world.entity.player.h"
4#include "net.minecraft.world.entity.projectile.h"
5#include "EnderpearlItem.h"
6#include "SoundTypes.h"
7
8EnderpearlItem::EnderpearlItem(int id) : Item(id)
9{
10 maxStackSize = 16;
11}
12
13bool EnderpearlItem::TestUse(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player)
14{
15 return true;
16}
17
18shared_ptr<ItemInstance> EnderpearlItem::use(shared_ptr<ItemInstance> instance, Level *level, shared_ptr<Player> player)
19{
20 // 4J-PB - Not sure why this was disabled for creative mode, so commenting out
21 //if (player->abilities.instabuild) return instance;
22 if (player->riding != NULL) return instance;
23 if (!player->abilities.instabuild)
24 {
25 instance->count--;
26 }
27
28 level->playEntitySound(player, eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f));
29 if (!level->isClientSide)
30 {
31 level->addEntity( shared_ptr<ThrownEnderpearl>( new ThrownEnderpearl(level, player) ) );
32 }
33 return instance;
34}