mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
TU19: merge Minecraft.World/Player
This commit is contained in:
parent
fdf5b8f8b9
commit
19026c057b
|
|
@ -51,8 +51,8 @@ void Abilities::loadSaveData(CompoundTag* parentTag) {
|
||||||
|
|
||||||
float Abilities::getFlyingSpeed() { return flyingSpeed; }
|
float Abilities::getFlyingSpeed() { return flyingSpeed; }
|
||||||
|
|
||||||
void Abilities::setFlyingSpeed(float value) { this->flyingSpeed = value; }
|
void Abilities::setFlyingSpeed(float value) { flyingSpeed = value; }
|
||||||
|
|
||||||
float Abilities::getWalkingSpeed() { return walkingSpeed; }
|
float Abilities::getWalkingSpeed() { return walkingSpeed; }
|
||||||
|
|
||||||
void Abilities::setWalkingSpeed(float value) { this->walkingSpeed = value; }
|
void Abilities::setWalkingSpeed(float value) { walkingSpeed = value; }
|
||||||
|
|
@ -12,9 +12,9 @@ FoodData::FoodData() {
|
||||||
exhaustionLevel = 0;
|
exhaustionLevel = 0;
|
||||||
tickTimer = 0;
|
tickTimer = 0;
|
||||||
|
|
||||||
this->foodLevel = FoodConstants::MAX_FOOD;
|
foodLevel = FoodConstants::MAX_FOOD;
|
||||||
this->lastFoodLevel = FoodConstants::MAX_FOOD;
|
lastFoodLevel = FoodConstants::MAX_FOOD;
|
||||||
this->saturationLevel = FoodConstants::START_SATURATION;
|
saturationLevel = FoodConstants::START_SATURATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FoodData::eat(int food, float saturationModifier) {
|
void FoodData::eat(int food, float saturationModifier) {
|
||||||
|
|
@ -43,9 +43,12 @@ void FoodData::tick(std::shared_ptr<Player> player) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J Added - Allow host to disable using hunger. We don't deplete the
|
// 4J: Added - Allow host to disable using hunger. We don't deplete the
|
||||||
// hunger bar due to exhaustion but I think we should deplete it to heal
|
// hunger bar due to exhaustion but I think we should deplete it to heal.
|
||||||
if (player->isAllowedToIgnoreExhaustion()) {
|
// Don't heal if natural regen is disabled
|
||||||
|
if (player->isAllowedToIgnoreExhaustion() &&
|
||||||
|
player->level->getGameRules()->getBoolean(
|
||||||
|
GameRules::RULE_NATURAL_REGENERATION)) {
|
||||||
if (foodLevel > 0 && player->isHurt()) {
|
if (foodLevel > 0 && player->isHurt()) {
|
||||||
tickTimer++;
|
tickTimer++;
|
||||||
if (tickTimer >= FoodConstants::HEALTH_TICK_COUNT) {
|
if (tickTimer >= FoodConstants::HEALTH_TICK_COUNT) {
|
||||||
|
|
@ -54,10 +57,13 @@ void FoodData::tick(std::shared_ptr<Player> player) {
|
||||||
tickTimer = 0;
|
tickTimer = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (foodLevel >= FoodConstants::HEAL_LEVEL && player->isHurt()) {
|
} else if (player->level->getGameRules()->getBoolean(
|
||||||
|
GameRules::RULE_NATURAL_REGENERATION) &&
|
||||||
|
foodLevel >= FoodConstants::HEAL_LEVEL && player->isHurt()) {
|
||||||
tickTimer++;
|
tickTimer++;
|
||||||
if (tickTimer >= FoodConstants::HEALTH_TICK_COUNT) {
|
if (tickTimer >= FoodConstants::HEALTH_TICK_COUNT) {
|
||||||
player->heal(1);
|
player->heal(1);
|
||||||
|
addExhaustion(FoodConstants::EXHAUSTION_HEAL);
|
||||||
tickTimer = 0;
|
tickTimer = 0;
|
||||||
}
|
}
|
||||||
} else if (foodLevel <= FoodConstants::STARVE_LEVEL) {
|
} else if (foodLevel <= FoodConstants::STARVE_LEVEL) {
|
||||||
|
|
@ -105,12 +111,8 @@ float FoodData::getExhaustionLevel() { return exhaustionLevel; }
|
||||||
|
|
||||||
float FoodData::getSaturationLevel() { return saturationLevel; }
|
float FoodData::getSaturationLevel() { return saturationLevel; }
|
||||||
|
|
||||||
void FoodData::setFoodLevel(int food) { this->foodLevel = food; }
|
void FoodData::setFoodLevel(int food) { foodLevel = food; }
|
||||||
|
|
||||||
void FoodData::setSaturation(float saturation) {
|
void FoodData::setSaturation(float saturation) { saturationLevel = saturation; }
|
||||||
this->saturationLevel = saturation;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FoodData::setExhaustion(float exhaustion) {
|
void FoodData::setExhaustion(float exhaustion) { exhaustionLevel = exhaustion; }
|
||||||
this->exhaustionLevel = exhaustion;
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -2,25 +2,29 @@
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include "../Entities/Mob.h"
|
#include "../Entities/LivingEntity.h"
|
||||||
#include "../Util/Definitions.h"
|
#include "../Util/Definitions.h"
|
||||||
#include "Abilities.h"
|
#include "Abilities.h"
|
||||||
#include "FoodData.h"
|
#include "FoodData.h"
|
||||||
#include "PlayerEnderChestContainer.h"
|
#include "PlayerEnderChestContainer.h"
|
||||||
#include "../Commands/CommandSender.h"
|
#include "../Commands/CommandSender.h"
|
||||||
|
#include "../Scores/ScoreHolder.h"
|
||||||
|
|
||||||
class AbstractContainerMenu;
|
class AbstractContainerMenu;
|
||||||
class Stats;
|
class Stats;
|
||||||
class FishingHook;
|
class FishingHook;
|
||||||
|
class EntityHorse;
|
||||||
class ItemEntity;
|
class ItemEntity;
|
||||||
class Slot;
|
class Slot;
|
||||||
class Pos;
|
class Pos;
|
||||||
|
class TileEntity;
|
||||||
|
class BeaconTileEntity;
|
||||||
class FurnaceTileEntity;
|
class FurnaceTileEntity;
|
||||||
class DispenserTileEntity;
|
class DispenserTileEntity;
|
||||||
class SignTileEntity;
|
class SignTileEntity;
|
||||||
class BrewingStandTileEntity;
|
class BrewingStandTileEntity;
|
||||||
|
class HopperTileEntity;
|
||||||
|
class MinecartHopper;
|
||||||
class Inventory;
|
class Inventory;
|
||||||
class Container;
|
class Container;
|
||||||
class FoodData;
|
class FoodData;
|
||||||
|
|
@ -28,12 +32,12 @@ class DamageSource;
|
||||||
class Merchant;
|
class Merchant;
|
||||||
class PlayerEnderChestContainer;
|
class PlayerEnderChestContainer;
|
||||||
class GameType;
|
class GameType;
|
||||||
|
class Scoreboard;
|
||||||
|
|
||||||
class Player : public Mob, public CommandSender {
|
class Player : public LivingEntity, public CommandSender, public ScoreHolder {
|
||||||
public:
|
public:
|
||||||
static const int MAX_NAME_LENGTH = 16 + 4;
|
static const int MAX_NAME_LENGTH = 16 + 4;
|
||||||
static const int MAX_HEALTH = 20;
|
static const int MAX_HEALTH = 20;
|
||||||
static const int SWING_DURATION = 6;
|
|
||||||
static const int SLEEP_DURATION = 100;
|
static const int SLEEP_DURATION = 100;
|
||||||
static const int WAKE_UP_DURATION = 10;
|
static const int WAKE_UP_DURATION = 10;
|
||||||
|
|
||||||
|
|
@ -48,7 +52,11 @@ private:
|
||||||
static const int FLY_ACHIEVEMENT_SPEED = 25;
|
static const int FLY_ACHIEVEMENT_SPEED = 25;
|
||||||
|
|
||||||
static const int DATA_PLAYER_FLAGS_ID = 16;
|
static const int DATA_PLAYER_FLAGS_ID = 16;
|
||||||
static const int DATA_PLAYER_RUNNING_ID = 17;
|
static const int DATA_PLAYER_ABSORPTION_ID = 17;
|
||||||
|
static const int DATA_SCORE_ID = 18;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static const int FLAG_HIDE_CAPE = 1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Inventory> inventory;
|
std::shared_ptr<Inventory> inventory;
|
||||||
|
|
@ -66,27 +74,25 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::uint8_t userType;
|
std::uint8_t userType;
|
||||||
int score;
|
|
||||||
float oBob, bob;
|
float oBob, bob;
|
||||||
bool swinging;
|
|
||||||
int swingTime;
|
|
||||||
|
|
||||||
std::wstring name;
|
std::wstring name;
|
||||||
int dimension;
|
|
||||||
int takeXpDelay;
|
int takeXpDelay;
|
||||||
|
|
||||||
// 4J-PB - track custom skin
|
// 4J-PB - track custom skin
|
||||||
|
std::wstring customTextureUrl;
|
||||||
|
std::wstring customTextureUrl2;
|
||||||
unsigned int m_uiPlayerCurrentSkin;
|
unsigned int m_uiPlayerCurrentSkin;
|
||||||
void ChangePlayerSkin();
|
void ChangePlayerSkin();
|
||||||
|
|
||||||
// 4J-PB - not needed, since cutomtextureurl2 is the same thing std::wstring
|
// 4J-PB - not needed, since cutomtextureurl2 is the same thing wstring
|
||||||
// cloakTexture;
|
// cloakTexture;
|
||||||
|
|
||||||
double xCloakO, yCloakO, zCloakO;
|
double xCloakO, yCloakO, zCloakO;
|
||||||
double xCloak, yCloak, zCloak;
|
double xCloak, yCloak, zCloak;
|
||||||
|
|
||||||
// 4J-HEG - store display name, added for Xbox One
|
// 4J-HG: store display name, added for Xbox One "game display name"
|
||||||
std::wstring displayName;
|
std::wstring m_displayName;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// player sleeping in bed?
|
// player sleeping in bed?
|
||||||
|
|
@ -105,6 +111,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Pos* respawnPosition;
|
Pos* respawnPosition;
|
||||||
|
bool respawnForced;
|
||||||
Pos* minecartAchievementPos;
|
Pos* minecartAchievementPos;
|
||||||
|
|
||||||
// 4J Gordon: These are in cms, every time they go > 1m they are entered
|
// 4J Gordon: These are in cms, every time they go > 1m they are entered
|
||||||
|
|
@ -113,14 +120,6 @@ private:
|
||||||
distanceMinecart, distanceBoat, distancePig;
|
distanceMinecart, distanceBoat, distancePig;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int changingDimensionDelay;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool isInsidePortal;
|
|
||||||
|
|
||||||
public:
|
|
||||||
float portalTime, oPortalTime;
|
|
||||||
|
|
||||||
Abilities abilities;
|
Abilities abilities;
|
||||||
|
|
||||||
int experienceLevel, totalExperience;
|
int experienceLevel, totalExperience;
|
||||||
|
|
@ -136,18 +135,20 @@ protected:
|
||||||
float defaultWalkSpeed;
|
float defaultWalkSpeed;
|
||||||
float defaultFlySpeed;
|
float defaultFlySpeed;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int lastLevelUpTime;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
eINSTANCEOF GetType() { return eTYPE_PLAYER; }
|
eINSTANCEOF GetType() { return eTYPE_PLAYER; }
|
||||||
|
|
||||||
// 4J Added to default init
|
// 4J Added to default init
|
||||||
void _init();
|
void _init();
|
||||||
|
|
||||||
Player(Level* level);
|
Player(Level* level, const std::wstring& name);
|
||||||
virtual ~Player();
|
virtual ~Player();
|
||||||
|
|
||||||
virtual int getMaxHealth();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void registerAttributes();
|
||||||
virtual void defineSynchedData();
|
virtual void defineSynchedData();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -159,7 +160,14 @@ public:
|
||||||
void stopUsingItem();
|
void stopUsingItem();
|
||||||
virtual bool isBlocking();
|
virtual bool isBlocking();
|
||||||
|
|
||||||
|
// 4J Stu - Added for things that should only be ticked once per simulation
|
||||||
|
// frame
|
||||||
|
virtual void updateFrameTick();
|
||||||
|
|
||||||
virtual void tick();
|
virtual void tick();
|
||||||
|
virtual int getPortalWaitTime();
|
||||||
|
virtual int getDimensionChangingDelay();
|
||||||
|
virtual void playSound(int iSound, float volume, float pitch);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void spawnEatParticles(std::shared_ptr<ItemInstance> useItem, int count);
|
void spawnEatParticles(std::shared_ptr<ItemInstance> useItem, int count);
|
||||||
|
|
@ -178,9 +186,6 @@ public:
|
||||||
virtual void rideTick();
|
virtual void rideTick();
|
||||||
virtual void resetPos();
|
virtual void resetPos();
|
||||||
|
|
||||||
private:
|
|
||||||
int getCurrentSwingDuration();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void serverAiStep();
|
virtual void serverAiStep();
|
||||||
|
|
||||||
|
|
@ -191,18 +196,15 @@ private:
|
||||||
virtual void touch(std::shared_ptr<Entity> entity);
|
virtual void touch(std::shared_ptr<Entity> entity);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// bool addResource(int resource); // 4J - Removed 1.0.1
|
virtual int getScore();
|
||||||
int getScore();
|
virtual void setScore(int value);
|
||||||
|
virtual void increaseScore(int amount);
|
||||||
virtual void die(DamageSource* source);
|
virtual void die(DamageSource* source);
|
||||||
void awardKillScore(std::shared_ptr<Entity> victim, int score);
|
virtual void awardKillScore(std::shared_ptr<Entity> victim,
|
||||||
|
int awardPoints);
|
||||||
protected:
|
|
||||||
virtual int decreaseAirSupply(int currentSupply);
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual bool isShootable();
|
virtual bool isShootable();
|
||||||
bool isCreativeModeAllowed();
|
bool isCreativeModeAllowed();
|
||||||
virtual std::shared_ptr<ItemEntity> drop();
|
virtual std::shared_ptr<ItemEntity> drop(bool all);
|
||||||
std::shared_ptr<ItemEntity> drop(std::shared_ptr<ItemInstance> item);
|
std::shared_ptr<ItemEntity> drop(std::shared_ptr<ItemInstance> item);
|
||||||
std::shared_ptr<ItemEntity> drop(std::shared_ptr<ItemInstance> item,
|
std::shared_ptr<ItemEntity> drop(std::shared_ptr<ItemInstance> item,
|
||||||
bool randomly);
|
bool randomly);
|
||||||
|
|
@ -211,18 +213,22 @@ protected:
|
||||||
virtual void reallyDrop(std::shared_ptr<ItemEntity> thrownItem);
|
virtual void reallyDrop(std::shared_ptr<ItemEntity> thrownItem);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
float getDestroySpeed(Tile* tile);
|
float getDestroySpeed(Tile* tile, bool hasProperTool);
|
||||||
bool canDestroy(Tile* tile);
|
bool canDestroy(Tile* tile);
|
||||||
virtual void readAdditionalSaveData(CompoundTag* entityTag);
|
virtual void readAdditionalSaveData(CompoundTag* entityTag);
|
||||||
virtual void addAdditonalSaveData(CompoundTag* entityTag);
|
virtual void addAdditonalSaveData(CompoundTag* entityTag);
|
||||||
static Pos* getRespawnPosition(Level* level, CompoundTag* entityTag);
|
|
||||||
virtual bool openContainer(
|
virtual bool openContainer(
|
||||||
std::shared_ptr<Container> container); // 4J - added bool return
|
std::shared_ptr<Container> container); // 4J - added bool return
|
||||||
virtual bool startEnchanting(int x, int y,
|
virtual bool openHopper(std::shared_ptr<HopperTileEntity> container);
|
||||||
int z); // 4J - added bool return
|
virtual bool openHopper(std::shared_ptr<MinecartHopper> container);
|
||||||
|
virtual bool openHorseInventory(std::shared_ptr<EntityHorse> horse,
|
||||||
|
std::shared_ptr<Container> container);
|
||||||
|
virtual bool startEnchanting(
|
||||||
|
int x, int y, int z,
|
||||||
|
const std::wstring& name); // 4J - added bool return
|
||||||
virtual bool startRepairing(int x, int y, int z); // 4J - added bool return
|
virtual bool startRepairing(int x, int y, int z); // 4J - added bool return
|
||||||
virtual bool startCrafting(int x, int y, int z); // 4J - added boo return
|
virtual bool startCrafting(int x, int y, int z); // 4J - added bool return
|
||||||
virtual void take(std::shared_ptr<Entity> e, int orgCount);
|
virtual bool openFireworks(int x, int y, int z); // 4J - added
|
||||||
virtual float getHeadHeight();
|
virtual float getHeadHeight();
|
||||||
|
|
||||||
// 4J-PB - added to keep the code happy with the change to make the third
|
// 4J-PB - added to keep the code happy with the change to make the third
|
||||||
|
|
@ -236,22 +242,21 @@ protected:
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<FishingHook> fishing;
|
std::shared_ptr<FishingHook> fishing;
|
||||||
|
|
||||||
virtual bool hurt(DamageSource* source, int dmg);
|
virtual bool hurt(DamageSource* source, float dmg);
|
||||||
|
virtual bool canHarmPlayer(std::shared_ptr<Player> target);
|
||||||
|
virtual bool canHarmPlayer(
|
||||||
|
std::wstring targetName); // 4J: Added for ServerPlayer when only
|
||||||
|
// player name is provided
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int getDamageAfterMagicAbsorb(DamageSource* damageSource,
|
virtual void hurtArmor(float damage);
|
||||||
int damage);
|
|
||||||
virtual bool isPlayerVersusPlayer();
|
|
||||||
void directAllTameWolvesOnTarget(std::shared_ptr<Mob> target,
|
|
||||||
bool skipSitting);
|
|
||||||
virtual void hurtArmor(int damage);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual int getArmorValue();
|
virtual int getArmorValue();
|
||||||
float getArmorCoverPercentage();
|
virtual float getArmorCoverPercentage();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void actuallyHurt(DamageSource* source, int dmg);
|
virtual void actuallyHurt(DamageSource* source, float dmg);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Entity::interact;
|
using Entity::interact;
|
||||||
|
|
@ -260,18 +265,19 @@ public:
|
||||||
container); // 4J - added bool return
|
container); // 4J - added bool return
|
||||||
virtual bool openTrap(std::shared_ptr<DispenserTileEntity>
|
virtual bool openTrap(std::shared_ptr<DispenserTileEntity>
|
||||||
container); // 4J - added bool return
|
container); // 4J - added bool return
|
||||||
virtual void openTextEdit(std::shared_ptr<SignTileEntity> sign);
|
virtual void openTextEdit(std::shared_ptr<TileEntity> sign);
|
||||||
virtual bool openBrewingStand(std::shared_ptr<BrewingStandTileEntity>
|
virtual bool openBrewingStand(std::shared_ptr<BrewingStandTileEntity>
|
||||||
brewingStand); // 4J - added bool return
|
brewingStand); // 4J - added bool return
|
||||||
|
virtual bool openBeacon(std::shared_ptr<BeaconTileEntity> beacon);
|
||||||
virtual bool openTrading(
|
virtual bool openTrading(
|
||||||
std::shared_ptr<Merchant> traderTarget); // 4J - added bool return
|
std::shared_ptr<Merchant> traderTarget,
|
||||||
|
const std::wstring& name); // 4J - added bool return
|
||||||
virtual void openItemInstanceGui(
|
virtual void openItemInstanceGui(
|
||||||
std::shared_ptr<ItemInstance> itemInstance);
|
std::shared_ptr<ItemInstance> itemInstance);
|
||||||
virtual bool interact(std::shared_ptr<Entity> entity);
|
virtual bool interact(std::shared_ptr<Entity> entity);
|
||||||
virtual std::shared_ptr<ItemInstance> getSelectedItem();
|
virtual std::shared_ptr<ItemInstance> getSelectedItem();
|
||||||
void removeSelectedItem();
|
void removeSelectedItem();
|
||||||
virtual double getRidingHeight();
|
virtual double getRidingHeight();
|
||||||
virtual void swing();
|
|
||||||
virtual void attack(std::shared_ptr<Entity> entity);
|
virtual void attack(std::shared_ptr<Entity> entity);
|
||||||
virtual void crit(std::shared_ptr<Entity> entity);
|
virtual void crit(std::shared_ptr<Entity> entity);
|
||||||
virtual void magicCrit(std::shared_ptr<Entity> entity);
|
virtual void magicCrit(std::shared_ptr<Entity> entity);
|
||||||
|
|
@ -321,7 +327,8 @@ private:
|
||||||
bool checkBed();
|
bool checkBed();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Pos* checkBedValidRespawnPosition(Level* level, Pos* pos);
|
static Pos* checkBedValidRespawnPosition(Level* level, Pos* pos,
|
||||||
|
bool forced);
|
||||||
float getSleepRotation();
|
float getSleepRotation();
|
||||||
bool isSleeping();
|
bool isSleeping();
|
||||||
bool isSleepingLongEnough();
|
bool isSleepingLongEnough();
|
||||||
|
|
@ -339,16 +346,18 @@ public:
|
||||||
* client.
|
* client.
|
||||||
*/
|
*/
|
||||||
virtual void displayClientMessage(int messageId);
|
virtual void displayClientMessage(int messageId);
|
||||||
Pos* getRespawnPosition();
|
virtual Pos* getRespawnPosition();
|
||||||
void setRespawnPosition(Pos* respawnPosition);
|
virtual bool isRespawnForced();
|
||||||
|
virtual void setRespawnPosition(Pos* respawnPosition, bool forced);
|
||||||
virtual void awardStat(Stat* stat, byteArray param);
|
virtual void awardStat(Stat* stat, byteArray param);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void jumpFromGround();
|
void jumpFromGround();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void travel(float xa, float ya);
|
virtual void travel(float xa, float ya);
|
||||||
void checkMovementStatistiscs(double dx, double dy, double dz);
|
virtual float getSpeed();
|
||||||
|
virtual void checkMovementStatistiscs(double dx, double dy, double dz);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void checkRidingStatistiscs(double dx, double dy, double dz);
|
void checkRidingStatistiscs(double dx, double dy, double dz);
|
||||||
|
|
@ -359,27 +368,23 @@ protected:
|
||||||
virtual void causeFallDamage(float distance);
|
virtual void causeFallDamage(float distance);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void killed(std::shared_ptr<Mob> mob);
|
virtual void killed(std::shared_ptr<LivingEntity> mob);
|
||||||
|
virtual void makeStuckInWeb();
|
||||||
virtual Icon* getItemInHandIcon(std::shared_ptr<ItemInstance> item,
|
virtual Icon* getItemInHandIcon(std::shared_ptr<ItemInstance> item,
|
||||||
int layer);
|
int layer);
|
||||||
virtual std::shared_ptr<ItemInstance> getArmor(int pos);
|
virtual std::shared_ptr<ItemInstance> getArmor(int pos);
|
||||||
virtual void handleInsidePortal();
|
virtual void increaseXp(int i);
|
||||||
|
virtual void giveExperienceLevels(int amount);
|
||||||
void increaseXp(int i);
|
|
||||||
virtual void withdrawExperienceLevels(int amount);
|
|
||||||
int getXpNeededForNextLevel();
|
int getXpNeededForNextLevel();
|
||||||
|
|
||||||
private:
|
|
||||||
void levelUp();
|
|
||||||
|
|
||||||
public:
|
|
||||||
void causeFoodExhaustion(float amount);
|
void causeFoodExhaustion(float amount);
|
||||||
FoodData* getFoodData();
|
FoodData* getFoodData();
|
||||||
bool canEat(bool magicalItem);
|
bool canEat(bool magicalItem);
|
||||||
bool isHurt();
|
bool isHurt();
|
||||||
virtual void startUsingItem(std::shared_ptr<ItemInstance> instance,
|
virtual void startUsingItem(std::shared_ptr<ItemInstance> instance,
|
||||||
int duration);
|
int duration);
|
||||||
bool mayBuild(int x, int y, int z);
|
virtual bool mayDestroyBlockAt(int x, int y, int z);
|
||||||
|
virtual bool mayUseItemAt(int x, int y, int z, int face,
|
||||||
|
std::shared_ptr<ItemInstance> item);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int getExperienceReward(std::shared_ptr<Player> killedBy);
|
virtual int getExperienceReward(std::shared_ptr<Player> killedBy);
|
||||||
|
|
@ -387,8 +392,7 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual std::wstring getAName();
|
virtual std::wstring getAName();
|
||||||
|
virtual bool shouldShowName();
|
||||||
virtual void changeDimension(int i);
|
|
||||||
virtual void restoreFrom(std::shared_ptr<Player> oldPlayer,
|
virtual void restoreFrom(std::shared_ptr<Player> oldPlayer,
|
||||||
bool restoreAll);
|
bool restoreAll);
|
||||||
|
|
||||||
|
|
@ -399,18 +403,26 @@ public:
|
||||||
void onUpdateAbilities();
|
void onUpdateAbilities();
|
||||||
void setGameMode(GameType* mode);
|
void setGameMode(GameType* mode);
|
||||||
std::wstring getName();
|
std::wstring getName();
|
||||||
std::wstring getDisplayName(); // 4J added
|
virtual std::wstring getDisplayName();
|
||||||
|
virtual std::wstring getNetworkName(); // 4J: Added
|
||||||
|
|
||||||
// Language getLanguage() { return Language.getInstance(); }
|
virtual Level* getCommandSenderWorld();
|
||||||
// String localize(String key, Object... args) { return
|
|
||||||
// getLanguage().getElement(key, args); }
|
|
||||||
|
|
||||||
std::shared_ptr<PlayerEnderChestContainer> getEnderChestInventory();
|
std::shared_ptr<PlayerEnderChestContainer> getEnderChestInventory();
|
||||||
|
|
||||||
public:
|
virtual std::shared_ptr<ItemInstance> getCarried(int slot);
|
||||||
virtual std::shared_ptr<ItemInstance> getCarriedItem();
|
virtual std::shared_ptr<ItemInstance> getCarriedItem();
|
||||||
|
virtual void setEquippedSlot(int slot, std::shared_ptr<ItemInstance> item);
|
||||||
virtual bool isInvisibleTo(std::shared_ptr<Player> player);
|
virtual bool isInvisibleTo(std::shared_ptr<Player> player);
|
||||||
|
virtual ItemInstanceArray getEquipmentSlots();
|
||||||
|
virtual bool isCapeHidden();
|
||||||
|
virtual bool isPushedByWater();
|
||||||
|
virtual Scoreboard* getScoreboard();
|
||||||
|
virtual Team* getTeam();
|
||||||
|
virtual void setAbsorptionAmount(float absorptionAmount);
|
||||||
|
virtual float getAbsorptionAmount();
|
||||||
|
|
||||||
|
//////// 4J /////////////////
|
||||||
|
|
||||||
static int hash_fnct(const std::shared_ptr<Player> k);
|
static int hash_fnct(const std::shared_ptr<Player> k);
|
||||||
static bool eq_test(const std::shared_ptr<Player> x,
|
static bool eq_test(const std::shared_ptr<Player> x,
|
||||||
|
|
@ -438,8 +450,6 @@ public:
|
||||||
PlayerUID getXuid() { return m_xuid; }
|
PlayerUID getXuid() { return m_xuid; }
|
||||||
void setOnlineXuid(PlayerUID xuid) { m_OnlineXuid = xuid; }
|
void setOnlineXuid(PlayerUID xuid) { m_OnlineXuid = xuid; }
|
||||||
PlayerUID getOnlineXuid() { return m_OnlineXuid; }
|
PlayerUID getOnlineXuid() { return m_OnlineXuid; }
|
||||||
void setUUID(const std::wstring& UUID) { m_UUID = UUID; }
|
|
||||||
std::wstring getUUID() { return m_UUID; }
|
|
||||||
|
|
||||||
void setPlayerIndex(std::uint8_t index) { m_playerIndex = index; }
|
void setPlayerIndex(std::uint8_t index) { m_playerIndex = index; }
|
||||||
std::uint8_t getPlayerIndex() { return m_playerIndex; }
|
std::uint8_t getPlayerIndex() { return m_playerIndex; }
|
||||||
|
|
@ -463,8 +473,6 @@ private:
|
||||||
PlayerUID m_OnlineXuid;
|
PlayerUID m_OnlineXuid;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::wstring m_UUID; // 4J Added
|
|
||||||
|
|
||||||
bool m_bShownOnMaps;
|
bool m_bShownOnMaps;
|
||||||
|
|
||||||
bool m_bIsGuest;
|
bool m_bIsGuest;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,17 @@
|
||||||
#include "../Platform/stdafx.h"
|
#include "../Platform/stdafx.h"
|
||||||
#include "../Headers/net.minecraft.world.level.tile.entity.h"
|
#include "../Headers/net.minecraft.world.level.tile.entity.h"
|
||||||
|
#include "../Network/Packets/ContainerOpenPacket.h"
|
||||||
#include "PlayerEnderChestContainer.h"
|
#include "PlayerEnderChestContainer.h"
|
||||||
|
|
||||||
PlayerEnderChestContainer::PlayerEnderChestContainer()
|
PlayerEnderChestContainer::PlayerEnderChestContainer()
|
||||||
: SimpleContainer(IDS_TILE_ENDERCHEST, 9 * 3) {
|
: SimpleContainer(IDS_TILE_ENDERCHEST, L"", false, 9 * 3) {
|
||||||
activeChest = nullptr;
|
activeChest = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int PlayerEnderChestContainer::getContainerType() {
|
||||||
|
return ContainerOpenPacket::ENDER_CHEST;
|
||||||
|
}
|
||||||
|
|
||||||
void PlayerEnderChestContainer::setActiveChest(
|
void PlayerEnderChestContainer::setActiveChest(
|
||||||
std::shared_ptr<EnderChestTileEntity> activeChest) {
|
std::shared_ptr<EnderChestTileEntity> activeChest) {
|
||||||
this->activeChest = activeChest;
|
this->activeChest = activeChest;
|
||||||
|
|
@ -60,3 +65,8 @@ void PlayerEnderChestContainer::stopOpen() {
|
||||||
SimpleContainer::stopOpen();
|
SimpleContainer::stopOpen();
|
||||||
activeChest = nullptr;
|
activeChest = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PlayerEnderChestContainer::canPlaceItem(
|
||||||
|
int slot, std::shared_ptr<ItemInstance> item) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
@ -11,10 +11,13 @@ private:
|
||||||
public:
|
public:
|
||||||
PlayerEnderChestContainer();
|
PlayerEnderChestContainer();
|
||||||
|
|
||||||
|
virtual int getContainerType();
|
||||||
|
|
||||||
void setActiveChest(std::shared_ptr<EnderChestTileEntity> activeChest);
|
void setActiveChest(std::shared_ptr<EnderChestTileEntity> activeChest);
|
||||||
void setItemsByTag(ListTag<CompoundTag>* enderItemsList);
|
void setItemsByTag(ListTag<CompoundTag>* enderItemsList);
|
||||||
ListTag<CompoundTag>* createTag();
|
ListTag<CompoundTag>* createTag();
|
||||||
bool stillValid(std::shared_ptr<Player> player);
|
bool stillValid(std::shared_ptr<Player> player);
|
||||||
void startOpen();
|
void startOpen();
|
||||||
void stopOpen();
|
void stopOpen();
|
||||||
|
bool canPlaceItem(int slot, std::shared_ptr<ItemInstance> item);
|
||||||
};
|
};
|
||||||
Loading…
Reference in a new issue