mirror of
https://github.com/neoStudiosLCE/neoLegacy.git
synced 2026-06-08 22:12:56 +00:00
Endermite
This commit is contained in:
parent
b12d681255
commit
20db8dcdce
|
|
@ -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,
|
||||
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
BIN
Minecraft.Client/Common/res/1_2_2/mob/endermite.png
Normal file
BIN
Minecraft.Client/Common/res/1_2_2/mob/endermite.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 896 B |
Binary file not shown.
|
|
@ -280,6 +280,8 @@ if __name__=="__main__": notecolors()
|
|||
<colour name="Mob_Horse_Colour2" value="EEE500"/>
|
||||
<colour name="Mob_Rabbit_Colour1" value="995F40"/>
|
||||
<colour name="Mob_Rabbit_Colour2" value="734831"/>
|
||||
<colour name="Mob_Endermite_Colour1" value="161616"/>
|
||||
<colour name="Mob_Endermite_Colour2" value="6E6E6E"/>
|
||||
|
||||
<colour name="Armour_Default_Leather_Colour" value="A06540"/>
|
||||
|
||||
|
|
|
|||
73
Minecraft.Client/EndermiteModel.cpp
Normal file
73
Minecraft.Client/EndermiteModel.cpp
Normal file
|
|
@ -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<float>(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> 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> 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<int>(i) - 2));
|
||||
bodyParts[i]->x = Mth::sin(bob * .9f + i * .15f * PI) * PI * .1f * abs(static_cast<int>(i) - 2);
|
||||
}
|
||||
}
|
||||
24
Minecraft.Client/EndermiteModel.h
Normal file
24
Minecraft.Client/EndermiteModel.h
Normal file
|
|
@ -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> 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> entity, unsigned int uiBitmaskOverrideAnim=0);
|
||||
};
|
||||
30
Minecraft.Client/EndermiteRenderer.cpp
Normal file
30
Minecraft.Client/EndermiteRenderer.cpp
Normal file
|
|
@ -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<LivingEntity> spider)
|
||||
{
|
||||
return 180;
|
||||
}
|
||||
|
||||
void EndermiteRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
|
||||
{
|
||||
MobRenderer::render(_mob, x, y, z, rot, a);
|
||||
}
|
||||
|
||||
ResourceLocation *EndermiteRenderer::getTextureLocation(shared_ptr<Entity> mob)
|
||||
{
|
||||
return &ENDERMITE_LOCATION;
|
||||
}
|
||||
|
||||
int EndermiteRenderer::prepareArmor(shared_ptr<LivingEntity> _silverfish, int layer, float a)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
24
Minecraft.Client/EndermiteRenderer.h
Normal file
24
Minecraft.Client/EndermiteRenderer.h
Normal file
|
|
@ -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<LivingEntity> spider);
|
||||
|
||||
public:
|
||||
virtual void render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a);
|
||||
virtual ResourceLocation *getTextureLocation(shared_ptr<Entity> mob);
|
||||
|
||||
protected:
|
||||
virtual int prepareArmor(shared_ptr<LivingEntity> _silverfish, int layer, float a);
|
||||
};
|
||||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -10640,6 +10640,8 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
|||
<ClInclude Include="EnderDragonRenderer.h" />
|
||||
<ClInclude Include="EndermanModel.h" />
|
||||
<ClInclude Include="EndermanRenderer.h" />
|
||||
<ClInclude Include="EndermiteModel.h" />
|
||||
<ClInclude Include="EndermiteRenderer.h" />
|
||||
<ClInclude Include="EnderParticle.h" />
|
||||
<ClInclude Include="EntityRenderDispatcher.h" />
|
||||
<ClInclude Include="EntityRenderer.h" />
|
||||
|
|
@ -33705,6 +33707,8 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
|||
<ClCompile Include="EnderDragonRenderer.cpp" />
|
||||
<ClCompile Include="EndermanModel.cpp" />
|
||||
<ClCompile Include="EndermanRenderer.cpp" />
|
||||
<ClCompile Include="EndermiteModel.cpp" />
|
||||
<ClCompile Include="EndermiteRenderer.cpp" />
|
||||
<ClCompile Include="EnderParticle.cpp" />
|
||||
<ClCompile Include="EntityRenderDispatcher.cpp" />
|
||||
<ClCompile Include="EntityRenderer.cpp" />
|
||||
|
|
|
|||
|
|
@ -3805,6 +3805,12 @@
|
|||
<ClInclude Include="ArmorStandRenderer.h">
|
||||
<Filter>net\minecraft\client\renderer\entity</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EndermiteModel.h">
|
||||
<Filter>net\minecraft\client\model</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EndermiteRenderer.h">
|
||||
<Filter>net\minecraft\client\renderer\entity</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
|
@ -5973,6 +5979,12 @@
|
|||
<ClCompile Include="ArmorStandRenderer.cpp">
|
||||
<Filter>net\minecraft\client\renderer\entity</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EndermiteModel.cpp">
|
||||
<Filter>net\minecraft\client\model</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EndermiteRenderer.cpp">
|
||||
<Filter>net\minecraft\client\renderer\entity</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Library Include="Xbox\4JLibs\libs\4J_Render_d.lib">
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) );
|
||||
|
|
|
|||
|
|
@ -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<Entity> EnderMan::findAttackTarget()
|
||||
{
|
||||
#ifndef _FINAL_BUILD
|
||||
if(app.GetMobsDontAttackEnabled())
|
||||
{
|
||||
return shared_ptr<Player>();
|
||||
}
|
||||
if(app.GetMobsDontAttackEnabled())
|
||||
{
|
||||
return shared_ptr<Player>();
|
||||
}
|
||||
#endif
|
||||
|
||||
shared_ptr<Player> 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<shared_ptr<Entity>> *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<Endermite> mite = dynamic_pointer_cast<Endermite>(*it);
|
||||
|
||||
if (mite != nullptr)
|
||||
{
|
||||
setCreepy(true);
|
||||
return mite;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
shared_ptr<Player> 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> player)
|
||||
|
|
|
|||
|
|
@ -63,4 +63,5 @@ public:
|
|||
virtual bool hurt(DamageSource *source, float damage);
|
||||
bool isCreepy();
|
||||
void setCreepy(bool creepy);
|
||||
|
||||
};
|
||||
162
Minecraft.World/Endermite.cpp
Normal file
162
Minecraft.World/Endermite.cpp
Normal file
|
|
@ -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<LivingEntity> 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<Entity> Endermite::findAttackTarget()
|
||||
{
|
||||
#ifndef _FINAL_BUILD
|
||||
if(app.GetMobsDontAttackEnabled())
|
||||
{
|
||||
return shared_ptr<Player>();
|
||||
}
|
||||
#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<Player> nearestPlayer = level->getNearestPlayer(shared_from_this(), 5.0);
|
||||
return nearestPlayer == nullptr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
MobType Endermite::getMobType()
|
||||
{
|
||||
return ARTHROPOD;
|
||||
}
|
||||
|
||||
44
Minecraft.World/Endermite.h
Normal file
44
Minecraft.World/Endermite.h
Normal file
|
|
@ -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<Entity> 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; }
|
||||
|
||||
|
||||
};
|
||||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -2473,6 +2473,7 @@
|
|||
<ClInclude Include="DropperTileEntity.h" />
|
||||
<ClInclude Include="DummyCriteria.h" />
|
||||
<ClInclude Include="EmptyMapItem.h" />
|
||||
<ClInclude Include="Endermite.h" />
|
||||
<ClInclude Include="EntityTile.h" />
|
||||
<ClInclude Include="FireworksChargeItem.h" />
|
||||
<ClInclude Include="FireworksItem.h" />
|
||||
|
|
@ -3560,6 +3561,7 @@
|
|||
<ClCompile Include="DropperTileEntity.cpp" />
|
||||
<ClCompile Include="DummyCriteria.cpp" />
|
||||
<ClCompile Include="EmptyMapItem.cpp" />
|
||||
<ClCompile Include="Endermite.cpp" />
|
||||
<ClCompile Include="FireworksChargeItem.cpp" />
|
||||
<ClCompile Include="FireworksItem.cpp" />
|
||||
<ClCompile Include="FireworksMenu.cpp" />
|
||||
|
|
|
|||
|
|
@ -828,6 +828,7 @@
|
|||
<ClCompile Include="PrismarineTile.cpp" />
|
||||
<ClCompile Include="FishFoodItem.cpp" />
|
||||
<ClCompile Include="Tallgrass2.cpp" />
|
||||
<ClCompile Include="Endermite.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AABB.h" />
|
||||
|
|
@ -1825,6 +1826,7 @@
|
|||
<ClInclude Include="PrismarineTile.h" />
|
||||
<ClInclude Include="FishFoodItem.h" />
|
||||
<ClInclude Include="Tallgrass2.h" />
|
||||
<ClInclude Include="Endermite.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Minecraft.Client\Xbox\res\audio\Minecraft.xgs" />
|
||||
|
|
|
|||
|
|
@ -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<Entity>(endermite));
|
||||
}
|
||||
|
||||
|
||||
if (getOwner()->isRiding())
|
||||
{
|
||||
getOwner()->ride(nullptr);
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
#include "Witch.h"
|
||||
|
||||
//TU 31
|
||||
#include "Endermite.h"
|
||||
Loading…
Reference in a new issue