mirror of
https://git.neolegacy.dev/neoStudiosLCE/neoLegacy.git
synced 2026-11-18 19:50:00 +01:00
TU43 Release 2
+ Added Magma Block, Nether Wart Block, Bone Block, End Stone Block + All Beetroot Items + Polar Bear (excluding audio) + / now opens chat for commands
This commit is contained in:
1 parent
47e5cba310
commit
558173cfd0
38 files changed
+561
-15
No files matched your search
@@ -33,6 +33,15 @@ ChatScreen::ChatScreen()
|
||||
ChatScreen::s_chatIndex = 0;
|
||||
}
|
||||
|
||||
ChatScreen::ChatScreen(const wstring &initialMessage)
|
||||
{
|
||||
frame = 0;
|
||||
message = initialMessage;
|
||||
cursorIndex = static_cast<int>(message.length());
|
||||
s_historyIndex = -1;
|
||||
ChatScreen::s_chatIndex = 0;
|
||||
}
|
||||
|
||||
void ChatScreen::init()
|
||||
{
|
||||
Keyboard::enableRepeatEvents(true);
|
||||
|
||||
@@ -22,6 +22,7 @@ private:
|
||||
|
||||
public:
|
||||
ChatScreen();
|
||||
ChatScreen(const wstring &initialMessage);
|
||||
virtual void init();
|
||||
virtual void removed();
|
||||
virtual void tick();
|
||||
|
||||
@@ -469,7 +469,6 @@ enum eMinecraftColour
|
||||
eMinecraftColour_Mob_Guardian_Colour2,
|
||||
eMinecraftColour_Mob_ElderGuardian_Colour1,
|
||||
eMinecraftColour_Mob_ElderGuardian_Colour2,
|
||||
|
||||
eMinecraftColour_Armour_Default_Leather_Colour,
|
||||
|
||||
eMinecraftColour_Under_Water_Clear_Colour,
|
||||
@@ -568,6 +567,9 @@ enum eMinecraftColour
|
||||
//eHTMLColor_e_dark = 0x3f3f15, //r:3f , g: 3f, b: 15, i: 1e
|
||||
//eHTMLColor_f_dark = 0x3f3f3f, //r:3f , g: 3f, b: 3f, i: 1f
|
||||
|
||||
eMinecraftColour_Mob_PolarBear_Colour1,
|
||||
eMinecraftColour_Mob_PolarBear_Colour2,
|
||||
|
||||
eMinecraftColour_COUNT,
|
||||
};
|
||||
|
||||
|
||||
@@ -287,7 +287,14 @@ const WCHAR *ConsoleSoundEngine::wchSoundNames[eSoundType_MAX]=
|
||||
L"mob.guardian.curse",
|
||||
L"mob.guardian.elder_death",
|
||||
L"mob.guardian.elder_hit",
|
||||
L"mob.guardian.elder_idle"
|
||||
L"mob.guardian.elder_idle",
|
||||
|
||||
L"mob.polarbear.babyidle",
|
||||
L"mob.polarbear.idle",
|
||||
L"mob.polarbear.hurt",
|
||||
L"mob.polarbear.death",
|
||||
L"mob.polarbear.step",
|
||||
L"mob.polarbear.warning"
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -344,6 +344,8 @@ const wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] =
|
||||
L"Color_EnchantTextFocus",
|
||||
L"Color_EnchantTextDisabled",
|
||||
L"Color_RenamedItemTitle",
|
||||
L"Mob_PolarBear_Colour1",
|
||||
L"Mob_PolarBear_Colour2",
|
||||
};
|
||||
|
||||
void ColourTable::staticCtor()
|
||||
|
||||
@@ -167,7 +167,12 @@ void IUIScene_CreativeMenu::staticCtor()
|
||||
ITEM_AUX(Tile::dirt_Id, DirtTile::PODZOL)
|
||||
ITEM(Tile::grass_path_Id)
|
||||
ITEM(Tile::nether_brick_Id)
|
||||
ITEM(Tile::red_nether_brick_Id)
|
||||
ITEM(Tile::end_stone_Id)
|
||||
ITEM(Tile::end_bricks_Id)
|
||||
ITEM(Tile::magma_Id)
|
||||
ITEM(Tile::nether_wart_block_Id)
|
||||
ITEM(Tile::bone_block_Id)
|
||||
ITEM_AUX(Tile::quartz_block_Id,QuartzBlockTile::TYPE_CHISELED)
|
||||
ITEM_AUX(Tile::quartz_block_Id,QuartzBlockTile::TYPE_LINES_Y)
|
||||
ITEM(Tile::trapdoor_Id)
|
||||
@@ -499,6 +504,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
||||
ITEM_AUX(Item::spawn_egg_Id, 100 | ((EntityHorse::TYPE_MULE + 1) << 12)); // Mule
|
||||
ITEM_AUX(Item::spawn_egg_Id, 120); // Villager
|
||||
ITEM_AUX(Item::spawn_egg_Id, 101); // Rabbit Brown
|
||||
ITEM_AUX(Item::spawn_egg_Id, 107); // Polar Bear
|
||||
ITEM(Item::record_13_Id)
|
||||
ITEM(Item::record_cat_Id)
|
||||
ITEM(Item::record_blocks_Id)
|
||||
|
||||
@@ -668,15 +668,11 @@ void UIController::loadSkins()
|
||||
}
|
||||
if(m_iggyLibraries[eLibrary_Platform] == IGGY_INVALID_LIBRARY)
|
||||
{
|
||||
<<<<<<< Updated upstream
|
||||
m_iggyLibraries[eLibrary_Platform] = loadSkin(L"skinHDWin.swf", L"platformskin.swf");
|
||||
=======
|
||||
m_iggyLibraries[eLibrary_Platform] = loadSkin(L"Graphics\\ControlType\\HD\\windowsHD.swf", L"platformskinHD.swf");
|
||||
if(m_iggyLibraries[eLibrary_Platform] == IGGY_INVALID_LIBRARY)
|
||||
{
|
||||
m_iggyLibraries[eLibrary_Platform] = loadSkin(L"skinHDWin.swf", L"platformskinHD.swf");
|
||||
}
|
||||
>>>>>>> Stashed changes
|
||||
}
|
||||
|
||||
// Non-HD skin set (720p/480p scenes import these)
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
@@ -291,6 +291,8 @@ if __name__=="__main__": notecolors()
|
||||
<colour name="Mob_Guardian_Colour2" value="F17D30"/>
|
||||
<colour name="Mob_ElderGuardian_Colour1" value="CECCBA"/>
|
||||
<colour name="Mob_ElderGuardian_Colour2" value="747693"/>
|
||||
<colour name="Mob_PolarBear_Colour1" value="F8F8F8"/>
|
||||
<colour name="Mob_PolarBear_Colour2" value="8F9494"/>
|
||||
|
||||
<colour name="Armour_Default_Leather_Colour" value="A06540"/>
|
||||
|
||||
|
||||
@@ -82,6 +82,8 @@
|
||||
#include "BatRenderer.h"
|
||||
#include "CaveSpiderRenderer.h"
|
||||
#include "RabbitRenderer.h"
|
||||
#include "PolarBearRenderer.h"
|
||||
#include "PolarBearModel.h"
|
||||
|
||||
#include "ArmorStandRenderer.h"
|
||||
#include "EndermiteRenderer.h"
|
||||
@@ -142,6 +144,7 @@ EntityRenderDispatcher::EntityRenderDispatcher()
|
||||
renderers[eTYPE_WITHERBOSS] = new WitherBossRenderer();
|
||||
|
||||
renderers[eTYPE_RABBIT] = new RabbitRenderer();
|
||||
renderers[eTYPE_POLARBEAR] = new PolarBearRenderer(new PolarBearModel(), 0.7f);
|
||||
|
||||
|
||||
renderers[eTYPE_ENTITY] = new DefaultRenderer();
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#include "stdafx.h"
|
||||
#include "PolarBearModel.h"
|
||||
#include "ModelPart.h"
|
||||
|
||||
PolarBearModel::PolarBearModel() : QuadrupedModel(10, 0)
|
||||
{
|
||||
texWidth = 128;
|
||||
texHeight = 64;
|
||||
|
||||
float g = 0;
|
||||
|
||||
head = new ModelPart(this, 0, 0);
|
||||
head->addBox(-3.5f, -3, -3, 7, 7, 7, g);
|
||||
head->setPos(0, 10, -16);
|
||||
head->texOffs(0, 44)->addBox(-2.5f, 1, -6, 5, 3, 3, g);
|
||||
head->texOffs(26, 0)->addBox(-4.5f, -4, -1, 2, 2, 1, g);
|
||||
head->texOffs(26, 0)->addBox(2.5f, -4, -1, 2, 2, 1, g);
|
||||
|
||||
body = new ModelPart(this, 0, 19);
|
||||
body->addBox(-5, -13, -7, 14, 14, 11, g);
|
||||
body->texOffs(39, 0)->addBox(-4, -25, -7, 12, 12, 10, g);
|
||||
body->setPos(-2, 9, 12);
|
||||
|
||||
leg0 = new ModelPart(this, 50, 22);
|
||||
leg0->addBox(-2, 0, -2, 4, 10, 8, g);
|
||||
leg0->setPos(-4.5f, 14, 6);
|
||||
|
||||
leg1 = new ModelPart(this, 50, 22);
|
||||
leg1->addBox(-2, 0, -2, 4, 10, 8, g);
|
||||
leg1->setPos(4.5f, 14, 6);
|
||||
|
||||
leg2 = new ModelPart(this, 50, 40);
|
||||
leg2->addBox(-2, 0, -2, 4, 10, 6, g);
|
||||
leg2->setPos(-3.5f, 14, -8);
|
||||
|
||||
leg3 = new ModelPart(this, 50, 40);
|
||||
leg3->addBox(-2, 0, -2, 4, 10, 6, g);
|
||||
leg3->setPos(3.5f, 14, -8);
|
||||
|
||||
head->compile(1.0f / 16.0f);
|
||||
body->compile(1.0f / 16.0f);
|
||||
leg0->compile(1.0f / 16.0f);
|
||||
leg1->compile(1.0f / 16.0f);
|
||||
leg2->compile(1.0f / 16.0f);
|
||||
leg3->compile(1.0f / 16.0f);
|
||||
}
|
||||
|
||||
void PolarBearModel::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);
|
||||
|
||||
if (young)
|
||||
{
|
||||
glPushMatrix();
|
||||
glScalef(0.6666667f, 0.6666667f, 0.6666667f);
|
||||
glTranslatef(0, scale * 16.0f, scale * 4.0f);
|
||||
head->render(scale, usecompiled);
|
||||
glPopMatrix();
|
||||
glPushMatrix();
|
||||
glScalef(0.5f, 0.5f, 0.5f);
|
||||
glTranslatef(0, scale * 24.0f, 0);
|
||||
body->render(scale, usecompiled);
|
||||
leg0->render(scale, usecompiled);
|
||||
leg1->render(scale, usecompiled);
|
||||
leg2->render(scale, usecompiled);
|
||||
leg3->render(scale, usecompiled);
|
||||
glPopMatrix();
|
||||
}
|
||||
else
|
||||
{
|
||||
head->render(scale, usecompiled);
|
||||
body->render(scale, usecompiled);
|
||||
leg0->render(scale, usecompiled);
|
||||
leg1->render(scale, usecompiled);
|
||||
leg2->render(scale, usecompiled);
|
||||
leg3->render(scale, usecompiled);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "QuadrupedModel.h"
|
||||
|
||||
class PolarBearModel : public QuadrupedModel
|
||||
{
|
||||
public:
|
||||
PolarBearModel();
|
||||
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
#include "stdafx.h"
|
||||
#include "PolarBearRenderer.h"
|
||||
|
||||
ResourceLocation PolarBearRenderer::POLARBEAR_LOCATION = ResourceLocation(TN_MOB_POLARBEAR);
|
||||
|
||||
PolarBearRenderer::PolarBearRenderer(Model *model, float shadow) : MobRenderer(model, shadow)
|
||||
{
|
||||
}
|
||||
|
||||
void PolarBearRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
|
||||
{
|
||||
MobRenderer::render(_mob, x, y, z, rot, a);
|
||||
}
|
||||
|
||||
ResourceLocation *PolarBearRenderer::getTextureLocation(shared_ptr<Entity> mob)
|
||||
{
|
||||
return &POLARBEAR_LOCATION;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "MobRenderer.h"
|
||||
|
||||
class PolarBearRenderer : public MobRenderer
|
||||
{
|
||||
private:
|
||||
static ResourceLocation POLARBEAR_LOCATION;
|
||||
|
||||
public:
|
||||
PolarBearRenderer(Model *model, float shadow);
|
||||
|
||||
virtual void render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a);
|
||||
virtual ResourceLocation *getTextureLocation(shared_ptr<Entity> mob);
|
||||
};
|
||||
@@ -194,6 +194,7 @@ const wchar_t *Textures::preLoaded[TN_COUNT] =
|
||||
L"mob/guardian",
|
||||
L"mob/guardian_elder",
|
||||
L"mob/guardian_beam",
|
||||
L"mob/bear/polarbear",
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
L"misc/additionalmapicons",
|
||||
|
||||
@@ -180,7 +180,7 @@ typedef enum _TEXTURE_NAME
|
||||
TN_MOB_GUARDIAN,
|
||||
TN_MOB_GUARDIAN_ELDER,
|
||||
TN_MOB_GUARDIAN_BEAM,
|
||||
|
||||
TN_MOB_POLARBEAR,
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
TN_MISC_ADDITIONALMAPICONS,
|
||||
|
||||
@@ -2191,6 +2191,12 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
pMinecraft->setScreen(new ChatScreen());
|
||||
SetFocus(g_hWnd);
|
||||
}
|
||||
if (g_KBMInput.IsKeyPressed(VK_OEM_2) && app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL)
|
||||
{
|
||||
g_KBMInput.ClearCharBuffer();
|
||||
pMinecraft->setScreen(new ChatScreen(L"/"));
|
||||
SetFocus(g_hWnd);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// has the game defined profile data been changed (by a profile load)
|
||||
|
||||
@@ -9029,6 +9029,10 @@ All Ender Chests in a world are linked. Items placed into an Ender Chest are acc
|
||||
<value>Rabbit</value>
|
||||
</data>
|
||||
|
||||
<data name="IDS_POLAR_BEAR">
|
||||
<value>Polar Bear</value>
|
||||
</data>
|
||||
|
||||
<data name="IDS_DESC_RABBIT">
|
||||
<value>A harmless creature. May drop a rabbit hide or a rabbit's foot when killed.</value>
|
||||
</data>
|
||||
@@ -9485,6 +9489,11 @@ All Ender Chests in a world are linked. Items placed into an Ender Chest are acc
|
||||
|
||||
<data name="IDS_TILE_GRASS_PATH"><value>Dirt Path</value></data>
|
||||
<data name="IDS_TILE_BEETROOTS"><value>Beetroot</value></data>
|
||||
<data name="IDS_TILE_END_BRICKS"><value>End Stone Bricks</value></data>
|
||||
<data name="IDS_TILE_MAGMA"><value>Magma Block</value></data>
|
||||
<data name="IDS_TILE_NETHER_WART_BLOCK"><value>Nether Wart Block</value></data>
|
||||
<data name="IDS_TILE_RED_NETHER_BRICK"><value>Red Nether Bricks</value></data>
|
||||
<data name="IDS_TILE_BONE_BLOCK"><value>Bone Block</value></data>
|
||||
<data name="IDS_BEETROOT"><value>Beetroot</value></data>
|
||||
<data name="IDS_BEETROOT_SEEDS"><value>Beetroot Seeds</value></data>
|
||||
<data name="IDS_ITEM_BEETROOT_SOUP"><value>Beetroot Stew</value></data>
|
||||
|
||||
@@ -924,6 +924,10 @@ set(_MINECRAFT_CLIENT_COMMON_NET_MINECRAFT_CLIENT_RENDERER_ENTITY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/ZombieRenderer.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/RabbitRenderer.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/RabbitRenderer.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/PolarBearModel.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/PolarBearModel.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/PolarBearRenderer.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/PolarBearRenderer.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/ArmorStandRenderer.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/EndermiteRenderer.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/EndermiteRenderer.h"
|
||||
|
||||
@@ -60,6 +60,7 @@ static const int s_keyToVK[] = {
|
||||
VK_SUBTRACT,// KEY_SUBTRACT = 53
|
||||
VK_LEFT, // KEY_LEFT = 54
|
||||
VK_RIGHT, // KEY_RIGHT = 55
|
||||
VK_OEM_2, // KEY_SLASH = 56
|
||||
};
|
||||
static const int s_keyToVKCount = sizeof(s_keyToVK) / sizeof(s_keyToVK[0]);
|
||||
|
||||
|
||||
@@ -250,6 +250,7 @@ public:
|
||||
static const int KEY_SUBTRACT = 53;
|
||||
static const int KEY_LEFT = 54;
|
||||
static const int KEY_RIGHT = 55;
|
||||
static const int KEY_SLASH = 56;
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
// Map LWJGL-style key constant to Windows VK code
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#include "stdafx.h"
|
||||
#include "net.minecraft.world.h"
|
||||
#include "net.minecraft.world.entity.player.h"
|
||||
#include "IconRegister.h"
|
||||
#include "BoneBlockTile.h"
|
||||
|
||||
BoneBlockTile::BoneBlockTile(int id) : HayBlockTile(id)
|
||||
{
|
||||
material = Material::stone;
|
||||
}
|
||||
|
||||
void BoneBlockTile::playerDestroy(Level *level, shared_ptr<Player> player, int x, int y, int z, int data)
|
||||
{
|
||||
if (player->canDestroy(this))
|
||||
Tile::playerDestroy(level, player, x, y, z, data);
|
||||
}
|
||||
|
||||
void BoneBlockTile::registerIcons(IconRegister *iconRegister)
|
||||
{
|
||||
iconTop = iconRegister->registerIcon(L"bone_block_top");
|
||||
icon = iconRegister->registerIcon(L"bone_block_side");
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "HayBlockTile.h"
|
||||
|
||||
class BoneBlockTile : public HayBlockTile
|
||||
{
|
||||
public:
|
||||
BoneBlockTile(int id);
|
||||
virtual void registerIcons(IconRegister *iconRegister) override;
|
||||
virtual void playerDestroy(Level *level, shared_ptr<Player> player, int x, int y, int z, int data) override;
|
||||
};
|
||||
@@ -138,6 +138,7 @@ enum eINSTANCEOF
|
||||
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_POLARBEAR = eTYPE_ANIMAL | eTYPE_ANIMALS_SPAWN_LIMIT_CHECK | 0x6,
|
||||
|
||||
eTYPE_COW = eTYPE_ANIMAL | eTYPE_ANIMALS_SPAWN_LIMIT_CHECK | BIT_COW,
|
||||
eTYPE_MUSHROOMCOW = eTYPE_COW | 0x1,
|
||||
|
||||
@@ -118,6 +118,10 @@ void EntityIO::staticCtor()
|
||||
eMinecraftColour_Mob_Rabbit_Colour1,
|
||||
eMinecraftColour_Mob_Rabbit_Colour2, IDS_RABBIT);
|
||||
|
||||
setId(PolarBear::create, eTYPE_POLARBEAR, L"PolarBear", 107,
|
||||
eMinecraftColour_Mob_PolarBear_Colour1,
|
||||
eMinecraftColour_Mob_PolarBear_Colour2, IDS_POLAR_BEAR);
|
||||
|
||||
setId(ArmorStand::create, eTYPE_ARMORSTAND, L"ArmorStand", 102);
|
||||
|
||||
//change IDS_Endermite later
|
||||
|
||||
@@ -38,7 +38,14 @@ bool HoeItem::useOn(shared_ptr<ItemInstance> instance, shared_ptr<Player> player
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HoeItem::isHandEquipped()
|
||||
float HoeItem::getDestroySpeed(shared_ptr<ItemInstance> itemInstance, Tile *tile)
|
||||
{
|
||||
if (tile != nullptr && (tile->id == Tile::nether_wart_block_Id || tile->id == Tile::hayBlock->id))
|
||||
return tier->getSpeed();
|
||||
return Item::getDestroySpeed(itemInstance, tile);
|
||||
}
|
||||
|
||||
bool HoeItem::isHandEquipped()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
|
||||
virtual bool useOn(shared_ptr<ItemInstance> instance, shared_ptr<Player> player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false);
|
||||
virtual bool isHandEquipped();
|
||||
virtual float getDestroySpeed(shared_ptr<ItemInstance> itemInstance, Tile *tile) override;
|
||||
|
||||
const Tier *getTier();
|
||||
};
|
||||
@@ -208,6 +208,15 @@ void LivingEntity::baseTick()
|
||||
hurt(DamageSource::inWall, 1);
|
||||
}
|
||||
|
||||
if (!level->isClientSide && isAlive() && onGround && !isSneaking() && tickCount % 10 == 0)
|
||||
{
|
||||
int tileBelow = level->getTile(Mth::floor(x), Mth::floor(bb->y0) - 1, Mth::floor(z));
|
||||
if (tileBelow == Tile::magma_Id)
|
||||
{
|
||||
hurt(DamageSource::inFire, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (isFireImmune() || level->isClientSide) clearFire();
|
||||
shared_ptr<Player> thisPlayer = dynamic_pointer_cast<Player>(shared_from_this());
|
||||
bool isInvulnerable = (thisPlayer != nullptr && thisPlayer->abilities.invulnerable);
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "stdafx.h"
|
||||
#include "net.minecraft.world.level.h"
|
||||
#include "MagmaTile.h"
|
||||
|
||||
MagmaTile::MagmaTile(int id) : Tile(id, Material::stone)
|
||||
{
|
||||
setLightEmission(0.2f);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "Tile.h"
|
||||
|
||||
class MagmaTile : public Tile
|
||||
{
|
||||
public:
|
||||
MagmaTile(int id);
|
||||
};
|
||||
@@ -0,0 +1,209 @@
|
||||
#include "stdafx.h"
|
||||
#include "com.mojang.nbt.h"
|
||||
#include "net.minecraft.world.level.tile.h"
|
||||
#include "net.minecraft.world.phys.h"
|
||||
#include "net.minecraft.world.level.h"
|
||||
#include "net.minecraft.world.item.h"
|
||||
#include "net.minecraft.world.entity.h"
|
||||
#include "net.minecraft.world.entity.animal.h"
|
||||
#include "net.minecraft.world.entity.ai.attributes.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 "net.minecraft.world.damagesource.h"
|
||||
#include "SharedMonsterAttributes.h"
|
||||
#include "PolarBear.h"
|
||||
#include "../Minecraft.Client/Textures.h"
|
||||
#include "SoundTypes.h"
|
||||
|
||||
PolarBear::PolarBear(Level *level) : Animal(level)
|
||||
{
|
||||
this->defineSynchedData();
|
||||
registerAttributes();
|
||||
setHealth(getMaxHealth());
|
||||
|
||||
m_standing = false;
|
||||
clientSideStandAnimation = clientSideStandAnimationO = 0.0f;
|
||||
warningSoundTicks = 0;
|
||||
cubDefenseCooldown = 0;
|
||||
|
||||
setSize(1.3f, 1.4f);
|
||||
|
||||
getNavigation()->setAvoidWater(true);
|
||||
goalSelector.addGoal(0, new FloatGoal(this));
|
||||
goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.25, true));
|
||||
goalSelector.addGoal(1, new PanicGoal(this, 2.0));
|
||||
goalSelector.addGoal(4, new FollowParentGoal(this, 1.25));
|
||||
goalSelector.addGoal(5, new RandomStrollGoal(this, 1.0));
|
||||
goalSelector.addGoal(6, new LookAtPlayerGoal(this, typeid(Player), 6));
|
||||
goalSelector.addGoal(7, new RandomLookAroundGoal(this));
|
||||
|
||||
targetSelector.addGoal(1, new HurtByTargetGoal(this, true));
|
||||
}
|
||||
|
||||
bool PolarBear::useNewAi()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void PolarBear::registerAttributes()
|
||||
{
|
||||
Animal::registerAttributes();
|
||||
|
||||
getAttribute(SharedMonsterAttributes::MAX_HEALTH)->setBaseValue(30);
|
||||
getAttribute(SharedMonsterAttributes::FOLLOW_RANGE)->setBaseValue(20);
|
||||
getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->setBaseValue(0.25f);
|
||||
|
||||
getAttributes()->registerAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->setBaseValue(6);
|
||||
}
|
||||
|
||||
shared_ptr<AgableMob> PolarBear::getBreedOffspring(shared_ptr<AgableMob> target)
|
||||
{
|
||||
return std::make_shared<PolarBear>(level);
|
||||
}
|
||||
|
||||
bool PolarBear::isFood(shared_ptr<ItemInstance> itemInstance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int PolarBear::getAmbientSound()
|
||||
{
|
||||
return isBaby() ? eSoundType_MOB_POLARBEAR_BABY_AMBIENT : eSoundType_MOB_POLARBEAR_AMBIENT;
|
||||
}
|
||||
|
||||
int PolarBear::getHurtSound()
|
||||
{
|
||||
return eSoundType_MOB_POLARBEAR_HURT;
|
||||
}
|
||||
|
||||
int PolarBear::getDeathSound()
|
||||
{
|
||||
return eSoundType_MOB_POLARBEAR_DEATH;
|
||||
}
|
||||
|
||||
void PolarBear::playStepSound(int xt, int yt, int zt, int t)
|
||||
{
|
||||
playSound(eSoundType_MOB_POLARBEAR_STEP, 0.15f, 1.0f);
|
||||
}
|
||||
|
||||
void PolarBear::playWarningSound()
|
||||
{
|
||||
if (warningSoundTicks <= 0)
|
||||
{
|
||||
playSound(eSoundType_MOB_POLARBEAR_WARNING, 1.0f, getVoicePitch());
|
||||
warningSoundTicks = 40;
|
||||
}
|
||||
}
|
||||
|
||||
void PolarBear::setTarget(shared_ptr<LivingEntity> newTarget)
|
||||
{
|
||||
shared_ptr<LivingEntity> old = getTarget();
|
||||
Animal::setTarget(newTarget);
|
||||
if (newTarget != nullptr && old == nullptr && !isBaby())
|
||||
{
|
||||
playWarningSound();
|
||||
}
|
||||
}
|
||||
|
||||
int PolarBear::getDeathLoot()
|
||||
{
|
||||
return Item::fish_Id;
|
||||
}
|
||||
|
||||
bool PolarBear::doHurtTarget(shared_ptr<Entity> target)
|
||||
{
|
||||
if (isBaby())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
float dmg = (float)getAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->getValue();
|
||||
return target->hurt(DamageSource::mobAttack(dynamic_pointer_cast<LivingEntity>(shared_from_this())), dmg);
|
||||
}
|
||||
|
||||
bool PolarBear::isStanding()
|
||||
{
|
||||
return m_standing;
|
||||
}
|
||||
|
||||
void PolarBear::setStanding(bool standing)
|
||||
{
|
||||
m_standing = standing;
|
||||
}
|
||||
|
||||
float PolarBear::getStandingAnimationScale(float a)
|
||||
{
|
||||
return (clientSideStandAnimationO + (clientSideStandAnimation - clientSideStandAnimationO) * a) / 6.0f;
|
||||
}
|
||||
|
||||
void PolarBear::aiStep()
|
||||
{
|
||||
Animal::aiStep();
|
||||
|
||||
if (level->isClientSide)
|
||||
{
|
||||
clientSideStandAnimationO = clientSideStandAnimation;
|
||||
if (isStanding())
|
||||
{
|
||||
clientSideStandAnimation = Mth::clamp(clientSideStandAnimation + 1.0f, 0.0f, 6.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
clientSideStandAnimation = Mth::clamp(clientSideStandAnimation - 1.0f, 0.0f, 6.0f);
|
||||
}
|
||||
}
|
||||
|
||||
if (warningSoundTicks > 0)
|
||||
{
|
||||
--warningSoundTicks;
|
||||
}
|
||||
|
||||
if (!level->isClientSide && !isBaby() && getTarget() == nullptr)
|
||||
{
|
||||
if (cubDefenseCooldown > 0)
|
||||
{
|
||||
--cubDefenseCooldown;
|
||||
}
|
||||
else
|
||||
{
|
||||
cubDefenseCooldown = 10;
|
||||
bool cubNear = false;
|
||||
vector<shared_ptr<Entity> > *bears = level->getEntitiesOfClass(typeid(PolarBear), bb->grow(8.0, 4.0, 8.0));
|
||||
for (auto &it : *bears)
|
||||
{
|
||||
shared_ptr<PolarBear> other = dynamic_pointer_cast<PolarBear>(it);
|
||||
if (other != nullptr && other.get() != this && other->isBaby())
|
||||
{
|
||||
cubNear = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
delete bears;
|
||||
if (cubNear)
|
||||
{
|
||||
shared_ptr<Entity> p = level->getNearestAttackablePlayer(shared_from_this(), 16.0);
|
||||
if (p != nullptr)
|
||||
{
|
||||
setTarget(dynamic_pointer_cast<LivingEntity>(p));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MobGroupData *PolarBear::finalizeMobSpawn(MobGroupData *groupData, int extraData)
|
||||
{
|
||||
groupData = Animal::finalizeMobSpawn(groupData);
|
||||
|
||||
if (groupData == nullptr || dynamic_cast<PolarBearGroupData *>(groupData) == nullptr)
|
||||
{
|
||||
groupData = new PolarBearGroupData();
|
||||
}
|
||||
else
|
||||
{
|
||||
setAge(CUB_AGE);
|
||||
}
|
||||
|
||||
return groupData;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
#pragma once
|
||||
|
||||
#include "Animal.h"
|
||||
#include "MobGroupData.h"
|
||||
|
||||
class DamageSource;
|
||||
|
||||
class PolarBear : public Animal
|
||||
{
|
||||
public:
|
||||
eINSTANCEOF GetType() { return eTYPE_POLARBEAR; }
|
||||
static Entity *create(Level *level) { return new PolarBear(level); }
|
||||
|
||||
private:
|
||||
static const int CUB_AGE = -23488;
|
||||
|
||||
float clientSideStandAnimationO;
|
||||
float clientSideStandAnimation;
|
||||
int warningSoundTicks;
|
||||
int cubDefenseCooldown;
|
||||
|
||||
public:
|
||||
PolarBear(Level *level);
|
||||
|
||||
virtual bool useNewAi();
|
||||
|
||||
protected:
|
||||
virtual void registerAttributes();
|
||||
|
||||
public:
|
||||
virtual shared_ptr<AgableMob> getBreedOffspring(shared_ptr<AgableMob> target);
|
||||
virtual bool isFood(shared_ptr<ItemInstance> itemInstance);
|
||||
|
||||
protected:
|
||||
virtual int getAmbientSound();
|
||||
virtual int getHurtSound();
|
||||
virtual int getDeathSound();
|
||||
virtual int getDeathLoot();
|
||||
virtual void playStepSound(int xt, int yt, int zt, int t);
|
||||
|
||||
public:
|
||||
virtual bool doHurtTarget(shared_ptr<Entity> target);
|
||||
virtual bool isStanding();
|
||||
void setStanding(bool standing);
|
||||
float getStandingAnimationScale(float a);
|
||||
|
||||
void playWarningSound();
|
||||
virtual void setTarget(shared_ptr<LivingEntity> target);
|
||||
|
||||
virtual void aiStep();
|
||||
virtual MobGroupData *finalizeMobSpawn(MobGroupData *groupData, int extraData = 0);
|
||||
|
||||
private:
|
||||
bool m_standing;
|
||||
};
|
||||
|
||||
class PolarBearGroupData : public MobGroupData
|
||||
{
|
||||
};
|
||||
@@ -275,7 +275,14 @@ enum eSOUND_TYPE
|
||||
eSoundType_MOB_ELDER_GUARDIAN_DEATH,
|
||||
eSoundType_MOB_ELDER_GUARDIAN_HIT,
|
||||
eSoundType_MOB_ELDER_GUARDIAN_IDLE,
|
||||
|
||||
|
||||
eSoundType_MOB_POLARBEAR_BABY_AMBIENT,
|
||||
eSoundType_MOB_POLARBEAR_AMBIENT,
|
||||
eSoundType_MOB_POLARBEAR_HURT,
|
||||
eSoundType_MOB_POLARBEAR_DEATH,
|
||||
eSoundType_MOB_POLARBEAR_STEP,
|
||||
eSoundType_MOB_POLARBEAR_WARNING,
|
||||
|
||||
eSoundType_MAX
|
||||
};
|
||||
|
||||
|
||||
@@ -269,6 +269,11 @@ Tile* Tile::packedIce = nullptr;
|
||||
FrostedIceTile* Tile::frosted_ice = nullptr;
|
||||
GrassPathTile* Tile::grass_path = nullptr;
|
||||
BeetrootTile* Tile::beetroots = nullptr;
|
||||
Tile* Tile::end_bricks = nullptr;
|
||||
MagmaTile* Tile::magma = nullptr;
|
||||
Tile* Tile::nether_wart_block = nullptr;
|
||||
Tile* Tile::red_nether_brick = nullptr;
|
||||
BoneBlockTile* Tile::bone_block = nullptr;
|
||||
|
||||
Tile* Tile::barrier = nullptr;
|
||||
TallGrass2* Tile::double_plant = nullptr;
|
||||
@@ -584,6 +589,12 @@ void Tile::staticCtor()
|
||||
Tile::grass_path = static_cast<GrassPathTile*>((new GrassPathTile(grass_path_Id))->setDestroyTime(0.65f)->setSoundType(SOUND_GRAVEL)->setIconName(L"grass_path_top")->setDescriptionId(IDS_TILE_GRASS_PATH)->setUseDescriptionId(IDS_DESC_DIRT)->sendTileData());
|
||||
Tile::frosted_ice = static_cast<FrostedIceTile*>((new FrostedIceTile(frosted_ice_Id))->setDestroyTime(0.5f)->setLightBlock(3)->setSoundType(Tile::SOUND_GLASS)->setIconName(L"ice")->setDescriptionId(IDS_TILE_FROSTED_ICE)->setUseDescriptionId(IDS_DESC_ICE)->setNotCollectStatistics());
|
||||
|
||||
Tile::end_bricks = (new Tile(end_bricks_Id, Material::stone))->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_stone)->setDestroyTime(3.0f)->setExplodeable(9)->setSoundType(SOUND_STONE)->setIconName(L"end_bricks")->setDescriptionId(IDS_TILE_END_BRICKS)->setUseDescriptionId(IDS_DESC_STONE);
|
||||
Tile::magma = static_cast<MagmaTile*>((new MagmaTile(magma_Id))->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_stone)->setDestroyTime(0.5f)->setExplodeable(6)->setSoundType(SOUND_STONE)->setIconName(L"magma")->setDescriptionId(IDS_TILE_MAGMA)->setUseDescriptionId(IDS_DESC_STONE));
|
||||
Tile::nether_wart_block = (new Tile(nether_wart_block_Id, Material::grass))->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_wheat)->setDestroyTime(0.5f)->setSoundType(SOUND_WOOD)->setIconName(L"nether_wart_block")->setDescriptionId(IDS_TILE_NETHER_WART_BLOCK)->setUseDescriptionId(IDS_DESC_STONE);
|
||||
Tile::red_nether_brick = (new Tile(red_nether_brick_Id, Material::stone))->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_stone)->setDestroyTime(2.0f)->setExplodeable(6)->setSoundType(SOUND_STONE)->setIconName(L"red_nether_brick")->setDescriptionId(IDS_TILE_RED_NETHER_BRICK)->setUseDescriptionId(IDS_DESC_STONE);
|
||||
Tile::bone_block = static_cast<BoneBlockTile*>((new BoneBlockTile(bone_block_Id))->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_stone)->setDestroyTime(1.5f)->setExplodeable(10)->setSoundType(SOUND_STONE)->setIconName(L"bone_block_side")->setDescriptionId(IDS_TILE_BONE_BLOCK)->setUseDescriptionId(IDS_DESC_STONE)->sendTileData());
|
||||
|
||||
Tile::daylight_detector_inverted = static_cast<DaylightDetectorTile*>((new DaylightDetectorTile(178, true))->setDestroyTime(0.2f)->setSoundType(SOUND_WOOD)->setIconName(L"daylight_detector")->setDescriptionId(IDS_TILE_DAYLIGHT_DETECTOR)->setUseDescriptionId(IDS_DESC_DAYLIGHT_DETECTOR));
|
||||
Tile::red_sandstone = (new RedSandStoneTile(red_sandstone_Id))->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_sand)->setSoundType(Tile::SOUND_STONE)->setDestroyTime(0.8f)->sendTileData()->setIconName(L"red_sandstone")->setDescriptionId(IDS_TILE_RED_SANDSTONE)->setUseDescriptionId(IDS_DESC_RED_SANDSTONE)->sendTileData();
|
||||
Tile::stairs_red_sandstone = (new StairTile(red_sandstone_stairs_Id, Tile::red_sandstone, 0))->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_sand)->setIconName(L"stairsRedSandstone")->setDescriptionId(IDS_TILE_STAIRS_RED_SANDSTONE)->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS);
|
||||
@@ -1914,4 +1925,9 @@ const int Tile::dark_oak_stairs_Id;
|
||||
const int Tile::slime_Id;
|
||||
const int Tile::beetroots_Id;
|
||||
const int Tile::grass_path_Id;
|
||||
const int Tile::end_bricks_Id;
|
||||
const int Tile::magma_Id;
|
||||
const int Tile::nether_wart_block_Id;
|
||||
const int Tile::red_nether_brick_Id;
|
||||
const int Tile::bone_block_Id;
|
||||
#endif
|
||||
+12
-5
@@ -47,6 +47,8 @@ class TallGrass2;
|
||||
class FrostedIceTile;
|
||||
class GrassPathTile;
|
||||
class BeetrootTile;
|
||||
class MagmaTile;
|
||||
class BoneBlockTile;
|
||||
|
||||
class ChunkRebuildData;
|
||||
|
||||
@@ -443,15 +445,15 @@ public:
|
||||
//purpur_stairs 203
|
||||
//purpur_double_slab 204
|
||||
//purpur_slab 205
|
||||
//end_bricks 206
|
||||
static const int end_bricks_Id = 206;
|
||||
static const int beetroots_Id = 207;
|
||||
static const int grass_path_Id = 208;
|
||||
//end_gateway 209
|
||||
static const int frosted_ice_Id = 212;
|
||||
//magma 213
|
||||
//nether_wart_block 214
|
||||
//red_nether_brick 215
|
||||
//bone_block 216
|
||||
static const int magma_Id = 213;
|
||||
static const int nether_wart_block_Id = 214;
|
||||
static const int red_nether_brick_Id = 215;
|
||||
static const int bone_block_Id = 216;
|
||||
//structure_void 217
|
||||
//
|
||||
//
|
||||
@@ -668,6 +670,11 @@ public:
|
||||
static FrostedIceTile* frosted_ice;
|
||||
static GrassPathTile* grass_path;
|
||||
static BeetrootTile* beetroots;
|
||||
static Tile* end_bricks;
|
||||
static MagmaTile* magma;
|
||||
static Tile* nether_wart_block;
|
||||
static Tile* red_nether_brick;
|
||||
static BoneBlockTile* bone_block;
|
||||
static Tile* seaLantern;
|
||||
static Tile* prismarine;
|
||||
|
||||
|
||||
@@ -792,6 +792,8 @@ set(_MINECRAFT_WORLD_COMMON_NET_MINECRAFT_WORLD_ENTITY_ANIMAL
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Wolf.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Rabbit.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Rabbit.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/PolarBear.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/PolarBear.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/net.minecraft.world.entity.animal.h"
|
||||
)
|
||||
source_group("net/minecraft/world/entity/animal" FILES ${_MINECRAFT_WORLD_COMMON_NET_MINECRAFT_WORLD_ENTITY_ANIMAL})
|
||||
@@ -2049,6 +2051,10 @@ set(_MINECRAFT_WORLD_COMMON_NET_MINECRAFT_WORLD_LEVEL_TILE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/GrassPathTile.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/BeetrootTile.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/BeetrootTile.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/MagmaTile.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/MagmaTile.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/BoneBlockTile.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/BoneBlockTile.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/RedSandStoneTile.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/SeaLanternTile.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/PrismarineTile.cpp"
|
||||
|
||||
@@ -23,4 +23,5 @@
|
||||
#include "EntityHorse.h"
|
||||
|
||||
//TU31
|
||||
#include "Rabbit.h"
|
||||
#include "Rabbit.h"
|
||||
#include "PolarBear.h"
|
||||
@@ -147,5 +147,7 @@
|
||||
#include "StoneSlabTile2.h"
|
||||
#include "GrassPathTile.h"
|
||||
#include "BeetrootTile.h"
|
||||
#include "MagmaTile.h"
|
||||
#include "BoneBlockTile.h"
|
||||
|
||||
|
||||
Reference in new issue
Block a user