Skip to content

Commit a2f19b7

Browse files
authored
Player rendering parity & Coal Item (#521)
1 parent c03e464 commit a2f19b7

12 files changed

Lines changed: 79 additions & 23 deletions

File tree

platforms/macos/projects/Minecraft/Minecraft.xcodeproj/project.pbxproj

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@
173173
8406FDD32AF182E700B09C1D /* WindowsIncludes.h in Headers */ = {isa = PBXBuildFile; fileRef = 840DD8432AC810630006A435 /* WindowsIncludes.h */; };
174174
8406FDD42AF182E700B09C1D /* WSAStartupSingleton.h in Headers */ = {isa = PBXBuildFile; fileRef = 840DD8452AC810630006A435 /* WSAStartupSingleton.h */; };
175175
8406FDD52AF182E700B09C1D /* XBox360Includes.h in Headers */ = {isa = PBXBuildFile; fileRef = 840DD8462AC810630006A435 /* XBox360Includes.h */; };
176+
840823DA2F4FF4B80097F6A5 /* CoalItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 840823D72F4FF4B80097F6A5 /* CoalItem.cpp */; };
177+
840823DB2F4FF4B80097F6A5 /* CoalItem.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 840823D82F4FF4B80097F6A5 /* CoalItem.hpp */; };
178+
840823DC2F4FF4B80097F6A5 /* Tool.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 840823D92F4FF4B80097F6A5 /* Tool.hpp */; };
176179
84171E812B1A6227008B82E6 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84C4D86E2A872C0100323E33 /* OpenAL.framework */; };
177180
841DD8772AF8AA7A00AA3B66 /* AppPlatform_sdl2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 841DD8722AF8AA7A00AA3B66 /* AppPlatform_sdl2.cpp */; };
178181
841DD8782AF8AA7A00AA3B66 /* AppPlatform_sdl2_desktop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 841DD8752AF8AA7A00AA3B66 /* AppPlatform_sdl2_desktop.cpp */; };
@@ -1605,6 +1608,9 @@
16051608
/* Begin PBXFileReference section */
16061609
8400360F2E89DADB00C14213 /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamecontroller.h; sourceTree = "<group>"; };
16071610
8406FD292AF1814500B09C1D /* libRenderer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRenderer.a; sourceTree = BUILT_PRODUCTS_DIR; };
1611+
840823D72F4FF4B80097F6A5 /* CoalItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CoalItem.cpp; sourceTree = "<group>"; };
1612+
840823D82F4FF4B80097F6A5 /* CoalItem.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CoalItem.hpp; sourceTree = "<group>"; };
1613+
840823D92F4FF4B80097F6A5 /* Tool.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Tool.hpp; sourceTree = "<group>"; };
16081614
840DD5792AC810620006A435 /* KeyCodes.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = KeyCodes.hpp; sourceTree = "<group>"; };
16091615
840DD57A2AC810620006A435 /* SDLKeyCodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLKeyCodes.h; sourceTree = "<group>"; };
16101616
840DD57E2AC810620006A435 /* App.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = App.cpp; sourceTree = "<group>"; };
@@ -3850,31 +3856,29 @@
38503856
840DD66F2AC810620006A435 /* item */ = {
38513857
isa = PBXGroup;
38523858
children = (
3853-
84B9D8962F3BE0A900FD67C4 /* ArmorItem.hpp */,
38543859
84B9D8972F3BE0A900FD67C4 /* ArmorItem.cpp */,
3855-
84B9D8982F3BE0A900FD67C4 /* HoeItem.hpp */,
3856-
84B9D8992F3BE0A900FD67C4 /* HoeItem.cpp */,
3857-
84B9D89A2F3BE0A900FD67C4 /* SeedItem.hpp */,
3858-
84B9D89B2F3BE0A900FD67C4 /* SeedItem.cpp */,
3859-
848CCB482F3A974000031D1F /* FoodItem.hpp */,
3860-
848CCB492F3A974000031D1F /* FoodItem.cpp */,
3861-
848AA3132F34E897007E9A3E /* DyePowderItem.hpp */,
3862-
848AA3142F34E897007E9A3E /* DyePowderItem.cpp */,
3863-
84C614242F323602008AC5BE /* BowItem.hpp */,
3864-
84C614252F323602008AC5BE /* BowItem.cpp */,
3865-
84C614262F323602008AC5BE /* WeaponItem.hpp */,
3866-
84C614272F323602008AC5BE /* WeaponItem.cpp */,
3860+
84B9D8962F3BE0A900FD67C4 /* ArmorItem.hpp */,
38673861
84E1C9DF2E7FDC72007D2F5D /* AuxTileItem.cpp */,
38683862
84E1C9E02E7FDC72007D2F5D /* AuxTileItem.hpp */,
3863+
84C614252F323602008AC5BE /* BowItem.cpp */,
3864+
84C614242F323602008AC5BE /* BowItem.hpp */,
38693865
840DD6702AC810620006A435 /* CameraItem.cpp */,
38703866
840DD6712AC810620006A435 /* CameraItem.hpp */,
38713867
84E1C9E12E7FDC72007D2F5D /* ClothItem.cpp */,
38723868
84E1C9E22E7FDC72007D2F5D /* ClothItem.hpp */,
3869+
840823D72F4FF4B80097F6A5 /* CoalItem.cpp */,
3870+
840823D82F4FF4B80097F6A5 /* CoalItem.hpp */,
38733871
84DED19E2F309611004001C5 /* crafting */,
38743872
840DD6722AC810620006A435 /* DoorItem.cpp */,
38753873
840DD6732AC810620006A435 /* DoorItem.hpp */,
38763874
84E023022F2A0255003C8FFE /* DyeColor.cpp */,
38773875
84E023032F2A0255003C8FFE /* DyeColor.hpp */,
3876+
848AA3142F34E897007E9A3E /* DyePowderItem.cpp */,
3877+
848AA3132F34E897007E9A3E /* DyePowderItem.hpp */,
3878+
848CCB492F3A974000031D1F /* FoodItem.cpp */,
3879+
848CCB482F3A974000031D1F /* FoodItem.hpp */,
3880+
84B9D8992F3BE0A900FD67C4 /* HoeItem.cpp */,
3881+
84B9D8982F3BE0A900FD67C4 /* HoeItem.hpp */,
38783882
840DD6742AC810620006A435 /* Inventory.cpp */,
38793883
840DD6752AC810620006A435 /* Inventory.hpp */,
38803884
840DD6762AC810620006A435 /* Item.cpp */,
@@ -3883,14 +3887,19 @@
38833887
84E7BF352F286A6A002D3936 /* ItemStack.hpp */,
38843888
84E78C812B58B5FB00D515EF /* RocketItem.cpp */,
38853889
84E78C822B58B5FB00D515EF /* RocketItem.hpp */,
3890+
84B9D89B2F3BE0A900FD67C4 /* SeedItem.cpp */,
3891+
84B9D89A2F3BE0A900FD67C4 /* SeedItem.hpp */,
38863892
84E1C9E32E7FDC72007D2F5D /* SlabItem.cpp */,
38873893
84E1C9E42E7FDC72007D2F5D /* SlabItem.hpp */,
38883894
840DD67A2AC810620006A435 /* TileItem.cpp */,
38893895
840DD67B2AC810620006A435 /* TileItem.hpp */,
38903896
840DD67C2AC810620006A435 /* TilePlanterItem.cpp */,
38913897
840DD67D2AC810620006A435 /* TilePlanterItem.hpp */,
3898+
840823D92F4FF4B80097F6A5 /* Tool.hpp */,
38923899
845BBCB42F2EA81700C7232C /* ToolItem.cpp */,
38933900
845BBCB32F2EA81700C7232C /* ToolItem.hpp */,
3901+
84C614272F323602008AC5BE /* WeaponItem.cpp */,
3902+
84C614262F323602008AC5BE /* WeaponItem.hpp */,
38943903
);
38953904
path = item;
38963905
sourceTree = "<group>";
@@ -5961,13 +5970,15 @@
59615970
84BF63C92AF186C9008A9995 /* SandTile.hpp in Headers */,
59625971
84E1C9D82E7FDC26007D2F5D /* PumpkinTile.hpp in Headers */,
59635972
84BF63CA2AF186C9008A9995 /* Sapling.hpp in Headers */,
5973+
840823DC2F4FF4B80097F6A5 /* Tool.hpp in Headers */,
59645974
84CCBC942E61880600E251AF /* EntityFactory.hpp in Headers */,
59655975
84BF63CB2AF186C9008A9995 /* SpongeTile.hpp in Headers */,
59665976
84BF63CC2AF186C9008A9995 /* StairTile.hpp in Headers */,
59675977
84E1C9D22E7FDC26007D2F5D /* DeadBush.hpp in Headers */,
59685978
84BF63CD2AF186C9008A9995 /* StoneSlabTile.hpp in Headers */,
59695979
84BF63CE2AF186C9008A9995 /* StoneTile.hpp in Headers */,
59705980
84E7BF1D2F286A08002D3936 /* ContainerMenu.hpp in Headers */,
5981+
840823DB2F4FF4B80097F6A5 /* CoalItem.hpp in Headers */,
59715982
848AA3162F34E897007E9A3E /* DyePowderItem.hpp in Headers */,
59725983
84BF63CF2AF186C9008A9995 /* Tile.hpp in Headers */,
59735984
84BF63D02AF186C9008A9995 /* TntTile.hpp in Headers */,
@@ -7132,6 +7143,7 @@
71327143
84AA8B7C2B32F3B5003F5B82 /* Cow.cpp in Sources */,
71337144
84AA8B7E2B32F3B5003F5B82 /* Creeper.cpp in Sources */,
71347145
84AA8B8A2B32F3B5003F5B82 /* Monster.cpp in Sources */,
7146+
840823DA2F4FF4B80097F6A5 /* CoalItem.cpp in Sources */,
71357147
84E7BF242F286A08002D3936 /* ResultSlot.cpp in Sources */,
71367148
84E7BF202F286A08002D3936 /* InventoryMenu.cpp in Sources */,
71377149
84AA8B8C2B32F3B5003F5B82 /* PathfinderMob.cpp in Sources */,

platforms/windows/projects/World/World.vcxproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@
229229
<ClCompile Include="$(MC_ROOT)\source\world\item\BowItem.cpp" />
230230
<ClCompile Include="$(MC_ROOT)\source\world\item\WeaponItem.cpp" />
231231
<ClCompile Include="$(MC_ROOT)\source\world\item\DyePowderItem.cpp" />
232+
<ClCompile Include="$(MC_ROOT)\source\world\item\CoalItem.cpp" />
232233
</ItemGroup>
233234
<ItemGroup>
234235
<ClInclude Include="$(MC_ROOT)\source\world\entity\Entity.hpp" />
@@ -398,6 +399,7 @@
398399
<ClInclude Include="$(MC_ROOT)\source\world\item\BowItem.hpp" />
399400
<ClInclude Include="$(MC_ROOT)\source\world\item\WeaponItem.hpp" />
400401
<ClInclude Include="$(MC_ROOT)\source\world\item\DyePowderItem.hpp" />
402+
<ClInclude Include="$(MC_ROOT)\source\world\item\CoalItem.hpp" />
401403
</ItemGroup>
402404
<ItemGroup>
403405
<ProjectReference Include="..\NBT\NBT.vcxproj">
@@ -408,4 +410,4 @@
408410
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
409411
<ImportGroup Label="ExtensionTargets">
410412
</ImportGroup>
411-
</Project>
413+
</Project>

platforms/windows/projects/World/World.vcxproj.filters

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,9 @@
662662
<ClCompile Include="$(MC_ROOT)\source\world\item\DyePowderItem.cpp">
663663
<Filter>Source Files\Item</Filter>
664664
</ClCompile>
665+
<ClCompile Include="$(MC_ROOT)\source\world\item\CoalItem.cpp">
666+
<Filter>Source Files\Item</Filter>
667+
</ClCompile>
665668
</ItemGroup>
666669
<ItemGroup>
667670
<ClInclude Include="$(MC_ROOT)\source\world\entity\Entity.hpp">
@@ -1174,5 +1177,8 @@
11741177
<ClInclude Include="$(MC_ROOT)\source\world\item\DyePowderItem.hpp">
11751178
<Filter>Header Files\Item</Filter>
11761179
</ClInclude>
1180+
<ClInclude Include="$(MC_ROOT)\source\world\item\CoalItem.hpp">
1181+
<Filter>Header Files\Item</Filter>
1182+
</ClInclude>
11771183
</ItemGroup>
1178-
</Project>
1184+
</Project>

source/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ add_library(reminecraftpe-core STATIC
380380
world/item/ArmorItem.cpp
381381
world/item/HoeItem.cpp
382382
world/item/DyePowderItem.cpp
383+
world/item/CoalItem.cpp
383384
world/item/ToolItem.cpp
384385
world/item/WeaponItem.cpp
385386
world/item/BowItem.cpp

source/client/renderer/entity/EntityRenderer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ void EntityRenderer::renderFlat(const AABB& aabb)
195195

196196
void EntityRenderer::postRender(const Entity& entity, const Vec3& pos, float rot, float a)
197197
{
198+
// Java had a rendering bug in the original, caused by the heightOffset being applied to the y position
198199
if (m_pDispatcher->m_pOptions && m_pDispatcher->m_pOptions->m_fancyGraphics.get() && areShadowsAvailable() && m_shadowRadius > 0.0f)
199200
{
200201
float dist = m_pDispatcher->distanceToSqr(entity.m_pos);

source/client/renderer/entity/HumanoidMobRenderer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,9 @@ void HumanoidMobRenderer::renderHand(const Entity& entity, float a)
203203
}
204204
#endif
205205
}
206+
207+
void HumanoidMobRenderer::scale(const Mob &mob, Matrix &matrix, float a)
208+
{
209+
// players are actually 15/16ths the size than any other bipedal mob
210+
matrix.scale((mob.isPlayer()) ? (15.0f / 16.0f) : 1.0f);
211+
}

source/client/renderer/entity/HumanoidMobRenderer.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class HumanoidMobRenderer : public MobRenderer
2121
virtual void onGraphicsReset() override;
2222

2323
void renderHand(const Entity& entity, float a);
24+
void scale(const Mob& mob, Matrix& matrix, float a);
2425

2526
public:
2627
HumanoidModel* m_pHumanoidModel;

source/common/Util.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
********************************************************************/
88

99
#include <stdio.h>
10+
#include <cstdlib>
1011
#include "Util.hpp"
1112

1213
const std::string Util::EMPTY_STRING = "";

source/common/threading/AsyncTask.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <exception>
44
#include <algorithm>
5+
#include <stdlib.h>
56

67
#include "CThread.hpp"
78
#include "compat/LegacyCPP.hpp"

source/world/item/CoalItem.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include "CoalItem.hpp"
2+
3+
CoalItem::CoalItem(int id) : Item(id)
4+
{
5+
m_maxDamage = 0;
6+
m_bStackedByData = true;
7+
}
8+
9+
std::string CoalItem::getDescriptionId(ItemStack* inst) const
10+
{
11+
return (inst->getAuxValue() == 1) ? "item.charcoal" : "item.coal";
12+
}

0 commit comments

Comments
 (0)