the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 81 lines 2.2 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.h" 3#include "net.minecraft.world.phys.h" 4#include "net.minecraft.world.damagesource.h" 5#include "net.minecraft.world.level.tile.h" 6#include "net.minecraft.world.level.h" 7#include "JavaMath.h" 8#include "DragonFireball.h" 9 10 11 12const double DragonFireball::SPLASH_RANGE = 4.0; 13const double DragonFireball::SPLASH_RANGE_SQ = DragonFireball::SPLASH_RANGE * DragonFireball::SPLASH_RANGE; 14 15DragonFireball::DragonFireball(Level *level) : Fireball(level) 16{ 17 setSize(5 / 16.0f, 5 / 16.0f); 18} 19 20DragonFireball::DragonFireball(Level *level, shared_ptr<LivingEntity> mob, double xa, double ya, double za) : Fireball(level, mob, xa, ya, za) 21{ 22 setSize(5 / 16.0f, 5 / 16.0f); 23} 24 25DragonFireball::DragonFireball(Level *level, double x, double y, double z, double xa, double ya, double za) : Fireball(level, x, y, z, xa, ya, za) 26{ 27 setSize(5 / 16.0f, 5 / 16.0f); 28} 29 30void DragonFireball::onHit(HitResult *res) 31{ 32 if (!level->isClientSide) 33 { 34 AABB *aoe = bb->grow(SPLASH_RANGE, SPLASH_RANGE / 2, SPLASH_RANGE); 35 vector<shared_ptr<Entity> > *entitiesOfClass = level->getEntitiesOfClass(typeid(LivingEntity), aoe); 36 37 if (entitiesOfClass != NULL && !entitiesOfClass->empty()) 38 { 39 //for (Entity e : entitiesOfClass) 40 for( AUTO_VAR(it, entitiesOfClass->begin()); it != entitiesOfClass->end(); ++it) 41 { 42 //shared_ptr<Entity> e = *it; 43 shared_ptr<LivingEntity> e = dynamic_pointer_cast<LivingEntity>( *it ); 44 double dist = distanceToSqr(e); 45 if (dist < SPLASH_RANGE_SQ) 46 { 47 double scale = 1.0 - (sqrt(dist) / SPLASH_RANGE); 48 if (e == res->entity) 49 { 50 scale = 1; 51 } 52 e->hurt(DamageSource::dragonbreath, 8*scale); 53 } 54 } 55 } 56 delete entitiesOfClass; 57 level->levelEvent(LevelEvent::ENDERDRAGON_FIREBALL_SPLASH, (int) Math::round(x), (int) Math::round(y), (int) Math::round(z), 0); 58 59 remove(); 60 } 61} 62 63bool DragonFireball::isPickable() 64{ 65 return false; 66} 67 68bool DragonFireball::hurt(DamageSource *source, float damage) 69{ 70 return false; 71} 72 73ePARTICLE_TYPE DragonFireball::getTrailParticleType() 74{ 75 return eParticleType_dragonbreath; 76} 77 78bool DragonFireball::shouldBurn() 79{ 80 return false; 81}