This commit is contained in:
piebot 2026-03-22 02:52:04 +03:00
commit 7207268add
30 changed files with 535 additions and 166 deletions

View file

@ -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,

View file

@ -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",

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 B

View file

@ -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"/>

View 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);
}
}

View 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);
};

View 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;
}

View 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);
};

View file

@ -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 )

View file

@ -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" />

View file

@ -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">

View file

@ -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

View file

@ -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

View file

@ -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) );

View file

@ -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)

View file

@ -63,4 +63,5 @@ public:
virtual bool hurt(DamageSource *source, float damage);
bool isCreepy();
void setCreepy(bool creepy);
};

View 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;
}

View 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; }
};

View file

@ -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);

View file

@ -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" />

View file

@ -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" />

View file

@ -5,124 +5,31 @@
#include "FireTile.h"
#include "net.minecraft.world.h"
const unsigned int SandTile::SAND_NAMES[SAND_NAMES_LENGTH] = { IDS_TILE_SAND,
IDS_TILE_SAND};
const unsigned int SandTile::SAND_NAMES[SAND_NAMES_LENGTH] = { IDS_TILE_SAND, IDS_TILE_SAND };
const wstring SandTile::TEXTURE_NAMES[] = { L"sand", L"red_sand" };
const wstring SandTile::TEXTURE_NAMES[] = { L"sand",
L"red_sand" };
bool SandTile::instaFall = false;
SandTile::SandTile(int type, bool isSolidRender) : Tile(type, Material::sand, isSolidRender)
SandTile::SandTile(int type, bool isSolidRender) : HeavyTile(type, Material::sand, isSolidRender)
{
icons = nullptr;
icons = nullptr;
}
int SandTile::getSpawnResourcesAuxValue(int data)
{
if (data < 0 || data >= SAND_NAMES_LENGTH) data = 0;
return data;
}
void SandTile::onPlace(Level* level, int x, int y, int z)
{
level->addToTickNextTick(x, y, z, id, getTickDelay(level));
}
void SandTile::neighborChanged(Level* level, int x, int y, int z, int type)
{
level->addToTickNextTick(x, y, z, id, getTickDelay(level));
}
void SandTile::tick(Level* level, int x, int y, int z, Random* random)
{
if (!level->isClientSide)
{
checkSlide(level, x, y, z);
}
}
void SandTile::checkSlide(Level* level, int x, int y, int z)
{
int x2 = x;
int y2 = y;
int z2 = z;
if (level->isNew || !level->hasChunksAt(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1))
{
return;
}
if (y2 > 0 && isFree(level, x2, y2 - 1, z2))
{
int r = 32;
if (instaFall || !level->hasChunksAt(x - r, y - r, z - r, x + r, y + r, z + r))
{
level->removeTile(x, y, z);
while (y > 0 && isFree(level, x, y - 1, z))
y--;
if (y > 0)
{
level->setTileAndUpdate(x, y, z, id);
}
}
else if (!level->isClientSide)
{
// 4J added - don't do anything just now if we can't create any new falling tiles
if (!level->newFallingTileAllowed())
{
level->addToTickNextTick(x, y, z, id, getTickDelay(level));
return;
}
shared_ptr<FallingTile> e = std::make_shared<FallingTile>(level, x + 0.5f, y + 0.5f, z + 0.5f, id, level->getData(x, y, z));
falling(e);
level->addEntity(e);
}
}
}
void SandTile::falling(shared_ptr<FallingTile> entity)
{
}
int SandTile::getTickDelay(Level* level)
{
return 2;
}
bool SandTile::isFree(Level* level, int x, int y, int z)
{
int t = level->getTile(x, y, z);
if (t == 0) return true;
if (t == Tile::fire_Id) return true;
Material* material = Tile::tiles[t]->material;
if (material == Material::water) return true;
if (material == Material::lava) return true;
return false;
}
void SandTile::onLand(Level* level, int xt, int yt, int zt, int data)
{
if (data < 0 || data >= SAND_NAMES_LENGTH) data = 0;
return data;
}
Icon* SandTile::getTexture(int face, int data)
{
if (data < 0 || data >= SAND_NAMES_LENGTH)
{
data = 0;
}
return icons[data];
if (data < 0 || data >= SAND_NAMES_LENGTH) data = 0;
return icons[data];
}
void SandTile::registerIcons(IconRegister* iconRegister)
{
icons = new Icon * [SAND_NAMES_LENGTH];
for (int i = 0; i < SAND_NAMES_LENGTH; i++)
{
icons[i] = iconRegister->registerIcon(TEXTURE_NAMES[i]);
}
icons = new Icon * [SAND_NAMES_LENGTH];
for (int i = 0; i < SAND_NAMES_LENGTH; i++)
{
icons[i] = iconRegister->registerIcon(TEXTURE_NAMES[i]);
}
}

View file

@ -1,36 +1,19 @@
#pragma once
#include "Tile.h"
#include "HeavyTile.h"
class Random;
class Level;
class FallingTile;
class SandTile : public Tile
class SandTile : public HeavyTile
{
public:
static bool instaFall;
static const int RED_SAND = 1;
static const int SAND_NAMES_LENGTH = 2;
static const unsigned int SAND_NAMES[SAND_NAMES_LENGTH];
static const wstring TEXTURE_NAMES[];
static const int RED_SAND = 1;
SandTile(int type, bool isSolidRender = true);
virtual int getSpawnResourcesAuxValue(int data) override;
virtual Icon* getTexture(int face, int data) override;
void registerIcons(IconRegister* iconRegister) override;
static const int SAND_NAMES_LENGTH = 2;
static const unsigned int SAND_NAMES[SAND_NAMES_LENGTH];
static const wstring TEXTURE_NAMES[];
SandTile(int type, bool isSolidRender = true);
virtual void onPlace(Level* level, int x, int y, int z);
virtual void neighborChanged(Level* level, int x, int y, int z, int type);
virtual void tick(Level* level, int x, int y, int z, Random* random);
private:
Icon** icons;
void checkSlide(Level* level, int x, int y, int z);
protected:
virtual void falling(shared_ptr<FallingTile> entity);
public:
virtual int getTickDelay(Level* level);
static bool isFree(Level* level, int x, int y, int z);
virtual int getSpawnResourcesAuxValue(int data);
virtual void onLand(Level* level, int xt, int yt, int zt, int data);
virtual Icon* getTexture(int face, int data);
void registerIcons(IconRegister* iconRegister);
};
Icon** icons;
};

View file

@ -138,6 +138,24 @@ void StructureRecipies::addRecipes(Recipes *r)
L'#', Tile::glass,
L'D');
for (int i = 0; i < 16; i++)
{
r->addShapedRecipy(new ItemInstance(Tile::stained_glass, 8, ColoredTile::getItemAuxValueForTileData(i)),
L"sssczczg",
L"###",
L"#X#",
L"###",
L'#', new ItemInstance(Tile::glass),
L'X', new ItemInstance(Item::dye_powder, 1, i),
L'D');
r->addShapedRecipy(new ItemInstance(Tile::stained_glass_pane, 16, ColoredTile::getItemAuxValueForTileData(i)),
L"ssczg",
L"###",
L"###",
L'#', new ItemInstance(Tile::stained_glass, 1, ColoredTile::getItemAuxValueForTileData(i)),
L'D');
}
r->addShapedRecipy(new ItemInstance(Tile::netherBrick, 1), //
L"sscig",
L"NN", //

View file

@ -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);

View file

@ -438,7 +438,7 @@ void Tile::staticCtor()
Tile::ironFence = (new ThinFenceTile(101, L"iron_bars", L"iron_bars", Material::metal, true)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fence, Item::eMaterial_iron)->setDestroyTime(5.0f)->setExplodeable(10)->setSoundType(SOUND_METAL)->setDescriptionId(IDS_TILE_IRON_FENCE)->setUseDescriptionId(IDS_DESC_IRON_FENCE);
Tile::thinGlass = (new ThinFenceTile(102, L"glass", L"glass_pane_top", Material::glass, false)) ->setDestroyTime(0.3f)->setSoundType(SOUND_GLASS)->setDescriptionId(IDS_TILE_THIN_GLASS)->setUseDescriptionId(IDS_DESC_THIN_GLASS);
Tile::thinGlass = (new ThinFenceTile(102, L"glass", L"glass_pane_top", Material::glass, false)) ->setDestroyTime(0.3f)->setSoundType(SOUND_GLASS)->setDescriptionId(IDS_TILE_THIN_GLASS)->setUseDescriptionId(IDS_DESC_THIN_GLASS)->setBaseItemTypeAndMaterial(Item::eBaseItemType_glass,Item::eMaterial_glass);;
Tile::melon = (new MelonTile(103)) ->setDestroyTime(1.0f)->setSoundType(SOUND_WOOD)->setIconName(L"melon")->setDescriptionId(IDS_TILE_MELON)->setUseDescriptionId(IDS_DESC_MELON_BLOCK);
Tile::pumpkinStem = (new StemTile(104, Tile::pumpkin)) ->setDestroyTime(0.0f)->setSoundType(SOUND_WOOD)->setIconName(L"pumpkin_stem")->setDescriptionId(IDS_TILE_PUMPKIN_STEM)->sendTileData();
Tile::melonStem = (new StemTile(105, Tile::melon)) ->setDestroyTime(0.0f)->setSoundType(SOUND_WOOD)->setIconName(L"melon_stem")->setDescriptionId(IDS_TILE_MELON_STEM)->sendTileData();

View file

@ -404,8 +404,26 @@ public:
static const int jungle_door_Id = 195;
static const int acacia_door_Id = 196;
static const int dark_oak_door_Id = 197;
//end_rod 198
//chorus_plant 199
//chorus_flower 200
//purpur_block 201
//purpur_pillar 202
//purpur_stairs 203
//purpur_double_slab 204
//purpur_slab 205
//end_bricks 206
//beetroots 207
//grass_path 208
//end_gateway 209
//frosted_ice 212
//magma 213
//nether_wart_block 214
//red_nether_brick 215
//bone_block 216
//structure_void 217
//
//
static Tile *stone;

View file

@ -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"