the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 63 lines 1.5 kB view raw
1#include "stdafx.h" 2#include "SharedConstants.h" 3#include "net.minecraft.world.entity.ai.attributes.h" 4#include "net.minecraft.world.entity.monster.h" 5#include "net.minecraft.world.effect.h" 6#include "net.minecraft.world.level.h" 7#include "net.minecraft.world.h" 8#include "..\Minecraft.Client\Textures.h" 9#include "CaveSpider.h" 10 11 12 13CaveSpider::CaveSpider(Level *level) : Spider(level) 14{ 15 // 4J Stu - This function call had to be moved here from the Entity ctor to ensure that the derived version of the function is called 16 registerAttributes(); 17 18 this->setSize(0.7f, 0.5f); 19} 20 21void CaveSpider::registerAttributes() 22{ 23 Spider::registerAttributes(); 24 25 getAttribute(SharedMonsterAttributes::MAX_HEALTH)->setBaseValue(12); 26} 27 28bool CaveSpider::doHurtTarget(shared_ptr<Entity> target) 29{ 30 if (Spider::doHurtTarget(target)) 31 { 32 if ( target->instanceof(eTYPE_LIVINGENTITY) ) 33 { 34 int poisonTime = 0; 35 if (level->difficulty <= Difficulty::EASY) 36 { 37 // No poison! 38 } 39 else if (level->difficulty == Difficulty::NORMAL) 40 { 41 poisonTime = 7; 42 } 43 else if (level->difficulty == Difficulty::HARD) 44 { 45 poisonTime = 15; 46 } 47 48 if (poisonTime > 0) 49 { 50 dynamic_pointer_cast<LivingEntity>(target)->addEffect(new MobEffectInstance(MobEffect::poison->id, poisonTime * SharedConstants::TICKS_PER_SECOND, 0)); 51 } 52 } 53 54 return true; 55 } 56 return false; 57} 58 59MobGroupData *CaveSpider::finalizeMobSpawn(MobGroupData *groupData, int extraData /*= 0*/) // 4J Added extraData param 60{ 61 // do nothing 62 return groupData; 63}