the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 52 lines 1.1 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.level.h" 3#include "net.minecraft.world.phys.h" 4#include "net.minecraft.world.damagesource.h" 5#include "net.minecraft.world.entity.monster.h" 6#include "Snowball.h" 7 8 9 10void Snowball::_init() 11{ 12 // 4J Stu - This function call had to be moved here from the Entity ctor to ensure that 13 // the derived version of the function is called 14 this->defineSynchedData(); 15} 16 17Snowball::Snowball(Level *level) : Throwable(level) 18{ 19 _init(); 20} 21 22Snowball::Snowball(Level *level, shared_ptr<LivingEntity> mob) : Throwable(level,mob) 23{ 24 _init(); 25} 26 27Snowball::Snowball(Level *level, double x, double y, double z) : Throwable(level,x,y,z) 28{ 29 _init(); 30} 31 32void Snowball::onHit(HitResult *res) 33{ 34 if (res->entity != NULL) 35 { 36 int damage = 0; 37 if ( res->entity->instanceof(eTYPE_BLAZE) ) 38 { 39 damage = 3; 40 } 41 42 DamageSource *damageSource = DamageSource::thrown(shared_from_this(), getOwner()); 43 res->entity->hurt(damageSource, damage); 44 delete damageSource; 45 } 46 for (int i = 0; i < 8; i++) 47 level->addParticle(eParticleType_snowballpoof, x, y, z, 0, 0, 0); 48 if (!level->isClientSide) 49 { 50 remove(); 51 } 52}