the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 149 lines 2.9 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.level.h" 3#include "net.minecraft.world.h" 4#include "net.minecraft.world.entity.ai.attributes.h" 5#include "net.minecraft.world.entity.monster.h" 6#include "net.minecraft.world.item.h" 7#include "..\Minecraft.Client\Textures.h" 8#include "LavaSlime.h" 9#include "SoundTypes.h" 10 11 12 13LavaSlime::LavaSlime(Level *level) : Slime(level) 14{ 15 // 4J Stu - This function call had to be moved here from the Entity ctor to ensure that 16 // the derived version of the function is called 17 // 4J Stu - The Slime ctor has already called this, and as we don't override it here don't need to call it 18 //this->defineSynchedData(); 19 registerAttributes(); 20 21 fireImmune = true; 22} 23 24void LavaSlime::registerAttributes() 25{ 26 Slime::registerAttributes(); 27 28 getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->setBaseValue(0.2f); 29} 30 31bool LavaSlime::canSpawn() 32{ 33 return level->difficulty > Difficulty::PEACEFUL && level->isUnobstructed(bb) && level->getCubes(shared_from_this(), bb)->empty() && !level->containsAnyLiquid(bb); 34} 35 36int LavaSlime::getArmorValue() 37{ 38 return getSize() * 3; 39} 40 41int LavaSlime::getLightColor(float a) 42{ 43 return 15 << 20 | 15 << 4; 44} 45 46float LavaSlime::getBrightness(float a) 47{ 48 return 1.0f; 49} 50 51ePARTICLE_TYPE LavaSlime::getParticleName() 52{ 53 return eParticleType_flame; 54} 55 56shared_ptr<Slime> LavaSlime::createChild() 57{ 58 return shared_ptr<LavaSlime>( new LavaSlime(level) ); 59} 60 61int LavaSlime::getDeathLoot() 62{ 63 // 4J-PB - brought forward the magma cream drops 64 return Item::magmaCream_Id; 65} 66 67void LavaSlime::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) 68{ 69 int loot = getDeathLoot(); 70 if (loot > 0 && getSize() > 1) 71 { 72 int count = random->nextInt(4) - 2; 73 if (playerBonusLevel > 0) 74 { 75 count += random->nextInt(playerBonusLevel + 1); 76 } 77 for (int i = 0; i < count; i++) 78 { 79 spawnAtLocation(loot, 1); 80 } 81 } 82} 83 84bool LavaSlime::isOnFire() 85{ 86 return false; 87} 88 89 90int LavaSlime::getJumpDelay() 91{ 92 return Slime::getJumpDelay() * 4; 93} 94 95void LavaSlime::decreaseSquish() 96{ 97 targetSquish = targetSquish * 0.90f; 98} 99 100void LavaSlime::jumpFromGround() 101{ 102 yd = 0.42f + getSize() * .1f; 103 hasImpulse = true; 104} 105 106void LavaSlime::causeFallDamage(float distance) 107{ 108} 109 110bool LavaSlime::isDealsDamage() 111{ 112 return true; 113} 114 115int LavaSlime::getAttackDamage() 116{ 117 return Slime::getAttackDamage() + 2; 118} 119 120int LavaSlime::getHurtSound() 121{ 122 return getSize() > 1 ? eSoundType_MOB_SLIME_BIG : eSoundType_MOB_SLIME_SMALL; 123} 124 125int LavaSlime::getDeathSound() 126{ 127 return getSize() > 1 ? eSoundType_MOB_SLIME_BIG : eSoundType_MOB_SLIME_SMALL; 128} 129 130int LavaSlime::getSquishSound() 131{ 132 if (getSize() > 1) 133 { 134 return eSoundType_MOB_MAGMACUBE_BIG; 135 } 136 return eSoundType_MOB_MAGMACUBE_SMALL; 137} 138 139bool LavaSlime::isInLava() 140{ 141 // hack that makes the lava slimes move freely on the bottom of the lava 142 // oceans 143 return false; 144} 145 146bool LavaSlime::doPlayLandSound() 147{ 148 return true; 149}