diff --git a/platforms/macos/projects/Minecraft/Minecraft.xcodeproj/project.pbxproj b/platforms/macos/projects/Minecraft/Minecraft.xcodeproj/project.pbxproj index d8e42801d..1673f7754 100644 --- a/platforms/macos/projects/Minecraft/Minecraft.xcodeproj/project.pbxproj +++ b/platforms/macos/projects/Minecraft/Minecraft.xcodeproj/project.pbxproj @@ -173,6 +173,9 @@ 8406FDD32AF182E700B09C1D /* WindowsIncludes.h in Headers */ = {isa = PBXBuildFile; fileRef = 840DD8432AC810630006A435 /* WindowsIncludes.h */; }; 8406FDD42AF182E700B09C1D /* WSAStartupSingleton.h in Headers */ = {isa = PBXBuildFile; fileRef = 840DD8452AC810630006A435 /* WSAStartupSingleton.h */; }; 8406FDD52AF182E700B09C1D /* XBox360Includes.h in Headers */ = {isa = PBXBuildFile; fileRef = 840DD8462AC810630006A435 /* XBox360Includes.h */; }; + 840823DA2F4FF4B80097F6A5 /* CoalItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 840823D72F4FF4B80097F6A5 /* CoalItem.cpp */; }; + 840823DB2F4FF4B80097F6A5 /* CoalItem.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 840823D82F4FF4B80097F6A5 /* CoalItem.hpp */; }; + 840823DC2F4FF4B80097F6A5 /* Tool.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 840823D92F4FF4B80097F6A5 /* Tool.hpp */; }; 84171E812B1A6227008B82E6 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84C4D86E2A872C0100323E33 /* OpenAL.framework */; }; 841DD8772AF8AA7A00AA3B66 /* AppPlatform_sdl2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 841DD8722AF8AA7A00AA3B66 /* AppPlatform_sdl2.cpp */; }; 841DD8782AF8AA7A00AA3B66 /* AppPlatform_sdl2_desktop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 841DD8752AF8AA7A00AA3B66 /* AppPlatform_sdl2_desktop.cpp */; }; @@ -1605,6 +1608,9 @@ /* Begin PBXFileReference section */ 8400360F2E89DADB00C14213 /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamecontroller.h; sourceTree = ""; }; 8406FD292AF1814500B09C1D /* libRenderer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRenderer.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 840823D72F4FF4B80097F6A5 /* CoalItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CoalItem.cpp; sourceTree = ""; }; + 840823D82F4FF4B80097F6A5 /* CoalItem.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CoalItem.hpp; sourceTree = ""; }; + 840823D92F4FF4B80097F6A5 /* Tool.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Tool.hpp; sourceTree = ""; }; 840DD5792AC810620006A435 /* KeyCodes.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = KeyCodes.hpp; sourceTree = ""; }; 840DD57A2AC810620006A435 /* SDLKeyCodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLKeyCodes.h; sourceTree = ""; }; 840DD57E2AC810620006A435 /* App.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = App.cpp; sourceTree = ""; }; @@ -3850,31 +3856,29 @@ 840DD66F2AC810620006A435 /* item */ = { isa = PBXGroup; children = ( - 84B9D8962F3BE0A900FD67C4 /* ArmorItem.hpp */, 84B9D8972F3BE0A900FD67C4 /* ArmorItem.cpp */, - 84B9D8982F3BE0A900FD67C4 /* HoeItem.hpp */, - 84B9D8992F3BE0A900FD67C4 /* HoeItem.cpp */, - 84B9D89A2F3BE0A900FD67C4 /* SeedItem.hpp */, - 84B9D89B2F3BE0A900FD67C4 /* SeedItem.cpp */, - 848CCB482F3A974000031D1F /* FoodItem.hpp */, - 848CCB492F3A974000031D1F /* FoodItem.cpp */, - 848AA3132F34E897007E9A3E /* DyePowderItem.hpp */, - 848AA3142F34E897007E9A3E /* DyePowderItem.cpp */, - 84C614242F323602008AC5BE /* BowItem.hpp */, - 84C614252F323602008AC5BE /* BowItem.cpp */, - 84C614262F323602008AC5BE /* WeaponItem.hpp */, - 84C614272F323602008AC5BE /* WeaponItem.cpp */, + 84B9D8962F3BE0A900FD67C4 /* ArmorItem.hpp */, 84E1C9DF2E7FDC72007D2F5D /* AuxTileItem.cpp */, 84E1C9E02E7FDC72007D2F5D /* AuxTileItem.hpp */, + 84C614252F323602008AC5BE /* BowItem.cpp */, + 84C614242F323602008AC5BE /* BowItem.hpp */, 840DD6702AC810620006A435 /* CameraItem.cpp */, 840DD6712AC810620006A435 /* CameraItem.hpp */, 84E1C9E12E7FDC72007D2F5D /* ClothItem.cpp */, 84E1C9E22E7FDC72007D2F5D /* ClothItem.hpp */, + 840823D72F4FF4B80097F6A5 /* CoalItem.cpp */, + 840823D82F4FF4B80097F6A5 /* CoalItem.hpp */, 84DED19E2F309611004001C5 /* crafting */, 840DD6722AC810620006A435 /* DoorItem.cpp */, 840DD6732AC810620006A435 /* DoorItem.hpp */, 84E023022F2A0255003C8FFE /* DyeColor.cpp */, 84E023032F2A0255003C8FFE /* DyeColor.hpp */, + 848AA3142F34E897007E9A3E /* DyePowderItem.cpp */, + 848AA3132F34E897007E9A3E /* DyePowderItem.hpp */, + 848CCB492F3A974000031D1F /* FoodItem.cpp */, + 848CCB482F3A974000031D1F /* FoodItem.hpp */, + 84B9D8992F3BE0A900FD67C4 /* HoeItem.cpp */, + 84B9D8982F3BE0A900FD67C4 /* HoeItem.hpp */, 840DD6742AC810620006A435 /* Inventory.cpp */, 840DD6752AC810620006A435 /* Inventory.hpp */, 840DD6762AC810620006A435 /* Item.cpp */, @@ -3883,14 +3887,19 @@ 84E7BF352F286A6A002D3936 /* ItemStack.hpp */, 84E78C812B58B5FB00D515EF /* RocketItem.cpp */, 84E78C822B58B5FB00D515EF /* RocketItem.hpp */, + 84B9D89B2F3BE0A900FD67C4 /* SeedItem.cpp */, + 84B9D89A2F3BE0A900FD67C4 /* SeedItem.hpp */, 84E1C9E32E7FDC72007D2F5D /* SlabItem.cpp */, 84E1C9E42E7FDC72007D2F5D /* SlabItem.hpp */, 840DD67A2AC810620006A435 /* TileItem.cpp */, 840DD67B2AC810620006A435 /* TileItem.hpp */, 840DD67C2AC810620006A435 /* TilePlanterItem.cpp */, 840DD67D2AC810620006A435 /* TilePlanterItem.hpp */, + 840823D92F4FF4B80097F6A5 /* Tool.hpp */, 845BBCB42F2EA81700C7232C /* ToolItem.cpp */, 845BBCB32F2EA81700C7232C /* ToolItem.hpp */, + 84C614272F323602008AC5BE /* WeaponItem.cpp */, + 84C614262F323602008AC5BE /* WeaponItem.hpp */, ); path = item; sourceTree = ""; @@ -5961,6 +5970,7 @@ 84BF63C92AF186C9008A9995 /* SandTile.hpp in Headers */, 84E1C9D82E7FDC26007D2F5D /* PumpkinTile.hpp in Headers */, 84BF63CA2AF186C9008A9995 /* Sapling.hpp in Headers */, + 840823DC2F4FF4B80097F6A5 /* Tool.hpp in Headers */, 84CCBC942E61880600E251AF /* EntityFactory.hpp in Headers */, 84BF63CB2AF186C9008A9995 /* SpongeTile.hpp in Headers */, 84BF63CC2AF186C9008A9995 /* StairTile.hpp in Headers */, @@ -5968,6 +5978,7 @@ 84BF63CD2AF186C9008A9995 /* StoneSlabTile.hpp in Headers */, 84BF63CE2AF186C9008A9995 /* StoneTile.hpp in Headers */, 84E7BF1D2F286A08002D3936 /* ContainerMenu.hpp in Headers */, + 840823DB2F4FF4B80097F6A5 /* CoalItem.hpp in Headers */, 848AA3162F34E897007E9A3E /* DyePowderItem.hpp in Headers */, 84BF63CF2AF186C9008A9995 /* Tile.hpp in Headers */, 84BF63D02AF186C9008A9995 /* TntTile.hpp in Headers */, @@ -7132,6 +7143,7 @@ 84AA8B7C2B32F3B5003F5B82 /* Cow.cpp in Sources */, 84AA8B7E2B32F3B5003F5B82 /* Creeper.cpp in Sources */, 84AA8B8A2B32F3B5003F5B82 /* Monster.cpp in Sources */, + 840823DA2F4FF4B80097F6A5 /* CoalItem.cpp in Sources */, 84E7BF242F286A08002D3936 /* ResultSlot.cpp in Sources */, 84E7BF202F286A08002D3936 /* InventoryMenu.cpp in Sources */, 84AA8B8C2B32F3B5003F5B82 /* PathfinderMob.cpp in Sources */, diff --git a/platforms/windows/projects/World/World.vcxproj b/platforms/windows/projects/World/World.vcxproj index e9672e3d1..550971417 100644 --- a/platforms/windows/projects/World/World.vcxproj +++ b/platforms/windows/projects/World/World.vcxproj @@ -229,6 +229,7 @@ + @@ -398,6 +399,7 @@ + @@ -408,4 +410,4 @@ - \ No newline at end of file + diff --git a/platforms/windows/projects/World/World.vcxproj.filters b/platforms/windows/projects/World/World.vcxproj.filters index 10267a3b4..f923baca5 100644 --- a/platforms/windows/projects/World/World.vcxproj.filters +++ b/platforms/windows/projects/World/World.vcxproj.filters @@ -662,6 +662,9 @@ Source Files\Item + + Source Files\Item + @@ -1174,5 +1177,8 @@ Header Files\Item + + Header Files\Item + - \ No newline at end of file + diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 53d431409..db5dd25f5 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -380,6 +380,7 @@ add_library(reminecraftpe-core STATIC world/item/ArmorItem.cpp world/item/HoeItem.cpp world/item/DyePowderItem.cpp + world/item/CoalItem.cpp world/item/ToolItem.cpp world/item/WeaponItem.cpp world/item/BowItem.cpp diff --git a/source/client/renderer/entity/EntityRenderer.cpp b/source/client/renderer/entity/EntityRenderer.cpp index a9975b56d..e9e614a17 100644 --- a/source/client/renderer/entity/EntityRenderer.cpp +++ b/source/client/renderer/entity/EntityRenderer.cpp @@ -195,6 +195,7 @@ void EntityRenderer::renderFlat(const AABB& aabb) void EntityRenderer::postRender(const Entity& entity, const Vec3& pos, float rot, float a) { + // Java had a rendering bug in the original, caused by the heightOffset being applied to the y position if (m_pDispatcher->m_pOptions && m_pDispatcher->m_pOptions->m_fancyGraphics.get() && areShadowsAvailable() && m_shadowRadius > 0.0f) { float dist = m_pDispatcher->distanceToSqr(entity.m_pos); diff --git a/source/client/renderer/entity/HumanoidMobRenderer.cpp b/source/client/renderer/entity/HumanoidMobRenderer.cpp index c448e50c7..31f1d6c26 100644 --- a/source/client/renderer/entity/HumanoidMobRenderer.cpp +++ b/source/client/renderer/entity/HumanoidMobRenderer.cpp @@ -203,3 +203,9 @@ void HumanoidMobRenderer::renderHand(const Entity& entity, float a) } #endif } + +void HumanoidMobRenderer::scale(const Mob &mob, Matrix &matrix, float a) +{ + // players are actually 15/16ths the size than any other bipedal mob + matrix.scale((mob.isPlayer()) ? (15.0f / 16.0f) : 1.0f); +} diff --git a/source/client/renderer/entity/HumanoidMobRenderer.hpp b/source/client/renderer/entity/HumanoidMobRenderer.hpp index bcb072c89..62b900098 100644 --- a/source/client/renderer/entity/HumanoidMobRenderer.hpp +++ b/source/client/renderer/entity/HumanoidMobRenderer.hpp @@ -21,6 +21,7 @@ class HumanoidMobRenderer : public MobRenderer virtual void onGraphicsReset() override; void renderHand(const Entity& entity, float a); + void scale(const Mob& mob, Matrix& matrix, float a); public: HumanoidModel* m_pHumanoidModel; diff --git a/source/common/Util.cpp b/source/common/Util.cpp index 0a76c31b6..8d20d3c24 100644 --- a/source/common/Util.cpp +++ b/source/common/Util.cpp @@ -7,6 +7,7 @@ ********************************************************************/ #include +#include #include "Util.hpp" const std::string Util::EMPTY_STRING = ""; diff --git a/source/common/threading/AsyncTask.hpp b/source/common/threading/AsyncTask.hpp index 268474022..63f5e7de9 100644 --- a/source/common/threading/AsyncTask.hpp +++ b/source/common/threading/AsyncTask.hpp @@ -2,6 +2,7 @@ #include #include +#include #include "CThread.hpp" #include "compat/LegacyCPP.hpp" diff --git a/source/world/item/CoalItem.cpp b/source/world/item/CoalItem.cpp new file mode 100644 index 000000000..126ec4442 --- /dev/null +++ b/source/world/item/CoalItem.cpp @@ -0,0 +1,12 @@ +#include "CoalItem.hpp" + +CoalItem::CoalItem(int id) : Item(id) +{ + m_maxDamage = 0; + m_bStackedByData = true; +} + +std::string CoalItem::getDescriptionId(ItemStack* inst) const +{ + return (inst->getAuxValue() == 1) ? "item.charcoal" : "item.coal"; +} diff --git a/source/world/item/CoalItem.hpp b/source/world/item/CoalItem.hpp new file mode 100644 index 000000000..d27c54a99 --- /dev/null +++ b/source/world/item/CoalItem.hpp @@ -0,0 +1,12 @@ +#pragma once + +#include "Item.hpp" + +class CoalItem : public Item +{ +public: + CoalItem(int id); + + std::string getDescriptionId(ItemStack* inst) const override; + +}; diff --git a/source/world/item/Item.cpp b/source/world/item/Item.cpp index 1e4c353fb..94b017a79 100644 --- a/source/world/item/Item.cpp +++ b/source/world/item/Item.cpp @@ -11,19 +11,20 @@ #include "common/Logger.hpp" #include "common/Util.hpp" +#include "ArmorItem.hpp" +#include "BowItem.hpp" #include "CameraItem.hpp" +#include "CoalItem.hpp" #include "DoorItem.hpp" -#include "TileItem.hpp" -#include "TilePlanterItem.hpp" -#include "RocketItem.hpp" -#include "ToolItem.hpp" -#include "BowItem.hpp" #include "DyePowderItem.hpp" -#include "WeaponItem.hpp" #include "FoodItem.hpp" -#include "ArmorItem.hpp" #include "HoeItem.hpp" +#include "RocketItem.hpp" #include "SeedItem.hpp" +#include "TileItem.hpp" +#include "ToolItem.hpp" +#include "TilePlanterItem.hpp" +#include "WeaponItem.hpp" #define ITEM(x) ((x) - 256) @@ -339,7 +340,7 @@ void Item::initItems() ->setIcon(5, 2) ->setDescriptionId("arrow"); - Item::coal = NEW_ITEM(ITEM_COAL) + Item::coal = NEW_X_ITEMN(CoalItem, ITEM_COAL) ->setIcon(7, 0) ->setDescriptionId("coal");