Rabbit-1
Added Brown Rabbit model and a basic ai system. added toast variant, others have to be implemented. TODO: add other variants, add their spawn in the biomes, add IDS_RABBIT And change sounds. ADD color to the spwanegg.
|
|
@ -438,6 +438,8 @@ enum eMinecraftColour
|
|||
eMinecraftColour_Mob_Witch_Colour2,
|
||||
eMinecraftColour_Mob_Horse_Colour1,
|
||||
eMinecraftColour_Mob_Horse_Colour2,
|
||||
eMinecraftColour_Mob_Rabbit_Colour1,
|
||||
eMinecraftColour_Mob_Rabbit_Colour2,
|
||||
|
||||
eMinecraftColour_Armour_Default_Leather_Colour,
|
||||
|
||||
|
|
|
|||
|
|
@ -256,6 +256,9 @@ const wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] =
|
|||
L"Mob_Witch_Colour2",
|
||||
L"Mob_Horse_Colour1",
|
||||
L"Mob_Horse_Colour2",
|
||||
L"Mob_Rabbit_Colour1",
|
||||
L"Mob_Rabbit_Colour2",
|
||||
|
||||
|
||||
L"Armour_Default_Leather_Colour",
|
||||
L"Under_Water_Clear_Colour",
|
||||
|
|
|
|||
|
|
@ -392,9 +392,11 @@ 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, 100 | ((EntityHorse::TYPE_DONKEY + 1) << 12) ); // Donkey
|
||||
ITEM_AUX(Item::spawnEgg_Id, 100 | ((EntityHorse::TYPE_MULE + 1) << 12)); // Mule
|
||||
ITEM_AUX(Item::spawnEgg_Id, 120); // Villager
|
||||
ITEM_AUX(Item::spawnEgg_Id, 101); // Rabbit Brown
|
||||
ITEM(Item::record_01_Id)
|
||||
ITEM(Item::record_02_Id)
|
||||
ITEM(Item::record_03_Id)
|
||||
|
|
|
|||
BIN
Minecraft.Client/Common/res/1_2_2/mob/rabbit/black.png
Normal file
|
After Width: | Height: | Size: 503 B |
BIN
Minecraft.Client/Common/res/1_2_2/mob/rabbit/brown.png
Normal file
|
After Width: | Height: | Size: 514 B |
BIN
Minecraft.Client/Common/res/1_2_2/mob/rabbit/caerbannog.png
Normal file
|
After Width: | Height: | Size: 513 B |
BIN
Minecraft.Client/Common/res/1_2_2/mob/rabbit/gold.png
Normal file
|
After Width: | Height: | Size: 519 B |
BIN
Minecraft.Client/Common/res/1_2_2/mob/rabbit/salt.png
Normal file
|
After Width: | Height: | Size: 588 B |
BIN
Minecraft.Client/Common/res/1_2_2/mob/rabbit/toast.png
Normal file
|
After Width: | Height: | Size: 598 B |
BIN
Minecraft.Client/Common/res/1_2_2/mob/rabbit/white.png
Normal file
|
After Width: | Height: | Size: 512 B |
BIN
Minecraft.Client/Common/res/1_2_2/mob/rabbit/white_splotched.png
Normal file
|
After Width: | Height: | Size: 625 B |
BIN
Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/black.png
Normal file
|
After Width: | Height: | Size: 503 B |
BIN
Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/brown.png
Normal file
|
After Width: | Height: | Size: 514 B |
|
After Width: | Height: | Size: 513 B |
BIN
Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/gold.png
Normal file
|
After Width: | Height: | Size: 519 B |
BIN
Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/salt.png
Normal file
|
After Width: | Height: | Size: 588 B |
BIN
Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/toast.png
Normal file
|
After Width: | Height: | Size: 598 B |
BIN
Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/white.png
Normal file
|
After Width: | Height: | Size: 512 B |
|
After Width: | Height: | Size: 625 B |
|
|
@ -82,6 +82,7 @@
|
|||
#include "ZombieRenderer.h"
|
||||
#include "BatRenderer.h"
|
||||
#include "CaveSpiderRenderer.h"
|
||||
#include "RabbitRenderer.h"
|
||||
|
||||
double EntityRenderDispatcher::xOff = 0.0;
|
||||
double EntityRenderDispatcher::yOff = 0.0;
|
||||
|
|
@ -132,6 +133,8 @@ EntityRenderDispatcher::EntityRenderDispatcher()
|
|||
|
||||
renderers[eTYPE_WITHERBOSS] = new WitherBossRenderer();
|
||||
|
||||
renderers[eTYPE_RABBIT] = new RabbitRenderer();
|
||||
|
||||
renderers[eTYPE_ENTITY] = new DefaultRenderer();
|
||||
renderers[eTYPE_PAINTING] = new PaintingRenderer();
|
||||
renderers[eTYPE_ITEM_FRAME] = new ItemFrameRenderer();
|
||||
|
|
|
|||
|
|
@ -20711,6 +20711,8 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
|||
</ClInclude>
|
||||
<ClInclude Include="PSVita\Social\SocialManager.h" />
|
||||
<ClInclude Include="PSVita\XML\ATGXmlParser.h" />
|
||||
<ClInclude Include="RabbitModel.h" />
|
||||
<ClInclude Include="RabbitRenderer.h" />
|
||||
<ClInclude Include="ReceivingLevelScreen.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">true</ExcludedFromBuild>
|
||||
|
|
@ -37928,6 +37930,8 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
|||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='CONTENTPACKAGE_SYMBOLS|Xbox 360'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RabbitModel.cpp" />
|
||||
<ClCompile Include="RabbitRenderer.cpp" />
|
||||
<ClCompile Include="ReceivingLevelScreen.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">true</ExcludedFromBuild>
|
||||
|
|
|
|||
|
|
@ -3793,6 +3793,12 @@
|
|||
<ClInclude Include="..\include\lce_filesystem\lce_filesystem.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RabbitModel.h">
|
||||
<Filter>net\minecraft\client\model</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RabbitRenderer.h">
|
||||
<Filter>net\minecraft\client\renderer\entity</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
|
@ -5949,6 +5955,12 @@
|
|||
<ClCompile Include="..\include\lce_filesystem\lce_filesystem.cpp">
|
||||
<Filter>include\lce_filesystem</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RabbitModel.cpp">
|
||||
<Filter>net\minecraft\client\model</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RabbitRenderer.cpp">
|
||||
<Filter>net\minecraft\client\renderer\entity</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Library Include="Xbox\4JLibs\libs\4J_Render_d.lib">
|
||||
|
|
|
|||
110
Minecraft.Client/RabbitModel.cpp
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
#include "stdafx.h"
|
||||
#include "RabbitModel.h"
|
||||
#include "ModelPart.h"
|
||||
#include "..\Minecraft.World\Mth.h"
|
||||
#include "../Minecraft.World/Rabbit.h"
|
||||
|
||||
#define PI 3.14159265358979323846f
|
||||
|
||||
RabbitModel::RabbitModel() : Model()
|
||||
{
|
||||
this->texWidth = 64;
|
||||
this->texHeight = 32;
|
||||
|
||||
// head part
|
||||
head = new ModelPart(this, 32, 0);
|
||||
head->addBox(-2.5F, -4.0F, -5.0F, 5, 4, 5);
|
||||
head->setPos(0.0F, 16.0F, -1.0F);
|
||||
|
||||
rightEar = new ModelPart(this, 52, 0);
|
||||
rightEar->addBox(-2.5F, -9.0F, -1.0F, 2, 5, 1);
|
||||
rightEar->setPos(0.0F, 0.0F, 0.0F);
|
||||
rightEar->yRot = -PI / 12.0f;
|
||||
|
||||
leftEar = new ModelPart(this, 58, 0);
|
||||
leftEar->addBox(0.5F, -9.0F, -1.0F, 2, 5, 1);
|
||||
leftEar->setPos(0.0F, 0.0F, 0.0F);
|
||||
leftEar->yRot = PI / 12.0f;
|
||||
|
||||
nose = new ModelPart(this, 32, 9);
|
||||
nose->addBox(-0.5F, -2.5F, -5.5F, 1, 1, 1);
|
||||
nose->setPos(0.0F, 0.0F, 0.0F);
|
||||
|
||||
head->addChild(rightEar);
|
||||
head->addChild(leftEar);
|
||||
head->addChild(nose);
|
||||
|
||||
// body part
|
||||
body = new ModelPart(this, 0, 0);
|
||||
body->addBox(-3.0F, -2.0F, -10.0F, 6, 5, 10);
|
||||
body->setPos(0.0F, 19.0F, 8.0F);
|
||||
body->xRot = -PI / 9.0f;
|
||||
|
||||
tail = new ModelPart(this, 52, 6);
|
||||
tail->addBox(-1.5F, -1.5F, 0.0F, 3, 3, 2);
|
||||
tail->setPos(0.0F, 20.0F, 7.0F);
|
||||
tail->xRot = -0.3490659F;
|
||||
|
||||
// front legs
|
||||
leftHindThigh = new ModelPart(this, 30, 15);
|
||||
leftHindThigh->addBox(-1.0F, 0.0F, 0.0F, 2, 4, 5);
|
||||
leftHindThigh->setPos(3.0F, 17.5F, 3.7F);
|
||||
leftHindThigh->xRot = -0.36651915F;
|
||||
|
||||
leftHindFoot = new ModelPart(this, 26, 24);
|
||||
leftHindFoot->addBox(-1.0F, 5.5F, -3.7F, 2, 1, 7);
|
||||
leftHindFoot->setPos(0.0F, 0.0F, 0.0F);
|
||||
leftHindFoot->xRot = 0.36651915F;
|
||||
leftHindThigh->addChild(leftHindFoot);
|
||||
|
||||
rightHindThigh = new ModelPart(this, 16, 15);
|
||||
rightHindThigh->addBox(-1.0F, 0.0F, 0.0F, 2, 4, 5);
|
||||
rightHindThigh->setPos(-3.0F, 17.5F, 3.7F);
|
||||
rightHindThigh->xRot = -0.36651915F;
|
||||
|
||||
rightHindFoot = new ModelPart(this, 8, 24);
|
||||
rightHindFoot->addBox(-1.0F, 5.5F, -3.7F, 2, 1, 7);
|
||||
rightHindFoot->setPos(0.0F, 0.0F, 0.0F);
|
||||
rightHindFoot->xRot = 0.36651915F;
|
||||
rightHindThigh->addChild(rightHindFoot);
|
||||
|
||||
// back legs
|
||||
leftFrontLeg = new ModelPart(this, 8, 15);
|
||||
leftFrontLeg->addBox(-1.0F, 0.0F, -1.0F, 2, 7, 2);
|
||||
leftFrontLeg->setPos(3.0F, 17.0F, -1.0F);
|
||||
leftFrontLeg->xRot = -0.19198622F;
|
||||
|
||||
rightFrontLeg = new ModelPart(this, 0, 15);
|
||||
rightFrontLeg->addBox(-1.0F, 0.0F, -1.0F, 2, 7, 2);
|
||||
rightFrontLeg->setPos(-3.0F, 17.0F, -1.0F);
|
||||
rightFrontLeg->xRot = -0.19198622F;
|
||||
}
|
||||
|
||||
void RabbitModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
|
||||
{
|
||||
shared_ptr<Rabbit> rabbit = dynamic_pointer_cast<Rabbit>(entity);
|
||||
|
||||
// head animation
|
||||
head->xRot = xRot * (PI / 180.0f);
|
||||
head->yRot = yRot * (PI / 180.0f);
|
||||
|
||||
// jump animation
|
||||
float jumpCompletion = 0.0f;
|
||||
if (rabbit) jumpCompletion = rabbit->getJumpCompletion(bob);
|
||||
|
||||
float jumpSin = Mth::sin(jumpCompletion * PI);
|
||||
|
||||
leftHindThigh->xRot = -0.36651915F + (jumpSin * 50.0f * (PI / 180.0f));
|
||||
rightHindThigh->xRot = -0.36651915F + (jumpSin * 50.0f * (PI / 180.0f));
|
||||
leftFrontLeg->xRot = -0.19198622F + (jumpSin * -40.0f * (PI / 180.0f));
|
||||
rightFrontLeg->xRot = -0.19198622F + (jumpSin * -40.0f * (PI / 180.0f));
|
||||
|
||||
|
||||
head->render(scale, usecompiled);
|
||||
body->render(scale, usecompiled);
|
||||
tail->render(scale, usecompiled);
|
||||
leftHindThigh->render(scale, usecompiled);
|
||||
rightHindThigh->render(scale, usecompiled);
|
||||
leftFrontLeg->render(scale, usecompiled);
|
||||
rightFrontLeg->render(scale, usecompiled);
|
||||
}
|
||||
29
Minecraft.Client/RabbitModel.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
#include "Model.h"
|
||||
|
||||
class RabbitModel : public Model
|
||||
{
|
||||
private:
|
||||
ModelPart *head;
|
||||
ModelPart *nose;
|
||||
ModelPart *leftEar;
|
||||
ModelPart *rightEar;
|
||||
|
||||
ModelPart *body;
|
||||
ModelPart *tail;
|
||||
ModelPart *leftFrontLeg;
|
||||
ModelPart *rightFrontLeg;
|
||||
|
||||
ModelPart *leftHindThigh;
|
||||
ModelPart *leftHindFoot;
|
||||
ModelPart *rightHindThigh;
|
||||
ModelPart *rightHindFoot;
|
||||
|
||||
public:
|
||||
RabbitModel();
|
||||
|
||||
virtual void render(shared_ptr<Entity> entity,
|
||||
float time, float r, float bob,
|
||||
float yRot, float xRot,
|
||||
float scale, bool usecompiled) override;
|
||||
};
|
||||
51
Minecraft.Client/RabbitRenderer.cpp
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#include "stdafx.h"
|
||||
#include "RabbitRenderer.h"
|
||||
#include "RabbitModel.h"
|
||||
#include "MobRenderer.h"
|
||||
#include "../Minecraft.World/Rabbit.h"
|
||||
|
||||
|
||||
ResourceLocation RabbitRenderer::LOC_BROWN = ResourceLocation(TN_MOB_RABBIT_BROWN);
|
||||
ResourceLocation RabbitRenderer::LOC_WHITE = ResourceLocation(TN_MOB_RABBIT_WHITE);
|
||||
ResourceLocation RabbitRenderer::LOC_BLACK = ResourceLocation(TN_MOB_RABBIT_BLACK);
|
||||
ResourceLocation RabbitRenderer::LOC_GOLD = ResourceLocation(TN_MOB_RABBIT_GOLD);
|
||||
ResourceLocation RabbitRenderer::LOC_SALT = ResourceLocation(TN_MOB_RABBIT_SALT);
|
||||
ResourceLocation RabbitRenderer::LOC_WHITE_SPLOTCHED = ResourceLocation(TN_MOB_RABBIT_WHITE_SPLOTCHED);
|
||||
ResourceLocation RabbitRenderer::LOC_TOAST = ResourceLocation(TN_MOB_RABBIT_TOAST);
|
||||
ResourceLocation RabbitRenderer::LOC_EVIL = ResourceLocation(TN_MOB_RABBIT_CAERBANNOG);
|
||||
|
||||
RabbitRenderer::RabbitRenderer() : MobRenderer(new RabbitModel(), 0.3f)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ResourceLocation *RabbitRenderer::getTextureLocation(shared_ptr<Entity> entity)
|
||||
{
|
||||
shared_ptr<Rabbit> mob = dynamic_pointer_cast<Rabbit>(entity);
|
||||
if (mob == nullptr) return &LOC_BROWN;
|
||||
|
||||
// easter egg toast
|
||||
if (mob->hasCustomName() && mob->getCustomName() == L"Toast")
|
||||
{
|
||||
return &LOC_TOAST;
|
||||
}
|
||||
|
||||
// variants
|
||||
switch (mob->getVariant())
|
||||
{
|
||||
case Rabbit::Variant::WHITE: return &LOC_WHITE;
|
||||
case Rabbit::Variant::BLACK: return &LOC_BLACK;
|
||||
case Rabbit::Variant::GOLD: return &LOC_GOLD;
|
||||
case Rabbit::Variant::SALT: return &LOC_SALT;
|
||||
case Rabbit::Variant::WHITE_SPLOTCHED: return &LOC_WHITE_SPLOTCHED;
|
||||
case Rabbit::Variant::EVIL: return &LOC_EVIL;
|
||||
case Rabbit::Variant::BROWN:
|
||||
default: return &LOC_BROWN;
|
||||
}
|
||||
}
|
||||
|
||||
void RabbitRenderer::scale(shared_ptr<LivingEntity> _mob, float a)
|
||||
{
|
||||
|
||||
glScalef(0.65f, 0.65f, 0.65f);
|
||||
}
|
||||
27
Minecraft.Client/RabbitRenderer.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
#include "MobRenderer.h"
|
||||
|
||||
class Rabbit;
|
||||
class LivingEntity;
|
||||
|
||||
class RabbitRenderer : public MobRenderer
|
||||
{
|
||||
private:
|
||||
|
||||
static ResourceLocation LOC_BROWN;
|
||||
static ResourceLocation LOC_WHITE;
|
||||
static ResourceLocation LOC_BLACK;
|
||||
static ResourceLocation LOC_GOLD;
|
||||
static ResourceLocation LOC_SALT;
|
||||
static ResourceLocation LOC_WHITE_SPLOTCHED;
|
||||
static ResourceLocation LOC_TOAST;
|
||||
static ResourceLocation LOC_EVIL;
|
||||
|
||||
public:
|
||||
RabbitRenderer();
|
||||
|
||||
virtual ResourceLocation *getTextureLocation(shared_ptr<Entity> entity) override;
|
||||
|
||||
protected:
|
||||
virtual void scale(shared_ptr<LivingEntity> mob, float a) override;
|
||||
};
|
||||
|
|
@ -156,6 +156,17 @@ const wchar_t *Textures::preLoaded[TN_COUNT] =
|
|||
L"mob/wither/wither_armor",
|
||||
L"mob/wither/wither_invulnerable",
|
||||
|
||||
//TU31
|
||||
L"mob/rabbit/brown",
|
||||
L"mob/rabbit/white",
|
||||
L"mob/rabbit/black",
|
||||
L"mob/rabbit/gold",
|
||||
L"mob/rabbit/salt",
|
||||
L"mob/rabbit/white_splotched",
|
||||
L"mob/rabbit/toast",
|
||||
L"mob/rabbit/caerbannog",
|
||||
|
||||
|
||||
L"item/trapped",
|
||||
L"item/trapped_double",
|
||||
//L"item/christmas",
|
||||
|
|
|
|||
|
|
@ -146,6 +146,16 @@ typedef enum _TEXTURE_NAME
|
|||
TN_MOB_WITHER_ARMOR,
|
||||
TN_MOB_WITHER_INVULNERABLE,
|
||||
|
||||
//TU31
|
||||
TN_MOB_RABBIT_BROWN,
|
||||
TN_MOB_RABBIT_WHITE,
|
||||
TN_MOB_RABBIT_BLACK,
|
||||
TN_MOB_RABBIT_GOLD,
|
||||
TN_MOB_RABBIT_SALT,
|
||||
TN_MOB_RABBIT_WHITE_SPLOTCHED,
|
||||
TN_MOB_RABBIT_TOAST,
|
||||
TN_MOB_RABBIT_CAERBANNOG,
|
||||
|
||||
TN_TILE_TRAP_CHEST,
|
||||
TN_TILE_LARGE_TRAP_CHEST,
|
||||
//TN_TILE_XMAS_CHEST,
|
||||
|
|
|
|||
|
|
@ -116,6 +116,8 @@ Biome::Biome(int id) : id(id)
|
|||
friendlies_chicken.push_back(new MobSpawnerData(eTYPE_CHICKEN, 10, 4, 4)); // 4J - moved chickens to their own category
|
||||
friendlies.push_back(new MobSpawnerData(eTYPE_COW, 8, 4, 4));
|
||||
|
||||
friendlies.push_back(new MobSpawnerData(eTYPE_RABBIT, 7, 1, 2));
|
||||
|
||||
enemies.push_back(new MobSpawnerData(eTYPE_SPIDER, 10, 4, 4));
|
||||
enemies.push_back(new MobSpawnerData(eTYPE_ZOMBIE, 10, 4, 4));
|
||||
enemies.push_back(new MobSpawnerData(eTYPE_SKELETON, 10, 4, 4));
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ enum eINSTANCEOF
|
|||
eTYPE_SHEEP = eTYPE_ANIMAL | eTYPE_ANIMALS_SPAWN_LIMIT_CHECK | 0x2,
|
||||
eTYPE_PIG = eTYPE_ANIMAL | eTYPE_ANIMALS_SPAWN_LIMIT_CHECK | 0x3,
|
||||
eTYPE_CHICKEN = eTYPE_ANIMAL | 0x4,
|
||||
eTYPE_RABBIT = eTYPE_ANIMAL | eTYPE_ANIMALS_SPAWN_LIMIT_CHECK | 0x5,
|
||||
|
||||
eTYPE_COW = eTYPE_ANIMAL | eTYPE_ANIMALS_SPAWN_LIMIT_CHECK | BIT_COW,
|
||||
eTYPE_MUSHROOMCOW = eTYPE_COW | 0x1,
|
||||
|
|
@ -409,6 +410,7 @@ public:
|
|||
classes->push_back( SUBCLASS(eTYPE_SHEEP )->addParent( eTYPE_ANIMAL)->addParent(eTYPE_ANIMALS_SPAWN_LIMIT_CHECK ) );
|
||||
classes->push_back( SUBCLASS(eTYPE_PIG )->addParent( eTYPE_ANIMAL)->addParent(eTYPE_ANIMALS_SPAWN_LIMIT_CHECK ) );
|
||||
classes->push_back( SUBCLASS(eTYPE_CHICKEN )->addParent( eTYPE_ANIMAL ) );
|
||||
|
||||
classes->push_back( SUBCLASS(eTYPE_COW )->addParent( eTYPE_ANIMAL)->addParent(eTYPE_ANIMALS_SPAWN_LIMIT_CHECK ) );
|
||||
classes->push_back( SUBCLASS(eTYPE_MUSHROOMCOW )->addParent( eTYPE_COW ) );
|
||||
classes->push_back( SUBCLASS(eTYPE_WATERANIMAL )->addParent(eTYPE_PATHFINDER_MOB) );
|
||||
|
|
|
|||
|
|
@ -104,6 +104,10 @@ void EntityIO::staticCtor()
|
|||
setId(Ocelot::create, eTYPE_OCELOT, L"Ozelot", 98, eMinecraftColour_Mob_Ocelot_Colour1, eMinecraftColour_Mob_Ocelot_Colour2, IDS_OZELOT);
|
||||
setId(VillagerGolem::create, eTYPE_VILLAGERGOLEM, L"VillagerGolem", 99);
|
||||
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_HORSE);//change IDS_RABBIT later
|
||||
|
||||
|
||||
setId(Villager::create, eTYPE_VILLAGER, L"Villager", 120, eMinecraftColour_Mob_Villager_Colour1, eMinecraftColour_Mob_Villager_Colour2, IDS_VILLAGER);
|
||||
|
||||
|
|
@ -112,6 +116,7 @@ void EntityIO::staticCtor()
|
|||
// 4J Added
|
||||
setId(DragonFireball::create, eTYPE_DRAGON_FIREBALL, L"DragonFireball", 1000);
|
||||
|
||||
|
||||
// 4J-PB - moved to allow the eggs to be named and coloured in the Creative Mode menu
|
||||
// 4J Added for custom spawn eggs
|
||||
setId(EntityHorse::create, eTYPE_HORSE, L"EntityHorse", 100 | ((EntityHorse::TYPE_DONKEY + 1) << 12), eMinecraftColour_Mob_Horse_Colour1, eMinecraftColour_Mob_Horse_Colour2, IDS_DONKEY);
|
||||
|
|
@ -125,6 +130,8 @@ void EntityIO::staticCtor()
|
|||
setId(Ocelot::create, eTYPE_OCELOT, L"Ozelot", 98 | ((Ocelot::TYPE_SIAMESE + 1) << 12), eMinecraftColour_Mob_Ocelot_Colour1, eMinecraftColour_Mob_Ocelot_Colour2, IDS_OZELOT );
|
||||
setId(Spider::create, eTYPE_SPIDER, L"Spider", 52 | (2 << 12), eMinecraftColour_Mob_Spider_Colour1, eMinecraftColour_Mob_Spider_Colour2, IDS_SKELETON );
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
shared_ptr<Entity> EntityIO::newEntity(const wstring& id, Level *level)
|
||||
|
|
|
|||
|
|
@ -2704,6 +2704,7 @@
|
|||
<ClInclude Include="PoweredMetalTile.h" />
|
||||
<ClInclude Include="PoweredRailTile.h" />
|
||||
<ClInclude Include="AbstractProjectileDispenseBehavior.h" />
|
||||
<ClInclude Include="Rabbit.h" />
|
||||
<ClInclude Include="RailTile.h" />
|
||||
<ClInclude Include="Redstone.h" />
|
||||
<ClInclude Include="RepeaterTile.h" />
|
||||
|
|
@ -3629,6 +3630,7 @@
|
|||
<ClCompile Include="PoweredMetalTile.cpp" />
|
||||
<ClCompile Include="PoweredRailTile.cpp" />
|
||||
<ClCompile Include="AbstractProjectileDispenseBehavior.cpp" />
|
||||
<ClCompile Include="Rabbit.cpp" />
|
||||
<ClCompile Include="RailTile.cpp" />
|
||||
<ClCompile Include="Redstone.cpp" />
|
||||
<ClCompile Include="RepeaterTile.cpp" />
|
||||
|
|
|
|||
|
|
@ -3197,6 +3197,9 @@
|
|||
<ClInclude Include="FireworksMenu.h">
|
||||
<Filter>net\minecraft\world\inventory</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Rabbit.h">
|
||||
<Filter>net\minecraft\world\entity\animal</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
|
@ -5626,5 +5629,8 @@
|
|||
<ClCompile Include="EmptyMapItem.cpp">
|
||||
<Filter>net\minecraft\world\item</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Rabbit.cpp">
|
||||
<Filter>net\minecraft\world\entity\animal</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
125
Minecraft.World/Rabbit.cpp
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
#include "stdafx.h"
|
||||
#include "Rabbit.h"
|
||||
#include "SynchedEntityData.h"
|
||||
#include "AttributeInstance.h"
|
||||
#include "SharedMonsterAttributes.h"
|
||||
#include "net.minecraft.world.item.h"
|
||||
#include "net.minecraft.world.entity.ai.goal.h"
|
||||
#include "net.minecraft.world.entity.ai.navigation.h"
|
||||
#include "net.minecraft.world.level.h"
|
||||
#include "com.mojang.nbt.h"
|
||||
#include "SoundTypes.h"
|
||||
|
||||
Rabbit::Rabbit(Level *level) : Animal(level)
|
||||
{
|
||||
jumpCompletion = 0.0f;
|
||||
jumpTicks = 0;
|
||||
moreCarrotTicks = 0;
|
||||
|
||||
|
||||
this->defineSynchedData();
|
||||
this->registerAttributes();
|
||||
this->setHealth(this->getMaxHealth());
|
||||
|
||||
this->setSize(0.4f, 0.5f);
|
||||
this->getNavigation()->setAvoidWater(true);
|
||||
|
||||
// AI Goals
|
||||
goalSelector.addGoal(1, new FloatGoal(this));
|
||||
goalSelector.addGoal(2, new PanicGoal(this, 2.2f));
|
||||
goalSelector.addGoal(3, new BreedGoal(this, 0.8f));
|
||||
goalSelector.addGoal(4, new TemptGoal(this, 1.0f, Item::carrots_Id, false));
|
||||
goalSelector.addGoal(6, new RandomStrollGoal(this, 0.6f));
|
||||
goalSelector.addGoal(7, new LookAtPlayerGoal(this, typeid(Player), 10.0f));
|
||||
}
|
||||
|
||||
float Rabbit::getJumpCompletion(float partialTick) const {
|
||||
return jumpCompletion;
|
||||
}
|
||||
|
||||
Rabbit::Variant Rabbit::getVariant() const {
|
||||
|
||||
return (Variant)entityData->getInteger(DATA_TYPE_ID);
|
||||
}
|
||||
|
||||
void Rabbit::setVariant(Variant v) {
|
||||
entityData->set(DATA_TYPE_ID, (int)v);
|
||||
}
|
||||
|
||||
void Rabbit::defineSynchedData() {
|
||||
Animal::defineSynchedData();
|
||||
entityData->define(DATA_TYPE_ID, (int)Variant::BROWN);
|
||||
}
|
||||
|
||||
void Rabbit::registerAttributes() {
|
||||
Animal::registerAttributes();
|
||||
getAttribute(SharedMonsterAttributes::MAX_HEALTH)->setBaseValue(3.0);
|
||||
|
||||
getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->setBaseValue(0.3);
|
||||
}
|
||||
|
||||
bool Rabbit::useNewAi() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Rabbit::tick() {
|
||||
Animal::tick();
|
||||
|
||||
if (!onGround) {
|
||||
jumpTicks++;
|
||||
} else {
|
||||
|
||||
bool canJump = (tickCount % 5 == 0);
|
||||
|
||||
if (!getNavigation()->isDone() && jumpTicks == 0 && canJump) {
|
||||
|
||||
|
||||
this->yd = 0.32f;
|
||||
|
||||
|
||||
float speed = (float)getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue();
|
||||
this->moveRelative(0.0f, 1.0f, speed);
|
||||
|
||||
|
||||
this->hasImpulse = true;
|
||||
}
|
||||
jumpTicks = 0;
|
||||
}
|
||||
|
||||
|
||||
jumpCompletion = onGround ? jumpCompletion * 0.8f : (float)jumpTicks / 5.0f;
|
||||
if (jumpCompletion > 1.0f) jumpCompletion = 1.0f;
|
||||
}
|
||||
|
||||
bool Rabbit::isFood(shared_ptr<ItemInstance> item) {
|
||||
if (item == nullptr || item->getItem() == nullptr) return false;
|
||||
|
||||
|
||||
int id = item->getItem()->id;
|
||||
return id == Item::carrots_Id || id == Item::carrots_Id || id == Item::carrotGolden_Id;
|
||||
}
|
||||
|
||||
shared_ptr<AgableMob> Rabbit::getBreedOffspring(shared_ptr<AgableMob> target) {
|
||||
if (level->canCreateMore(GetType(), Level::eSpawnType_Breed))
|
||||
return std::make_shared<Rabbit>(level);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
int Rabbit::getAmbientSound() { return eSoundType_MOB_BAT_IDLE; }
|
||||
int Rabbit::getHurtSound() { return eSoundType_MOB_BAT_HURT; }
|
||||
int Rabbit::getDeathSound() { return eSoundType_MOB_BAT_DEATH; }
|
||||
|
||||
void Rabbit::readAdditionalSaveData(CompoundTag *tag) {
|
||||
Animal::readAdditionalSaveData(tag);
|
||||
if (tag->contains(L"RabbitType")) {
|
||||
setVariant((Variant)tag->getInt(L"RabbitType"));
|
||||
}
|
||||
}
|
||||
|
||||
void Rabbit::addAdditonalSaveData(CompoundTag *tag) {
|
||||
Animal::addAdditonalSaveData(tag);
|
||||
tag->putInt(L"RabbitType", (int)getVariant());
|
||||
}
|
||||
56
Minecraft.World/Rabbit.h
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#pragma once
|
||||
#include "Animal.h"
|
||||
|
||||
class Rabbit : public Animal
|
||||
{
|
||||
public:
|
||||
enum class Variant
|
||||
{
|
||||
BROWN = 0,
|
||||
WHITE = 1,
|
||||
BLACK = 2,
|
||||
GOLD = 3,
|
||||
SALT = 4,
|
||||
WHITE_SPLOTCHED = 5,
|
||||
EVIL = 99,
|
||||
};
|
||||
|
||||
eINSTANCEOF GetType() { return eTYPE_RABBIT; }
|
||||
static Entity *create(Level *level) { return new Rabbit(level); }
|
||||
|
||||
private:
|
||||
static const int DATA_TYPE_ID = 16;
|
||||
|
||||
float jumpCompletion;
|
||||
int jumpTicks;
|
||||
int moreCarrotTicks;
|
||||
|
||||
public:
|
||||
Rabbit(Level *level);
|
||||
virtual ~Rabbit() {}
|
||||
|
||||
float getJumpCompletion(float partialTick) const;
|
||||
|
||||
Variant getVariant() const;
|
||||
void setVariant(Variant v);
|
||||
|
||||
virtual bool useNewAi() override;
|
||||
virtual void tick() override;
|
||||
|
||||
protected:
|
||||
virtual void registerAttributes() override;
|
||||
virtual void defineSynchedData() override;
|
||||
|
||||
virtual int getAmbientSound() override;
|
||||
virtual int getHurtSound() override;
|
||||
virtual int getDeathSound() override;
|
||||
virtual float getSoundVolume() override { return 0.6f; }
|
||||
virtual bool makeStepSound() override { return true; }
|
||||
|
||||
public:
|
||||
virtual bool isFood(shared_ptr<ItemInstance> item) override;
|
||||
virtual shared_ptr<AgableMob> getBreedOffspring(shared_ptr<AgableMob> target) override;
|
||||
|
||||
virtual void readAdditionalSaveData(CompoundTag *tag) override;
|
||||
virtual void addAdditonalSaveData(CompoundTag *tag) override;
|
||||
};
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
#include "WaterAnimal.h"
|
||||
#include "Wolf.h"
|
||||
|
||||
|
||||
// 1.0.1
|
||||
#include "Golem.h"
|
||||
#include "MushroomCow.h"
|
||||
|
|
@ -19,4 +20,7 @@
|
|||
#include "VillagerGolem.h"
|
||||
|
||||
// 1.6.4
|
||||
#include "EntityHorse.h"
|
||||
#include "EntityHorse.h"
|
||||
|
||||
//TU31
|
||||
#include "Rabbit.h"
|
||||