the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 55 lines 1.2 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.entity.h" 3#include "net.minecraft.world.level.h" 4#include "net.minecraft.world.level.tile.h" 5#include "JavaMath.h" 6#include "ThrownExpBottle.h" 7 8 9 10ThrownExpBottle::ThrownExpBottle(Level *level) : Throwable(level) 11{ 12} 13 14ThrownExpBottle::ThrownExpBottle(Level *level, shared_ptr<LivingEntity> mob) : Throwable(level,mob) 15{ 16} 17 18ThrownExpBottle::ThrownExpBottle(Level *level, double x, double y, double z) : Throwable(level, x, y, z) 19{ 20} 21 22 23float ThrownExpBottle::getGravity() 24{ 25 return 0.07f; 26} 27 28float ThrownExpBottle::getThrowPower() 29{ 30 return 0.7f; 31} 32 33float ThrownExpBottle::getThrowUpAngleOffset() 34{ 35 return -20; 36} 37 38void ThrownExpBottle::onHit(HitResult *res) 39{ 40 41 if (!level->isClientSide) 42 { 43 level->levelEvent(LevelEvent::PARTICLES_POTION_SPLASH, (int) Math::round(x), (int) Math::round(y), (int) Math::round(z), 0); 44 45 int xpCount = 3 + level->random->nextInt(5) + level->random->nextInt(5); 46 while (xpCount > 0) 47 { 48 int newCount = ExperienceOrb::getExperienceValue(xpCount); 49 xpCount -= newCount; 50 level->addEntity(shared_ptr<ExperienceOrb>( new ExperienceOrb(level, x, y, z, newCount) ) ); 51 } 52 53 remove(); 54 } 55}