diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp index bd26e8c0..d8ac54f5 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp @@ -210,7 +210,16 @@ void IUIScene_CreativeMenu::staticCtor() ITEM_AUX(Tile::tallgrass_Id, TallGrass::FERN) ITEM(Tile::deadBush_Id) ITEM(Tile::flower_Id) - ITEM(Tile::rose_Id) + ITEM_AUX(Tile::rose_Id, 0) + ITEM_AUX(Tile::rose_Id, Rose::BLUE_ORCHID) + ITEM_AUX(Tile::rose_Id, Rose::ALLIUM) + ITEM_AUX(Tile::rose_Id, Rose::AZURE_BLUET) + ITEM_AUX(Tile::rose_Id, Rose::RED_TULIP) + ITEM_AUX(Tile::rose_Id, Rose::ORANGE_TULIP) + ITEM_AUX(Tile::rose_Id, Rose::WHITE_TULIP) + ITEM_AUX(Tile::rose_Id, Rose::PINK_TULIP) + ITEM_AUX(Tile::rose_Id, Rose::OXEYE_DAISY) + ITEM(Tile::mushroom_brown_Id) ITEM(Tile::mushroom_red_Id) ITEM(Tile::cactus_Id) diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/terrain.png b/Minecraft.Client/Common/res/TitleUpdate/res/terrain.png index 8590b20d..d68859ef 100644 Binary files a/Minecraft.Client/Common/res/TitleUpdate/res/terrain.png and b/Minecraft.Client/Common/res/TitleUpdate/res/terrain.png differ diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/terrainMipMapLevel2.png b/Minecraft.Client/Common/res/TitleUpdate/res/terrainMipMapLevel2.png index 4ce59394..5f0296a6 100644 Binary files a/Minecraft.Client/Common/res/TitleUpdate/res/terrainMipMapLevel2.png and b/Minecraft.Client/Common/res/TitleUpdate/res/terrainMipMapLevel2.png differ diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/terrainMipMapLevel3.png b/Minecraft.Client/Common/res/TitleUpdate/res/terrainMipMapLevel3.png index 267ac45b..42e6ac55 100644 Binary files a/Minecraft.Client/Common/res/TitleUpdate/res/terrainMipMapLevel3.png and b/Minecraft.Client/Common/res/TitleUpdate/res/terrainMipMapLevel3.png differ diff --git a/Minecraft.Client/PreStitchedTextureMap.cpp b/Minecraft.Client/PreStitchedTextureMap.cpp index e9cf82a2..09f6ae50 100644 --- a/Minecraft.Client/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/PreStitchedTextureMap.cpp @@ -1018,13 +1018,13 @@ void PreStitchedTextureMap::loadUVs() ADD_ICON(21, 9, L"stone_diorite"); ADD_ICON(21, 10, L"stone_diorite_smooth"); - ADD_ICON(22, 1, L"flower_blue_orchid"); - ADD_ICON(22, 2, L"flower_allium"); - ADD_ICON(22, 3, L"flower_houstonia"); - ADD_ICON(22, 4, L"flower_tulip_red"); - ADD_ICON(22, 5, L"flower_tulip_orange"); - ADD_ICON(22, 6, L"flower_tulip_white"); - ADD_ICON(22, 7, L"flower_tulip_pink"); - ADD_ICON(22, 8, L"flower_oxeye_daisy"); + ADD_ICON(22, 0, L"flower_blue_orchid"); + ADD_ICON(22, 1, L"flower_allium"); + ADD_ICON(22, 2, L"flower_houstonia"); + ADD_ICON(22, 3, L"flower_tulip_red"); + ADD_ICON(22, 4, L"flower_tulip_orange"); + ADD_ICON(22, 5, L"flower_tulip_white"); + ADD_ICON(22, 6, L"flower_tulip_pink"); + ADD_ICON(22, 7, L"flower_oxeye_daisy"); } } diff --git a/Minecraft.Client/SheepFurModel.cpp b/Minecraft.Client/SheepFurModel.cpp index 648c5603..4af11ab1 100644 --- a/Minecraft.Client/SheepFurModel.cpp +++ b/Minecraft.Client/SheepFurModel.cpp @@ -2,6 +2,7 @@ #include "..\Minecraft.World\net.minecraft.world.entity.animal.h" #include "SheepFurModel.h" #include "ModelPart.h" +#include "../Minecraft.World/Sheep.cpp" SheepFurModel::SheepFurModel() : QuadrupedModel(12, 0) { @@ -48,6 +49,21 @@ void SheepFurModel::prepareMobModel(shared_ptr mob, float time, fl shared_ptr sheep = dynamic_pointer_cast(mob); head->y = 6 + sheep->getHeadEatPositionScale(a) * 9.0f; headXRot = sheep->getHeadEatAngleScale(a); + + wstring name = mob->getAName(); + if (name == L"jeb_") + { + int i1 = 25; + int i = mob->tickCount / 25; + int j = Sheep::COLOR_LENGTH; + int k = i % j; + int l = (i + 1) % j; + float f = ((float)(mob->tickCount % 25) + time) / 25.0F; + const float* afloat1 = Sheep::COLOR[k]; + const float* afloat2 = Sheep::COLOR[l]; + + RenderManager.StateSetColour(afloat1[0] * (1.0F - f) + afloat2[0] * f, afloat1[1] * (1.0F - f) + afloat2[1] * f, afloat1[2] * (1.0F - f) + afloat2[2] * f, 1.0f); + } } void SheepFurModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr entity, unsigned int uiBitmaskOverrideAnim) diff --git a/Minecraft.World/Minecraft.World.vcxproj b/Minecraft.World/Minecraft.World.vcxproj index d3683776..e499c966 100644 --- a/Minecraft.World/Minecraft.World.vcxproj +++ b/Minecraft.World/Minecraft.World.vcxproj @@ -3634,6 +3634,8 @@ + + diff --git a/Minecraft.World/Minecraft.World.vcxproj.filters b/Minecraft.World/Minecraft.World.vcxproj.filters index c7273fdd..86416ff6 100644 --- a/Minecraft.World/Minecraft.World.vcxproj.filters +++ b/Minecraft.World/Minecraft.World.vcxproj.filters @@ -3200,6 +3200,9 @@ net\minecraft\world\entity\animal + + Header Files + @@ -5632,5 +5635,8 @@ net\minecraft\world\entity\animal + + Source Files + \ No newline at end of file diff --git a/Minecraft.World/Rose.cpp b/Minecraft.World/Rose.cpp new file mode 100644 index 00000000..49e9964b --- /dev/null +++ b/Minecraft.World/Rose.cpp @@ -0,0 +1,141 @@ +#include "stdafx.h" +#include "net.minecraft.world.level.h" +#include "net.minecraft.world.h" +#include "GrassTile.h" +#include "Rose.h" + +const unsigned int Rose::FLOWER_NAMES[FLOWER_NAMES_LENGTH] = { IDS_TILE_ROSE, +IDS_TILE_STONE, +IDS_TILE_STONE, +IDS_TILE_STONE, +IDS_TILE_STONE, +IDS_TILE_STONE, +IDS_TILE_STONE, +IDS_TILE_STONE, +IDS_TILE_STONE }; + +const wstring Rose::TEXTURE_NAMES[] = { + L"flower_rose", + L"flower_blue_orchid", + L"flower_allium", + L"flower_houstonia", + L"flower_tulip_red", + L"flower_tulip_orange", + L"flower_tulip_white", + L"flower_tulip_pink", + L"flower_oxeye_daisy" +}; + +bool Rose::mayPlace(Level* level, int x, int y, int z) +{ + return Tile::mayPlace(level, x, y, z) && mayPlaceOn(level->getTile(x, y - 1, z)); +} + +bool Rose::mayPlaceOn(int tile) +{ + return tile == Tile::grass_Id || tile == Tile::dirt_Id || tile == Tile::farmland_Id; +} + +// 4J Added override +void Rose::updateDefaultShape() +{ + float ss = 0.2f; + setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, ss * 3, 0.5f + ss); +} + + +void Rose::_init() +{ + setTicking(true); + updateDefaultShape(); +} + +Rose::Rose(int id) : Tile(id, Material::plant, isSolidRender()) +{ + icons = nullptr; + _init(); +} + +unsigned int Rose::getDescriptionId(int iData) +{ + if (iData < 0 || iData >= FLOWER_NAMES_LENGTH) iData = 0; + + return FLOWER_NAMES[iData]; +} + +int Rose::getSpawnResourcesAuxValue(int data) +{ + return data; +} + +Icon* Rose::getTexture(int face, int data) +{ + if (data < 0 || data >= FLOWER_NAMES_LENGTH) + { + data = 0; + } + return icons[data]; +} + +void Rose::registerIcons(IconRegister* iconRegister) +{ + icons = new Icon * [FLOWER_NAMES_LENGTH]; + + for (int i = 0; i < FLOWER_NAMES_LENGTH; i++) + { +#ifndef _CONTENT_PACKAGE + wprintf(L"Rose::registerIcons: idx=%d name=%ls\n", i, TEXTURE_NAMES[i].c_str()); +#endif + icons[i] = iconRegister->registerIcon(TEXTURE_NAMES[i]); + } +} + +void Rose::neighborChanged(Level* level, int x, int y, int z, int type) +{ + Tile::neighborChanged(level, x, y, z, type); + checkAlive(level, x, y, z); +} + +void Rose::tick(Level* level, int x, int y, int z, Random* random) +{ + checkAlive(level, x, y, z); +} + +void Rose::checkAlive(Level* level, int x, int y, int z) +{ + if (!canSurvive(level, x, y, z)) + { + this->spawnResources(level, x, y, z, level->getData(x, y, z), 0); + level->setTileAndData(x, y, z, 0, 0, UPDATE_CLIENTS); + } +} + +bool Rose::canSurvive(Level* level, int x, int y, int z) +{ + return (level->getDaytimeRawBrightness(x, y, z) >= 8 || (level->canSeeSky(x, y, z))) && mayPlaceOn(level->getTile(x, y - 1, z)); +} + +AABB* Rose::getAABB(Level* level, int x, int y, int z) +{ + return nullptr; +} + +bool Rose::blocksLight() +{ + return false; +} + +bool Rose::isSolidRender(bool isServerLevel) +{ + return false; +} + +bool Rose::isCubeShaped() +{ + return false; +} + +int Rose::getRenderShape() +{ + return Tile::SHAPE_CROSS_TEXTURE; +} diff --git a/Minecraft.World/Rose.h b/Minecraft.World/Rose.h new file mode 100644 index 00000000..77b9bc5f --- /dev/null +++ b/Minecraft.World/Rose.h @@ -0,0 +1,60 @@ +#pragma once +#include "Tile.h" +#include "Material.h" +#include "Definitions.h" + +class Random; +class Level; + +class Rose : public Tile +{ +friend class Tile; +public: + static const int BLUE_ORCHID = 1; + static const int ALLIUM = 2; + static const int AZURE_BLUET = 3; + static const int RED_TULIP = 4; + static const int ORANGE_TULIP = 5; + static const int WHITE_TULIP = 6; + static const int PINK_TULIP = 7; + static const int OXEYE_DAISY = 8; + + static const int FLOWER_NAMES_LENGTH = 9; + static const unsigned int FLOWER_NAMES[FLOWER_NAMES_LENGTH]; + static const wstring TEXTURE_NAMES[]; + +private: + Icon** icons; + void _init(); + +protected: + Rose(int id); + +public: + virtual void updateDefaultShape(); + virtual bool mayPlace(Level* level, int x, int y, int z); + +protected: + virtual bool mayPlaceOn(int tile); + +public: + 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); + +protected: + void checkAlive(Level* level, int x, int y, int z); + +public: + virtual bool canSurvive(Level* level, int x, int y, int z); + virtual AABB* getAABB(Level* level, int x, int y, int z); + virtual bool blocksLight(); + + virtual bool isSolidRender(bool isServerLevel = false); + virtual bool isCubeShaped(); + virtual int getRenderShape(); + + virtual Icon* getTexture(int face, int data); + virtual unsigned int getDescriptionId(int iData = -1); + virtual int getSpawnResourcesAuxValue(int data); + void registerIcons(IconRegister* iconRegister); +}; diff --git a/Minecraft.World/Tile.cpp b/Minecraft.World/Tile.cpp index a2000abc..c11ed2fc 100644 --- a/Minecraft.World/Tile.cpp +++ b/Minecraft.World/Tile.cpp @@ -324,7 +324,7 @@ void Tile::staticCtor() Tile::wool = (new ColoredTile(35, Material::cloth)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_cloth, Item::eMaterial_cloth)->setDestroyTime(0.8f)->setSoundType(Tile::SOUND_CLOTH)->setIconName(L"wool_colored")->setDescriptionId(IDS_TILE_CLOTH)->sendTileData()->setUseDescriptionId(IDS_DESC_WOOL); Tile::pistonMovingPiece = static_cast((new PistonMovingPiece(36))->setDescriptionId(IDS_TILE_PISTON_BASE)->setUseDescriptionId(-1)); Tile::flower = static_cast((new Bush(37))->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"flower_dandelion")->setDescriptionId(IDS_TILE_FLOWER)->setUseDescriptionId(IDS_DESC_FLOWER)->disableMipmap()); - Tile::rose = static_cast((new Bush(38))->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"flower_rose")->setDescriptionId(IDS_TILE_ROSE)->setUseDescriptionId(IDS_DESC_FLOWER)->disableMipmap()); + Tile::rose = static_cast((new Rose(38))->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"flower_rose")->setDescriptionId(IDS_TILE_ROSE)->setUseDescriptionId(IDS_DESC_FLOWER)->disableMipmap()); Tile::mushroom_brown = static_cast((new Mushroom(39))->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setLightEmission(2 / 16.0f)->setIconName(L"mushroom_brown")->setDescriptionId(IDS_TILE_MUSHROOM)->setUseDescriptionId(IDS_DESC_MUSHROOM)->disableMipmap()); Tile::mushroom_red = static_cast((new Mushroom(40))->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"mushroom_red")->setDescriptionId(IDS_TILE_MUSHROOM)->setUseDescriptionId(IDS_DESC_MUSHROOM)->disableMipmap()); @@ -521,6 +521,7 @@ void Tile::staticCtor() Item::items[anvil_Id] = ( new AnvilTileItem(anvil) )->setDescriptionId(IDS_TILE_ANVIL)->setUseDescriptionId(IDS_DESC_ANVIL); Item::items[dirt_Id] = (new MultiTextureTileItem(Tile::dirt_Id - 256, dirt, (int*)DirtTile::DIRT_NAMES, 3))->setIconName(L"dirt")->setDescriptionId(IDS_TILE_DIRT)->setUseDescriptionId(IDS_DESC_DIRT); Item::items[stone_Id] = (new MultiTextureTileItem(Tile::stone_Id - 256, dirt, (int*)StoneTile::STONE_NAMES, 3))->setIconName(L"stone")->setDescriptionId(IDS_TILE_STONE)->setUseDescriptionId(IDS_DESC_STONE); + Item::items[rose_Id] = (new MultiTextureTileItem(Tile::rose_Id - 256, rose, (int*)Rose::FLOWER_NAMES, Rose::FLOWER_NAMES_LENGTH))->setIconName(L"flower_rose")->setDescriptionId(IDS_TILE_ROSE)->setUseDescriptionId(IDS_DESC_FLOWER); for (int i = 0; i < 256; i++) { diff --git a/Minecraft.World/net.minecraft.world.level.tile.h b/Minecraft.World/net.minecraft.world.level.tile.h index 36c7ac5c..565f39be 100644 --- a/Minecraft.World/net.minecraft.world.level.tile.h +++ b/Minecraft.World/net.minecraft.world.level.tile.h @@ -129,5 +129,6 @@ #include "HalfSlabTile.h" #include "WoodSlabTile.h" #include "WoolCarpetTile.h" +#include "Rose.h"