diff --git a/Minecraft.Client/Common/App_enums.h b/Minecraft.Client/Common/App_enums.h index 994ca58f..73644ac5 100644 --- a/Minecraft.Client/Common/App_enums.h +++ b/Minecraft.Client/Common/App_enums.h @@ -444,6 +444,8 @@ enum eMinecraftColour eMinecraftColour_Mob_Horse_Colour2, eMinecraftColour_Mob_Rabbit_Colour1, eMinecraftColour_Mob_Rabbit_Colour2, + eMinecraftColour_Mob_Endermite_Colour1, + eMinecraftColour_Mob_Endermite_Colour2, eMinecraftColour_Armour_Default_Leather_Colour, diff --git a/Minecraft.Client/Common/Colours/ColourTable.cpp b/Minecraft.Client/Common/Colours/ColourTable.cpp index 3bb0999d..6fc40db5 100644 --- a/Minecraft.Client/Common/Colours/ColourTable.cpp +++ b/Minecraft.Client/Common/Colours/ColourTable.cpp @@ -262,6 +262,9 @@ const wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] = L"Mob_Horse_Colour2", L"Mob_Rabbit_Colour1", L"Mob_Rabbit_Colour2", + L"Mob_Endermite_Colour1", + L"Mob_Endermite_Colour2", + L"Armour_Default_Leather_Colour", diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp index 20ca15d2..984b6e37 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp @@ -431,6 +431,7 @@ void IUIScene_CreativeMenu::staticCtor() ITEM_AUX(Item::spawnEgg_Id, 96); // Mooshroom ITEM_AUX(Item::spawnEgg_Id, 98); // Ozelot ITEM_AUX(Item::spawnEgg_Id, 100); // Horse + ITEM_AUX(Item::spawnEgg_Id, 67); // Endermite ITEM_AUX(Item::spawnEgg_Id, 100 | ((EntityHorse::TYPE_DONKEY + 1) << 12) ); // Donkey ITEM_AUX(Item::spawnEgg_Id, 100 | ((EntityHorse::TYPE_MULE + 1) << 12)); // Mule diff --git a/Minecraft.Client/Common/res/1_2_2/mob/endermite.png b/Minecraft.Client/Common/res/1_2_2/mob/endermite.png new file mode 100644 index 00000000..adc6c7fe Binary files /dev/null and b/Minecraft.Client/Common/res/1_2_2/mob/endermite.png differ diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/colours.col b/Minecraft.Client/Common/res/TitleUpdate/res/colours.col index 89af0a11..8c58f862 100644 Binary files a/Minecraft.Client/Common/res/TitleUpdate/res/colours.col and b/Minecraft.Client/Common/res/TitleUpdate/res/colours.col differ diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/colours.xml b/Minecraft.Client/Common/res/TitleUpdate/res/colours.xml index a9abf9ac..57c4a334 100644 --- a/Minecraft.Client/Common/res/TitleUpdate/res/colours.xml +++ b/Minecraft.Client/Common/res/TitleUpdate/res/colours.xml @@ -280,6 +280,8 @@ if __name__=="__main__": notecolors() + + diff --git a/Minecraft.Client/EndermiteModel.cpp b/Minecraft.Client/EndermiteModel.cpp new file mode 100644 index 00000000..d6e32ad6 --- /dev/null +++ b/Minecraft.Client/EndermiteModel.cpp @@ -0,0 +1,73 @@ +#include "stdafx.h" +#include "EndermiteModel.h" +#include "Cube.h" +#include "..\Minecraft.World\Mth.h" +#include "ModelPart.h" + + +const int EndermiteModel::BODY_SIZES[BODY_COUNT][3] = { + { 4, 3, 2 }, + { 6, 4, 5 }, + { 3, 3, 1 }, + { 1, 2, 1 } +}; + + +const int EndermiteModel::BODY_TEXS[BODY_COUNT][2] = { + { 0, 0 }, + { 0, 5 }, + { 0, 14 }, + { 0, 18 } +}; + +EndermiteModel::EndermiteModel() +{ + bodyParts = ModelPartArray(BODY_COUNT); + float placement = -3.5f; + + for (unsigned int i = 0; i < bodyParts.length; i++) + { + bodyParts[i] = new ModelPart(this, BODY_TEXS[i][0], BODY_TEXS[i][1]); + bodyParts[i]->addBox(BODY_SIZES[i][0] * -0.5f, 0, BODY_SIZES[i][2] * -0.5f, BODY_SIZES[i][0], BODY_SIZES[i][1], BODY_SIZES[i][2]); + bodyParts[i]->setPos(0.0f, 24.0f - static_cast(BODY_SIZES[i][1]), placement); + zPlacement[i] = placement; + + if (i < bodyParts.length - 1) + { + placement += (BODY_SIZES[i][2] + BODY_SIZES[i + 1][2]) * .5f; + } + } + + + + + for (unsigned int i = 0; i < bodyParts.length; i++) + { + bodyParts[i]->compile(1.0f/16.0f); + } +} + +int EndermiteModel::modelVersion() +{ + return 38; +} + +void EndermiteModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +{ + setupAnim(time, r, bob, yRot, xRot, scale, entity); + + for (unsigned int i = 0; i < bodyParts.length; i++) + { + bodyParts[i]->render(scale, usecompiled); + } +} + +void EndermiteModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr entity, unsigned int uiBitmaskOverrideAnim) +{ + for (unsigned int i = 0; i < bodyParts.length; i++) + { + + bodyParts[i]->yRot = Mth::cos(bob * .9f + i * .15f * PI) * PI * .01f * (1 + abs(static_cast(i) - 2)); + bodyParts[i]->x = Mth::sin(bob * .9f + i * .15f * PI) * PI * .1f * abs(static_cast(i) - 2); + } +} \ No newline at end of file diff --git a/Minecraft.Client/EndermiteModel.h b/Minecraft.Client/EndermiteModel.h new file mode 100644 index 00000000..5599844c --- /dev/null +++ b/Minecraft.Client/EndermiteModel.h @@ -0,0 +1,24 @@ +#pragma once + +#include "Model.h" + +class EndermiteModel : public Model +{ + +private: + static const int BODY_COUNT = 4; + +private: + ModelPartArray bodyParts; + float zPlacement[BODY_COUNT]; + + static const int BODY_SIZES[BODY_COUNT][3]; + static const int BODY_TEXS[BODY_COUNT][2]; + +public: + EndermiteModel(); + + int modelVersion(); + void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr entity, unsigned int uiBitmaskOverrideAnim=0); +}; \ No newline at end of file diff --git a/Minecraft.Client/EndermiteRenderer.cpp b/Minecraft.Client/EndermiteRenderer.cpp new file mode 100644 index 00000000..25af1b63 --- /dev/null +++ b/Minecraft.Client/EndermiteRenderer.cpp @@ -0,0 +1,30 @@ +#include "stdafx.h" +#include "EndermiteRenderer.h" +#include "..\Minecraft.World\net.minecraft.world.entity.monster.h" +#include "EndermiteModel.h" + +ResourceLocation EndermiteRenderer::ENDERMITE_LOCATION(TN_MOB_ENDERMITE); + +EndermiteRenderer::EndermiteRenderer() : MobRenderer(new EndermiteModel(), 0.3f) +{ +} + +float EndermiteRenderer::getFlipDegrees(shared_ptr spider) +{ + return 180; +} + +void EndermiteRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +{ + MobRenderer::render(_mob, x, y, z, rot, a); +} + +ResourceLocation *EndermiteRenderer::getTextureLocation(shared_ptr mob) +{ + return &ENDERMITE_LOCATION; +} + +int EndermiteRenderer::prepareArmor(shared_ptr _silverfish, int layer, float a) +{ + return -1; +} \ No newline at end of file diff --git a/Minecraft.Client/EndermiteRenderer.h b/Minecraft.Client/EndermiteRenderer.h new file mode 100644 index 00000000..30161cad --- /dev/null +++ b/Minecraft.Client/EndermiteRenderer.h @@ -0,0 +1,24 @@ +#pragma once +#include "MobRenderer.h" + +class Endermite; + +class EndermiteRenderer : public MobRenderer +{ +private: + //int modelVersion; + static ResourceLocation ENDERMITE_LOCATION; + +public: + EndermiteRenderer(); + +protected: + float getFlipDegrees(shared_ptr spider); + +public: + virtual void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + virtual ResourceLocation *getTextureLocation(shared_ptr mob); + +protected: + virtual int prepareArmor(shared_ptr _silverfish, int layer, float a); +}; diff --git a/Minecraft.Client/EntityRenderDispatcher.cpp b/Minecraft.Client/EntityRenderDispatcher.cpp index bf680ac7..59d3f6c5 100644 --- a/Minecraft.Client/EntityRenderDispatcher.cpp +++ b/Minecraft.Client/EntityRenderDispatcher.cpp @@ -83,6 +83,7 @@ #include "CaveSpiderRenderer.h" #include "RabbitRenderer.h" #include "ArmorStandRenderer.h" +#include "EndermiteRenderer.h" #include "MobRenderer.h" double EntityRenderDispatcher::xOff = 0.0; @@ -173,6 +174,7 @@ EntityRenderDispatcher::EntityRenderDispatcher() renderers[eTYPE_LIGHTNINGBOLT] = new LightningBoltRenderer(); renderers[eTYPE_ARMORSTAND] = new ArmorStandRenderer(); + renderers[eTYPE_ENDERMITE] = new EndermiteRenderer(); glDisable(GL_LIGHTING); for( auto& it : renderers ) diff --git a/Minecraft.Client/Minecraft.Client.vcxproj b/Minecraft.Client/Minecraft.Client.vcxproj index 602a2e2d..24dc092d 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj +++ b/Minecraft.Client/Minecraft.Client.vcxproj @@ -10640,6 +10640,8 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU + + @@ -33705,6 +33707,8 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU + + diff --git a/Minecraft.Client/Minecraft.Client.vcxproj.filters b/Minecraft.Client/Minecraft.Client.vcxproj.filters index ab76d9b4..9cc2d099 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj.filters +++ b/Minecraft.Client/Minecraft.Client.vcxproj.filters @@ -3805,6 +3805,12 @@ net\minecraft\client\renderer\entity + + net\minecraft\client\model + + + net\minecraft\client\renderer\entity + @@ -5973,6 +5979,12 @@ net\minecraft\client\renderer\entity + + net\minecraft\client\model + + + net\minecraft\client\renderer\entity + diff --git a/Minecraft.Client/Textures.cpp b/Minecraft.Client/Textures.cpp index 6ee169d5..dacfd1c9 100644 --- a/Minecraft.Client/Textures.cpp +++ b/Minecraft.Client/Textures.cpp @@ -176,6 +176,11 @@ const wchar_t *Textures::preLoaded[TN_COUNT] = //L"item/christmas", //L"item/christmas_double", + + + + L"mob/endermite", + #ifdef _LARGE_WORLDS L"misc/additionalmapicons", #endif diff --git a/Minecraft.Client/Textures.h b/Minecraft.Client/Textures.h index f28e3660..e35f8bad 100644 --- a/Minecraft.Client/Textures.h +++ b/Minecraft.Client/Textures.h @@ -163,6 +163,11 @@ typedef enum _TEXTURE_NAME //TN_TILE_XMAS_CHEST, //TN_TILE_LARGE_XMAS_CHEST, + + + TN_MOB_ENDERMITE, + + #ifdef _LARGE_WORLDS TN_MISC_ADDITIONALMAPICONS, #endif diff --git a/Minecraft.World/Class.h b/Minecraft.World/Class.h index a5cd626f..c4463f66 100644 --- a/Minecraft.World/Class.h +++ b/Minecraft.World/Class.h @@ -169,6 +169,8 @@ enum eINSTANCEOF eTYPE_WITCH = eTYPE_MONSTER | eTYPE_VALID_IN_SPAWNER_FLAG | 0x7, eTYPE_WITHERBOSS = eTYPE_MONSTER | eTYPE_VALID_IN_SPAWNER_FLAG | 0x8, + eTYPE_ENDERMITE = eTYPE_MONSTER | eTYPE_VALID_IN_SPAWNER_FLAG | 0x10, + eTYPE_AMBIENT = eTYPE_MOB | BIT_AMBIENT_MOB, eTYPE_BAT = eTYPE_AMBIENT | eTYPE_VALID_IN_SPAWNER_FLAG | 0x1, @@ -484,7 +486,7 @@ public: classes->push_back( SUBCLASS(eTYPE_MULTIENTITY_MOB_PART )->addParent( eTYPE_ENTITY ) ); classes->push_back( SUBCLASS(eTYPE_NETHER_SPHERE )->addParent( eTYPE_ENTITY ) ); classes->push_back( SUBCLASS(eTYPE_ENDER_CRYSTAL )->addParent( eTYPE_ENTITY ) ); - + classes->push_back( SUBCLASS(eTYPE_ENDERMITE )->addParent( eTYPE_MONSTER)->addParent(eTYPE_VALID_IN_SPAWNER_FLAG ) ); classes->push_back( SUBCLASS(eType_BREAKINGITEMPARTICLE)->addParent(eTYPE_ENTITY) ); classes->push_back( SUBCLASS(eType_BUBBLEPARTICLE)->addParent(eTYPE_ENTITY) ); classes->push_back( SUBCLASS(eType_EXPLODEPARTICLE)->addParent(eTYPE_ENTITY) ); diff --git a/Minecraft.World/EnderMan.cpp b/Minecraft.World/EnderMan.cpp index da469a3a..4e28c2c9 100644 --- a/Minecraft.World/EnderMan.cpp +++ b/Minecraft.World/EnderMan.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "stdafx.h" #include "net.minecraft.world.entity.player.h" #include "net.minecraft.world.entity.h" #include "net.minecraft.world.entity.ai.attributes.h" @@ -12,6 +12,10 @@ #include "..\Minecraft.Client\Textures.h" #include "EnderMan.h" +#include "Endermite.h" + + + AttributeModifier *EnderMan::SPEED_MODIFIER_ATTACKING = (new AttributeModifier(eModifierId_MOB_ENDERMAN_ATTACKSPEED, 6.2f, AttributeModifier::OPERATION_ADDITION))->setSerialize(false); bool EnderMan::MAY_TAKE[256]; @@ -52,6 +56,7 @@ EnderMan::EnderMan(Level *level) : Monster( level ) setSize(0.6f, 2.9f); footSize = 1; + } void EnderMan::registerAttributes() @@ -89,32 +94,51 @@ void EnderMan::readAdditionalSaveData(CompoundTag *tag) shared_ptr EnderMan::findAttackTarget() { #ifndef _FINAL_BUILD - if(app.GetMobsDontAttackEnabled()) - { - return shared_ptr(); - } + if(app.GetMobsDontAttackEnabled()) + { + return shared_ptr(); + } #endif - shared_ptr player = level->getNearestAttackablePlayer(shared_from_this(), 64); - if (player != nullptr) - { - if (isLookingAtMe(player)) - { - aggroedByPlayer = true; - if (aggroTime == 0) level->playEntitySound(player, eSoundType_MOB_ENDERMAN_STARE, 1, 1); - if (aggroTime++ == 5) - { - aggroTime = 0; - setCreepy(true); - return player; - } - } - else - { - aggroTime = 0; - } - } - return nullptr; + + vector> *entities = level->getEntitiesOfClass(typeid(Endermite), bb->grow(64.0f, 10.0f, 64.0f)); + + if (entities != nullptr) + { + for (auto it = entities->begin(); it != entities->end(); ++it) + { + shared_ptr mite = dynamic_pointer_cast(*it); + + if (mite != nullptr) + { + setCreepy(true); + return mite; + } + } + } + + + shared_ptr player = level->getNearestAttackablePlayer(shared_from_this(), 64); + if (player != nullptr) + { + if (isLookingAtMe(player)) + { + aggroedByPlayer = true; + if (aggroTime == 0) level->playEntitySound(player, eSoundType_MOB_ENDERMAN_STARE, 1, 1); + if (aggroTime++ == 5) + { + aggroTime = 0; + setCreepy(true); + return player; + } + } + else + { + aggroTime = 0; + } + } + + return nullptr; } bool EnderMan::isLookingAtMe(shared_ptr player) diff --git a/Minecraft.World/EnderMan.h b/Minecraft.World/EnderMan.h index 10fb2b37..66dc8c19 100644 --- a/Minecraft.World/EnderMan.h +++ b/Minecraft.World/EnderMan.h @@ -63,4 +63,5 @@ public: virtual bool hurt(DamageSource *source, float damage); bool isCreepy(); void setCreepy(bool creepy); + }; \ No newline at end of file diff --git a/Minecraft.World/Endermite.cpp b/Minecraft.World/Endermite.cpp new file mode 100644 index 00000000..f1ee2ab1 --- /dev/null +++ b/Minecraft.World/Endermite.cpp @@ -0,0 +1,162 @@ +#include "stdafx.h" +#include "net.minecraft.world.level.h" +#include "net.minecraft.world.phys.h" +#include "net.minecraft.world.damagesource.h" +#include "net.minecraft.world.entity.ai.attributes.h" +#include "net.minecraft.world.entity.monster.h" +#include "net.minecraft.h" +#include "..\Minecraft.Client\Textures.h" +#include "Endermite.h" +#include "SoundTypes.h" +#include "Random.h" +#include "net.minecraft.world.entity.ai.goal.h" +#include "net.minecraft.world.entity.ai.goal.target.h" +#include "net.minecraft.world.entity.ai.navigation.h" +#include "net.minecraft.world.entity.player.h" +#include "EnderMan.h" + +class EndermiteHurtByTargetGoal : public HurtByTargetGoal +{ +public: + EndermiteHurtByTargetGoal(Endermite* mob, bool callHelp) : HurtByTargetGoal(mob, callHelp) {} + +protected: + virtual bool canAttack(shared_ptr target, bool allowInvulnerable) override + { + // If the entity that hit us is an Enderman, ignore it + if (target != nullptr && target->instanceof(eTYPE_ENDERMAN)) + { + return false; + } + + // or use the standard logic + return HurtByTargetGoal::canAttack(target, allowInvulnerable); + } +}; + + +Endermite::Endermite(Level *level) : Monster(level), lifetime(0), playerSpawned(false) +{ + this->defineSynchedData(); + registerAttributes(); + setHealth(getMaxHealth()); + + setSize(0.4f, 0.3f); + xp = 3; + + getNavigation()->setCanOpenDoors(false); + goalSelector.addGoal(1, new FloatGoal(this)); + goalSelector.addGoal(2, new MeleeAttackGoal(this, 1.0, false)); + goalSelector.addGoal(3, new RandomStrollGoal(this, 1.0)); + goalSelector.addGoal(4, new LookAtPlayerGoal(this, typeid(Player), 8)); + goalSelector.addGoal(5, new RandomLookAroundGoal(this)); + + targetSelector.addGoal(1, new EndermiteHurtByTargetGoal(this, true)); + targetSelector.addGoal(2, new NearestAttackableTargetGoal(this, typeid(Player), 0, true)); + + +} + +void Endermite::registerAttributes() +{ + Monster::registerAttributes(); + + + getAttribute(SharedMonsterAttributes::FOLLOW_RANGE)->setBaseValue(8.0f); + + getAttribute(SharedMonsterAttributes::MAX_HEALTH)->setBaseValue(8.0f); + getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->setBaseValue(0.25f); + getAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->setBaseValue(2.0f); +} + +bool Endermite::makeStepSound() +{ + return false; +} + +shared_ptr Endermite::findAttackTarget() +{ +#ifndef _FINAL_BUILD + if(app.GetMobsDontAttackEnabled()) + { + return shared_ptr(); + } +#endif + + double maxDist = 8; + return level->getNearestAttackablePlayer(shared_from_this(), maxDist); +} + +int Endermite::getAmbientSound() +{ + return eSoundType_MOB_SILVERFISH_AMBIENT; +} + +int Endermite::getHurtSound() +{ + return eSoundType_MOB_SILVERFISH_HURT; +} + +int Endermite::getDeathSound() +{ + return eSoundType_MOB_SILVERFISH_DEATH; +} + +void Endermite::playStepSound(int xt, int yt, int zt, int t) +{ + playSound(eSoundType_MOB_SILVERFISH_STEP, 0.15f, 1); +} + +int Endermite::getDeathLoot() +{ + return 0; +} + +void Endermite::tick() +{ + yBodyRot = yRot; + + Monster::tick(); + + if (level->isClientSide) + { + + for (int i = 0; i < 2; i++) + { + level->addParticle(eParticleType_ender, x + (random->nextDouble() - 0.5) * bbWidth, y + random->nextDouble() * bbHeight - 0.25f, z + (random->nextDouble() - 0.5) * bbWidth, + (random->nextDouble() - 0.5) * 2, -random->nextDouble(), (random->nextDouble() - 0.5) * 2); + } + } + else + { + if (!this->isPersistenceRequired()) + { + ++lifetime; + } + + if (lifetime >= 2400) + { + remove(); + } + } +} + + + + + +bool Endermite::canSpawn() +{ + if (Monster::canSpawn()) + { + shared_ptr nearestPlayer = level->getNearestPlayer(shared_from_this(), 5.0); + return nearestPlayer == nullptr; + } + return false; +} + +MobType Endermite::getMobType() +{ + return ARTHROPOD; +} + diff --git a/Minecraft.World/Endermite.h b/Minecraft.World/Endermite.h new file mode 100644 index 00000000..04bd9198 --- /dev/null +++ b/Minecraft.World/Endermite.h @@ -0,0 +1,44 @@ +#pragma once + +#include "Monster.h" + +class Endermite : public Monster +{ +public: + eINSTANCEOF GetType() { return eTYPE_ENDERMITE; } + static Entity *create(Level *level) { return new Endermite(level); } + +private: + int lifetime; + + bool playerSpawned = false; + +public: + Endermite(Level *level); + +protected: + virtual void registerAttributes(); + virtual bool makeStepSound(); + virtual shared_ptr findAttackTarget(); + + virtual int getAmbientSound(); + virtual int getHurtSound(); + virtual int getDeathSound(); + +public: + virtual void tick(); + virtual bool useNewAi() { return true; } + + +protected: + virtual void playStepSound(int xt, int yt, int zt, int t); + virtual int getDeathLoot(); + +public: + virtual bool canSpawn(); + virtual MobType getMobType(); + bool isSpawnedByPlayer() { return playerSpawned; } + void setSpawnedByPlayer(bool spawned) { playerSpawned = spawned; } + + +}; \ No newline at end of file diff --git a/Minecraft.World/EntityIO.cpp b/Minecraft.World/EntityIO.cpp index 0395c941..fa5f569f 100644 --- a/Minecraft.World/EntityIO.cpp +++ b/Minecraft.World/EntityIO.cpp @@ -109,10 +109,13 @@ void EntityIO::staticCtor() setId(EntityHorse::create, eTYPE_HORSE, L"EntityHorse", 100, eMinecraftColour_Mob_Horse_Colour1, eMinecraftColour_Mob_Horse_Colour2, IDS_HORSE); setId(Rabbit::create, eTYPE_RABBIT, L"Rabbit", 101, eMinecraftColour_Mob_Rabbit_Colour1, - eMinecraftColour_Mob_Rabbit_Colour2, IDS_RABBIT);//change IDS_RABBIT later + eMinecraftColour_Mob_Rabbit_Colour2, IDS_RABBIT); setId(ArmorStand::create, eTYPE_ARMORSTAND, L"ArmorStand", 102); + setId(Endermite::create, eTYPE_ENDERMITE, L"Endermite", 67, + eMinecraftColour_Mob_Endermite_Colour1, + eMinecraftColour_Mob_Endermite_Colour2, IDS_RABBIT);//change IDS_Endermite later setId(Villager::create, eTYPE_VILLAGER, L"Villager", 120, eMinecraftColour_Mob_Villager_Colour1, eMinecraftColour_Mob_Villager_Colour2, IDS_VILLAGER); diff --git a/Minecraft.World/Minecraft.World.vcxproj b/Minecraft.World/Minecraft.World.vcxproj index 7df40371..807a6cc0 100644 --- a/Minecraft.World/Minecraft.World.vcxproj +++ b/Minecraft.World/Minecraft.World.vcxproj @@ -2473,6 +2473,7 @@ + @@ -3560,6 +3561,7 @@ + diff --git a/Minecraft.World/Minecraft.World.vcxproj.filters b/Minecraft.World/Minecraft.World.vcxproj.filters index 61aae0d6..8d39f6ac 100644 --- a/Minecraft.World/Minecraft.World.vcxproj.filters +++ b/Minecraft.World/Minecraft.World.vcxproj.filters @@ -828,6 +828,7 @@ + @@ -1825,6 +1826,7 @@ + diff --git a/Minecraft.World/ThrownEnderpearl.cpp b/Minecraft.World/ThrownEnderpearl.cpp index c325f1c9..4607aa78 100644 --- a/Minecraft.World/ThrownEnderpearl.cpp +++ b/Minecraft.World/ThrownEnderpearl.cpp @@ -6,6 +6,7 @@ #include "..\Minecraft.Client\ServerPlayer.h" #include "..\Minecraft.Client\PlayerConnection.h" #include "ThrownEnderpearl.h" +#include "Endermite.h" @@ -56,6 +57,17 @@ void ThrownEnderpearl::onHit(HitResult *res) { if(!serverPlayer->connection->done && serverPlayer->level == this->level) { + + if (random->nextFloat() < 0.05f /* && level->getGameRules()->getBoolean("doMobSpawning") //for a future gamerule*/) + { + Endermite* endermite = new Endermite(level); + endermite->setSpawnedByPlayer(true); + + endermite->moveTo(serverPlayer->x, serverPlayer->y, serverPlayer->z, serverPlayer->yRot, serverPlayer->xRot); + level->addEntity(shared_ptr(endermite)); + } + + if (getOwner()->isRiding()) { getOwner()->ride(nullptr); diff --git a/Minecraft.World/net.minecraft.world.entity.monster.h b/Minecraft.World/net.minecraft.world.entity.monster.h index edeaf925..e016dcf1 100644 --- a/Minecraft.World/net.minecraft.world.entity.monster.h +++ b/Minecraft.World/net.minecraft.world.entity.monster.h @@ -16,6 +16,7 @@ #include "EnderMan.h" #include "Silverfish.h" + // 1.0.1 #include "Blaze.h" #include "LavaSlime.h" @@ -23,4 +24,7 @@ // 1.6.4 #include "RangedAttackMob.h" #include "SharedMonsterAttributes.h" -#include "Witch.h" \ No newline at end of file +#include "Witch.h" + +//TU 31 +#include "Endermite.h" \ No newline at end of file