Skip to content

Commit 96c7fdb

Browse files
authored
Implement all Block virtuals & numerous symbols (#51)
* Implement all `Block` virtuals & numerous symbols * linter * clang-format * same change 😄 * clean * Update ServerPlayer.h * Update BaseEntityBlock.h * Update FireworksRocketEntity.h * Update ExperienceOrb.h
1 parent d01fef8 commit 96c7fdb

54 files changed

Lines changed: 1464 additions & 392 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

data/mcswitch_functions.csv

Lines changed: 222 additions & 223 deletions
Large diffs are not rendered by default.

src/Minecraft.Client/net/minecraft/client/Minecraft.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class Minecraft {
113113
void* qword_40;
114114
Level* mLevel;
115115
LevelRenderer* mLevelRenderer;
116-
std::shared_ptr<LocalPlayer> mLocalPlayer;
116+
std::shared_ptr<MultiplayerLocalPlayer> mLocalPlayer;
117117
arrayWithLength<void*> array_68; // unknown array type
118118
std::shared_ptr<MultiplayerLocalPlayer> mLocalPlayers[4];
119119
MultiPlayerGameMode* mGameModes[4];

src/Minecraft.World/net/minecraft/util/Mth.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ class Mth {
3434
static float nextFloat(Random* random, float i, float j);
3535
static double nextDouble(Random* random, double i, double j);
3636
static std::wstring createInsecureUUID(Random* random);
37+
static int64_t getSeed(int, int, int);
3738
};

src/Minecraft.World/net/minecraft/util/ThreadStorage.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,19 @@ public:
9393
if (storage != sDefaultThreadStorage) \
9494
delete storage; \
9595
}
96+
97+
#define START_DECLARE_THREAD_STORAGE() \
98+
public: \
99+
class ThreadStorage { \
100+
public: \
101+
ThreadStorage(); \
102+
~ThreadStorage();
103+
104+
#define END_DECLARE_THREAD_STORAGE() \
105+
} \
106+
; \
107+
static ThreadStorage* sDefaultThreadStorage; \
108+
static int sThreadStorageIndex; \
109+
static void CreateNewThreadStorage(); \
110+
static void UseDefaultThreadStorage(); \
111+
static void ReleaseThreadStorage();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#pragma once
2+
3+
namespace net_minecraft_world {
4+
class ContainerListener {
5+
ContainerListener();
6+
};
7+
}; // namespace net_minecraft_world
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#pragma once
2+
3+
#include <memory>
4+
5+
class Entity;
6+
7+
class Explosion {
8+
public:
9+
std::shared_ptr<Entity> getDirectSource();
10+
};

src/Minecraft.World/net/minecraft/world/command/Command.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
#include "net/minecraft/world/ArrayWithLength.h"
44
#include "net/minecraft/world/PlayerUID.h"
55
#include "net/minecraft/world/entity/CommandSender.h"
6-
#include "net/minecraft/world/entity/player/Player.h"
76
#include "types.h"
87
#include <memory>
98

109
class CommandSender;
10+
class ServerPlayer;
1111

1212
class Command {
1313
public:
@@ -16,7 +16,7 @@ class Command {
1616
static void logAdminAction(std::shared_ptr<CommandSender>, ClientboundChatPacket::EChatPacketMessage,
1717
int*, unsigned int, std::wstring*, unsigned int);
1818

19-
std::shared_ptr<Player> getPlayer(PlayerUID);
19+
std::shared_ptr<ServerPlayer> getPlayer(PlayerUID);
2020

2121
virtual ~Command();
2222
virtual EGameCommand getId() = 0;

src/Minecraft.World/net/minecraft/world/command/impl/GiveItemCommand.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
#include "net/minecraft/world/command/Command.h"
99
#include "net/minecraft/world/command/EGameCommand.h"
1010
#include "net/minecraft/world/entity/CommandSender.h"
11+
#include "net/minecraft/world/entity/Entity.h"
1112
#include "net/minecraft/world/entity/item/ItemEntity.h"
12-
#include "net/minecraft/world/entity/player/Player.h"
13+
#include "net/minecraft/world/entity/player/ServerPlayer.h"
1314
#include "net/minecraft/world/inventory/Inventory.h"
1415
#include "net/minecraft/world/inventory/InventoryMenu.h"
1516
#include "net/minecraft/world/item/Item.h"
@@ -40,7 +41,7 @@ void GiveItemCommand::execute(std::shared_ptr<CommandSender> sender, arrayWithLe
4041
/*byteInputStream
4142
= ByteArrayInputStream(); */ // this doesn't exist on WiiU, i'm just guessing it does this... why? idk
4243

43-
std::shared_ptr<Player> player = this->getPlayer(playerUID);
44+
std::shared_ptr<ServerPlayer> player = this->getPlayer(playerUID);
4445
if (id < 1 || !player || !Item::byId(id))
4546
return;
4647

src/Minecraft.World/net/minecraft/world/entity/LivingEntity.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,14 @@ float LivingEntity::getAbsorptionAmount() {
263263
return this->mAbsorptionAmount;
264264
}
265265

266-
// NON_MATCHING | Score: 805 (lower is better)
267-
// ???
268-
// some weird fmaxf issue
269266
void LivingEntity::setAbsorptionAmount(float amount) {
270-
this->mAbsorptionAmount = fmaxf(amount, 0.0);
267+
if (amount < 0.0F) {
268+
amount = 0.0F;
269+
}
270+
271+
this->mAbsorptionAmount = amount;
271272
}
273+
272274
void LivingEntity::onEnterCombat() {}
273275
void LivingEntity::onLeaveCombat() {}
274276
void LivingEntity::setRecordPlayingNearby(const BlockPos&, bool) {}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#pragma once
2+
3+
#include "net/minecraft/world/entity/Entity.h"
4+
#include <memory>
5+
6+
class ExperienceOrb : public Entity {
7+
public:
8+
ExperienceOrb(Level*, double, double, double, int);
9+
10+
~ExperienceOrb() override;
11+
eINSTANCEOF GetType() override;
12+
void defineSynchedData() override;
13+
void tick() override;
14+
bool makeStepSound() override;
15+
void burn(int) override;
16+
void updateInWaterState() override;
17+
void getLightColor() override;
18+
void playerTouch(std::shared_ptr<Player>) override;
19+
void hurt(DamageSource*, float) override;
20+
void shouldRender(double) override;
21+
void readAdditionalSaveData(CompoundTag*) override;
22+
void addAdditonalSaveData(CompoundTag*) override;
23+
bool isAttackable() override;
24+
25+
static int getExperienceValue(int);
26+
27+
int mTickCount;
28+
int mAge;
29+
int mThrowTime;
30+
int mValue;
31+
std::shared_ptr<Player> mFollowingPlayer;
32+
int mFollowingTime;
33+
};

0 commit comments

Comments
 (0)