Revert "shared_ptr -> std::shared_ptr"

This reverts commit 7074f35e4b.
This commit is contained in:
void_17
2026-03-02 17:37:16 +07:00
parent 8a2a62ea1d
commit 119bff3514
1373 changed files with 12049 additions and 12049 deletions

View File

@@ -8,7 +8,7 @@
// TODO Make sure all derived classes also call this
AbstractContainerMenu::AbstractContainerMenu()
{
lastSlots = new vector<std::shared_ptr<ItemInstance> >();
lastSlots = new vector<shared_ptr<ItemInstance> >();
slots = new vector<Slot *>();
containerId = 0;
@@ -49,15 +49,15 @@ void AbstractContainerMenu::addSlotListener(ContainerListener *listener)
containerListeners->push_back(listener);
vector<std::shared_ptr<ItemInstance> > *items = getItems();
vector<shared_ptr<ItemInstance> > *items = getItems();
listener->refreshContainer(this, items);
delete items;
broadcastChanges();
}
vector<std::shared_ptr<ItemInstance> > *AbstractContainerMenu::getItems()
vector<shared_ptr<ItemInstance> > *AbstractContainerMenu::getItems()
{
vector<std::shared_ptr<ItemInstance> > *items = new vector<std::shared_ptr<ItemInstance> >();
vector<shared_ptr<ItemInstance> > *items = new vector<shared_ptr<ItemInstance> >();
AUTO_VAR(itEnd, slots->end());
for (AUTO_VAR(it, slots->begin()); it != itEnd; it++)
{
@@ -79,8 +79,8 @@ void AbstractContainerMenu::broadcastChanges()
{
for (unsigned int i = 0; i < slots->size(); i++)
{
std::shared_ptr<ItemInstance> current = slots->at(i)->getItem();
std::shared_ptr<ItemInstance> expected = lastSlots->at(i);
shared_ptr<ItemInstance> current = slots->at(i)->getItem();
shared_ptr<ItemInstance> expected = lastSlots->at(i);
if (!ItemInstance::matches(expected, current))
{
expected = current == NULL ? nullptr : current->copy();
@@ -103,8 +103,8 @@ bool AbstractContainerMenu::needsRendered()
for (unsigned int i = 0; i < slots->size(); i++)
{
std::shared_ptr<ItemInstance> current = slots->at(i)->getItem();
std::shared_ptr<ItemInstance> expected = lastSlots->at(i);
shared_ptr<ItemInstance> current = slots->at(i)->getItem();
shared_ptr<ItemInstance> expected = lastSlots->at(i);
if (!ItemInstance::matches(expected, current))
{
expected = current == NULL ? nullptr : current->copy();
@@ -116,12 +116,12 @@ bool AbstractContainerMenu::needsRendered()
return needsRendered;
}
bool AbstractContainerMenu::clickMenuButton(std::shared_ptr<Player> player, int buttonId)
bool AbstractContainerMenu::clickMenuButton(shared_ptr<Player> player, int buttonId)
{
return false;
}
Slot *AbstractContainerMenu::getSlotFor(std::shared_ptr<Container> c, int index)
Slot *AbstractContainerMenu::getSlotFor(shared_ptr<Container> c, int index)
{
AUTO_VAR(itEnd, slots->end());
for (AUTO_VAR(it, slots->begin()); it != itEnd; it++)
@@ -140,7 +140,7 @@ Slot *AbstractContainerMenu::getSlot(int index)
return slots->at(index);
}
std::shared_ptr<ItemInstance> AbstractContainerMenu::quickMoveStack(std::shared_ptr<Player> player, int slotIndex)
shared_ptr<ItemInstance> AbstractContainerMenu::quickMoveStack(shared_ptr<Player> player, int slotIndex)
{
Slot *slot = slots->at(slotIndex);
if (slot != NULL)
@@ -150,10 +150,10 @@ std::shared_ptr<ItemInstance> AbstractContainerMenu::quickMoveStack(std::shared_
return nullptr;
}
std::shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int buttonNum, int clickType, std::shared_ptr<Player> player)
shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int buttonNum, int clickType, shared_ptr<Player> player)
{
std::shared_ptr<ItemInstance> clickedEntity = nullptr;
std::shared_ptr<Inventory> inventory = player->inventory;
shared_ptr<ItemInstance> clickedEntity = nullptr;
shared_ptr<Inventory> inventory = player->inventory;
if ((clickType == CLICK_PICKUP || clickType == CLICK_QUICK_MOVE) && (buttonNum == 0 || buttonNum == 1))
{
@@ -182,7 +182,7 @@ std::shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int
Slot *slot = slots->at(slotIndex);
if(slot != NULL && slot->mayPickup(player))
{
std::shared_ptr<ItemInstance> piiClicked = quickMoveStack(player, slotIndex);
shared_ptr<ItemInstance> piiClicked = quickMoveStack(player, slotIndex);
if (piiClicked != NULL)
{
//int oldSize = piiClicked->count; // 4J - Commented 1.8.2 and replaced with below
@@ -208,8 +208,8 @@ std::shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int
Slot *slot = slots->at(slotIndex);
if (slot != NULL)
{
std::shared_ptr<ItemInstance> clicked = slot->getItem();
std::shared_ptr<ItemInstance> carried = inventory->getCarried();
shared_ptr<ItemInstance> clicked = slot->getItem();
shared_ptr<ItemInstance> carried = inventory->getCarried();
if (clicked != NULL)
{
@@ -235,7 +235,7 @@ std::shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int
// 4J Added for dyable armour and combinining damaged items
else if (buttonNum == 1 && mayCombine(slot, carried))
{
std::shared_ptr<ItemInstance> combined = slot->combine(carried);
shared_ptr<ItemInstance> combined = slot->combine(carried);
if(combined != NULL)
{
slot->set(combined);
@@ -252,7 +252,7 @@ std::shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int
{
// pick up to empty hand
int c = buttonNum == 0 ? clicked->count : (clicked->count + 1) / 2;
std::shared_ptr<ItemInstance> removed = slot->remove(c);
shared_ptr<ItemInstance> removed = slot->remove(c);
inventory->setCarried(removed);
if (clicked->count == 0)
@@ -321,7 +321,7 @@ std::shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int
Slot *slot = slots->at(slotIndex);
if (slot->mayPickup(player))
{
std::shared_ptr<ItemInstance> current = inventory->getItem(buttonNum);
shared_ptr<ItemInstance> current = inventory->getItem(buttonNum);
bool canMove = current == NULL || (slot->container == inventory && slot->mayPlace(current));
int freeSlot = -1;
@@ -333,7 +333,7 @@ std::shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int
if (slot->hasItem() && canMove)
{
std::shared_ptr<ItemInstance> taking = slot->getItem();
shared_ptr<ItemInstance> taking = slot->getItem();
inventory->setItem(buttonNum, taking);
if ((slot->container == inventory && slot->mayPlace(current)) || current == NULL)
@@ -362,7 +362,7 @@ std::shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int
Slot *slot = slots->at(slotIndex);
if (slot != NULL && slot->hasItem())
{
std::shared_ptr<ItemInstance> copy = slot->getItem()->copy();
shared_ptr<ItemInstance> copy = slot->getItem()->copy();
copy->count = copy->getMaxStackSize();
inventory->setCarried(copy);
}
@@ -371,19 +371,19 @@ std::shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int
}
// 4J Stu - Brought forward from 1.2 to fix infinite recursion bug in creative
void AbstractContainerMenu::loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, std::shared_ptr<Player> player)
void AbstractContainerMenu::loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, shared_ptr<Player> player)
{
clicked(slotIndex, buttonNum, CLICK_QUICK_MOVE, player);
}
bool AbstractContainerMenu::mayCombine(Slot *slot, std::shared_ptr<ItemInstance> item)
bool AbstractContainerMenu::mayCombine(Slot *slot, shared_ptr<ItemInstance> item)
{
return false;
}
void AbstractContainerMenu::removed(std::shared_ptr<Player> player)
void AbstractContainerMenu::removed(shared_ptr<Player> player)
{
std::shared_ptr<Inventory> inventory = player->inventory;
shared_ptr<Inventory> inventory = player->inventory;
if (inventory->getCarried() != NULL)
{
player->drop(inventory->getCarried());
@@ -391,7 +391,7 @@ void AbstractContainerMenu::removed(std::shared_ptr<Player> player)
}
}
void AbstractContainerMenu::slotsChanged()// 4J used to take a std::shared_ptr<Container> but wasn't using it, so removed to simplify things
void AbstractContainerMenu::slotsChanged()// 4J used to take a shared_ptr<Container> but wasn't using it, so removed to simplify things
{
broadcastChanges();
}
@@ -401,14 +401,14 @@ bool AbstractContainerMenu::isPauseScreen()
return false;
}
void AbstractContainerMenu::setItem(unsigned int slot, std::shared_ptr<ItemInstance> item)
void AbstractContainerMenu::setItem(unsigned int slot, shared_ptr<ItemInstance> item)
{
getSlot(slot)->set(item);
}
void AbstractContainerMenu::setAll(ItemInstanceArray *items)
{
for (unsigned int i = 0; i < items->length; i++)
for (unsigned int i = 0; i < items->length; i++)
{
getSlot(i)->set( (*items)[i] );
}
@@ -418,18 +418,18 @@ void AbstractContainerMenu::setData(int id, int value)
{
}
short AbstractContainerMenu::backup(std::shared_ptr<Inventory> inventory)
short AbstractContainerMenu::backup(shared_ptr<Inventory> inventory)
{
changeUid++;
return changeUid;
}
bool AbstractContainerMenu::isSynched(std::shared_ptr<Player> player)
bool AbstractContainerMenu::isSynched(shared_ptr<Player> player)
{
return !(unSynchedPlayers.find(player) != unSynchedPlayers.end());
}
void AbstractContainerMenu::setSynched(std::shared_ptr<Player> player, bool synched)
void AbstractContainerMenu::setSynched(shared_ptr<Player> player, bool synched)
{
if (synched)
{
@@ -444,7 +444,7 @@ void AbstractContainerMenu::setSynched(std::shared_ptr<Player> player, bool sync
}
// 4J Stu - Brought a few changes in this function forward from 1.2 to make it return a bool
bool AbstractContainerMenu::moveItemStackTo(std::shared_ptr<ItemInstance> itemStack, int startSlot, int endSlot, bool backwards)
bool AbstractContainerMenu::moveItemStackTo(shared_ptr<ItemInstance> itemStack, int startSlot, int endSlot, bool backwards)
{
bool anythingChanged = false;
@@ -461,7 +461,7 @@ bool AbstractContainerMenu::moveItemStackTo(std::shared_ptr<ItemInstance> itemSt
{
Slot *slot = slots->at(destSlot);
std::shared_ptr<ItemInstance> target = slot->getItem();
shared_ptr<ItemInstance> target = slot->getItem();
if (target != NULL && target->id == itemStack->id && (!itemStack->isStackedByData() || itemStack->getAuxValue() == target->getAuxValue())
&& ItemInstance::tagMatches(itemStack, target) )
{
@@ -507,7 +507,7 @@ bool AbstractContainerMenu::moveItemStackTo(std::shared_ptr<ItemInstance> itemSt
while ((!backwards && destSlot < endSlot) || (backwards && destSlot >= startSlot))
{
Slot *slot = slots->at(destSlot);
std::shared_ptr<ItemInstance> target = slot->getItem();
shared_ptr<ItemInstance> target = slot->getItem();
if (target == NULL)
{

View File

@@ -26,7 +26,7 @@ public:
static const int CONTAINER_ID_INVENTORY = 0;
static const int CONTAINER_ID_CREATIVE = -2;
vector<std::shared_ptr<ItemInstance> > *lastSlots;
vector<shared_ptr<ItemInstance> > *lastSlots;
vector<Slot *> *slots;
int containerId;
@@ -46,34 +46,34 @@ protected:
public:
virtual ~AbstractContainerMenu();
virtual void addSlotListener(ContainerListener *listener);
vector<std::shared_ptr<ItemInstance> > *getItems();
vector<shared_ptr<ItemInstance> > *getItems();
void sendData(int id, int value);
virtual void broadcastChanges();
virtual bool needsRendered();
virtual bool clickMenuButton(std::shared_ptr<Player> player, int buttonId);
Slot *getSlotFor(std::shared_ptr<Container> c, int index);
virtual bool clickMenuButton(shared_ptr<Player> player, int buttonId);
Slot *getSlotFor(shared_ptr<Container> c, int index);
Slot *getSlot(int index);
virtual std::shared_ptr<ItemInstance> quickMoveStack(std::shared_ptr<Player> player, int slotIndex);
virtual std::shared_ptr<ItemInstance> clicked(int slotIndex, int buttonNum, int clickType, std::shared_ptr<Player> player);
virtual bool mayCombine(Slot *slot, std::shared_ptr<ItemInstance> item);
virtual shared_ptr<ItemInstance> quickMoveStack(shared_ptr<Player> player, int slotIndex);
virtual shared_ptr<ItemInstance> clicked(int slotIndex, int buttonNum, int clickType, shared_ptr<Player> player);
virtual bool mayCombine(Slot *slot, shared_ptr<ItemInstance> item);
protected:
virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, std::shared_ptr<Player> player);
virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, shared_ptr<Player> player);
public:
virtual void removed(std::shared_ptr<Player> player);
virtual void slotsChanged();// 4J used to take a std::shared_ptr<Container> container but wasn't using it, so removed to simplify things
virtual void removed(shared_ptr<Player> player);
virtual void slotsChanged();// 4J used to take a shared_ptr<Container> container but wasn't using it, so removed to simplify things
bool isPauseScreen();
void setItem(unsigned int slot, std::shared_ptr<ItemInstance> item);
void setItem(unsigned int slot, shared_ptr<ItemInstance> item);
void setAll(ItemInstanceArray *items);
virtual void setData(int id, int value);
short backup(std::shared_ptr<Inventory> inventory);
short backup(shared_ptr<Inventory> inventory);
private:
unordered_set<std::shared_ptr<Player> , PlayerKeyHash, PlayerKeyEq> unSynchedPlayers;
unordered_set<shared_ptr<Player> , PlayerKeyHash, PlayerKeyEq> unSynchedPlayers;
public:
bool isSynched(std::shared_ptr<Player> player);
void setSynched(std::shared_ptr<Player> player, bool synched);
virtual bool stillValid(std::shared_ptr<Player> player) = 0;
bool isSynched(shared_ptr<Player> player);
void setSynched(shared_ptr<Player> player, bool synched);
virtual bool stillValid(shared_ptr<Player> player) = 0;
// 4J Stu Added for UI
unsigned int getSize() { return (unsigned int)slots->size(); }
@@ -81,7 +81,7 @@ public:
protected:
// 4J Stu - Changes to return bool brought forward from 1.2
bool moveItemStackTo(std::shared_ptr<ItemInstance> itemStack, int startSlot, int endSlot, bool backwards);
bool moveItemStackTo(shared_ptr<ItemInstance> itemStack, int startSlot, int endSlot, bool backwards);
public:
virtual bool isOverrideResultClick(int slotNum, int buttonNum);

View File

@@ -25,7 +25,7 @@ Achievement::Achievement(int id, const wstring& name, int x, int y, Tile *icon,
{
}
Achievement::Achievement(int id, const wstring& name, int x, int y, std::shared_ptr<ItemInstance> icon, Achievement *requires)
Achievement::Achievement(int id, const wstring& name, int x, int y, shared_ptr<ItemInstance> icon, Achievement *requires)
: Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(wstring(L"achievement.").append(name)) ), desc( I18n::get(wstring(L"achievement.").append(name).append(L".desc"))), icon(icon), x(x), y(y), requires(requires)
{
}
@@ -36,7 +36,7 @@ Achievement *Achievement::setAwardLocallyOnly()
return this;
}
Achievement *Achievement::setGolden()
Achievement *Achievement::setGolden()
{
isGoldenVar = true;
return this;
@@ -51,14 +51,14 @@ Achievement *Achievement::postConstruct()
return this;
}
bool Achievement::isAchievement()
bool Achievement::isAchievement()
{
return true;
}
wstring Achievement::getDescription()
wstring Achievement::getDescription()
{
if (descFormatter != NULL)
if (descFormatter != NULL)
{
return descFormatter->format(desc);
}

View File

@@ -11,12 +11,12 @@ public:
const int x, y;
Achievement *requires;
private:
private:
const wstring desc;
DescFormatter *descFormatter;
public:
const std::shared_ptr<ItemInstance> icon;
const shared_ptr<ItemInstance> icon;
private:
bool isGoldenVar;
@@ -25,7 +25,7 @@ private:
public:
Achievement(int id, const wstring& name, int x, int y, Item *icon, Achievement *requires);
Achievement(int id, const wstring& name, int x, int y, Tile *icon, Achievement *requires);
Achievement(int id, const wstring& name, int x, int y, std::shared_ptr<ItemInstance> icon, Achievement *requires);
Achievement(int id, const wstring& name, int x, int y, shared_ptr<ItemInstance> icon, Achievement *requires);
Achievement *setAwardLocallyOnly();
Achievement *setGolden();

View File

@@ -8,7 +8,7 @@
void AddEntityPacket::_init(std::shared_ptr<Entity> e, int type, int data, int xp, int yp, int zp, int yRotp, int xRotp)
void AddEntityPacket::_init(shared_ptr<Entity> e, int type, int data, int xp, int yp, int zp, int yRotp, int xRotp)
{
id = e->entityId;
// 4J Stu - We should add entities at their "last sent" position so that the relative update packets
@@ -38,16 +38,16 @@ void AddEntityPacket::_init(std::shared_ptr<Entity> e, int type, int data, int x
}
}
AddEntityPacket::AddEntityPacket()
AddEntityPacket::AddEntityPacket()
{
}
AddEntityPacket::AddEntityPacket(std::shared_ptr<Entity> e, int type, int yRotp, int xRotp, int xp, int yp, int zp )
AddEntityPacket::AddEntityPacket(shared_ptr<Entity> e, int type, int yRotp, int xRotp, int xp, int yp, int zp )
{
_init(e, type, -1, xp, yp, zp, yRotp, xRotp); // 4J - changed "no data" value to be -1, we can have a valid entity id of 0
}
AddEntityPacket::AddEntityPacket(std::shared_ptr<Entity> e, int type, int data, int yRotp, int xRotp, int xp, int yp, int zp )
AddEntityPacket::AddEntityPacket(shared_ptr<Entity> e, int type, int data, int yRotp, int xRotp, int xp, int yp, int zp )
{
_init(e, type, data, xp, yp, zp, yRotp, xRotp);
}
@@ -100,12 +100,12 @@ void AddEntityPacket::write(DataOutputStream *dos) // throws IOException TODO 4J
}
}
void AddEntityPacket::handle(PacketListener *listener)
void AddEntityPacket::handle(PacketListener *listener)
{
listener->handleAddEntity(shared_from_this());
}
int AddEntityPacket::getEstimatedSize()
int AddEntityPacket::getEstimatedSize()
{
return 11 + data > -1 ? 6 : 0;
}

View File

@@ -40,12 +40,12 @@ public:
byte yRot,xRot; // 4J added
private:
void _init(std::shared_ptr<Entity> e, int type, int data, int xp, int yp, int zp, int yRotp, int xRotp );
void _init(shared_ptr<Entity> e, int type, int data, int xp, int yp, int zp, int yRotp, int xRotp );
public:
AddEntityPacket();
AddEntityPacket(std::shared_ptr<Entity> e, int type, int yRotp, int xRotp, int xp, int yp, int zp);
AddEntityPacket(std::shared_ptr<Entity> e, int type, int data, int yRotp, int xRotp, int xp, int yp, int zp );
AddEntityPacket(shared_ptr<Entity> e, int type, int yRotp, int xRotp, int xp, int yp, int zp);
AddEntityPacket(shared_ptr<Entity> e, int type, int data, int yRotp, int xRotp, int xp, int yp, int zp );
virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos);
@@ -53,6 +53,6 @@ public:
virtual int getEstimatedSize();
public:
static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new AddEntityPacket()); }
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddEntityPacket()); }
virtual int getId() { return 23; }
};

View File

@@ -13,7 +13,7 @@ AddExperienceOrbPacket::AddExperienceOrbPacket()
value = 0;
}
AddExperienceOrbPacket::AddExperienceOrbPacket(std::shared_ptr<ExperienceOrb> e)
AddExperienceOrbPacket::AddExperienceOrbPacket(shared_ptr<ExperienceOrb> e)
{
id = e->entityId;
x = Mth::floor(e->x * 32);

View File

@@ -12,13 +12,13 @@ public:
int value;
AddExperienceOrbPacket();
AddExperienceOrbPacket(std::shared_ptr<ExperienceOrb> e);
AddExperienceOrbPacket(shared_ptr<ExperienceOrb> e);
virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos);
virtual void handle(PacketListener *listener);
virtual int getEstimatedSize();
static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new AddExperienceOrbPacket()); }
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddExperienceOrbPacket()); }
virtual int getId() { return 26; }
};

View File

@@ -20,13 +20,13 @@ AddGlobalEntityPacket::AddGlobalEntityPacket()
type = 0;
}
AddGlobalEntityPacket::AddGlobalEntityPacket(std::shared_ptr<Entity> e)
AddGlobalEntityPacket::AddGlobalEntityPacket(shared_ptr<Entity> e)
{
id = e->entityId;
x = Mth::floor(e->x * 32);
y = Mth::floor(e->y * 32);
z = Mth::floor(e->z * 32);
if (dynamic_pointer_cast<LightningBolt>(e) != NULL)
if (dynamic_pointer_cast<LightningBolt>(e) != NULL)
{
this->type = LIGHTNING;
}
@@ -45,7 +45,7 @@ void AddGlobalEntityPacket::read(DataInputStream *dis) // throws IOException
z = dis->readInt();
}
void AddGlobalEntityPacket::write(DataOutputStream *dos) // throws IOException
void AddGlobalEntityPacket::write(DataOutputStream *dos) // throws IOException
{
dos->writeInt(id);
dos->writeByte(type);

View File

@@ -12,7 +12,7 @@ public:
int type;
AddGlobalEntityPacket();
AddGlobalEntityPacket(std::shared_ptr<Entity> e);
AddGlobalEntityPacket(shared_ptr<Entity> e);
virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos);
@@ -20,6 +20,6 @@ public:
virtual int getEstimatedSize();
public:
static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new AddGlobalEntityPacket()); }
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddGlobalEntityPacket()); }
virtual int getId() { return 71; }
};

View File

@@ -2,7 +2,7 @@
#include "net.minecraft.world.level.newbiome.layer.h"
#include "net.minecraft.world.level.biome.h"
AddIslandLayer::AddIslandLayer(int64_t seedMixup, std::shared_ptr<Layer>parent) : Layer(seedMixup)
AddIslandLayer::AddIslandLayer(int64_t seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup)
{
this->parent = parent;
}

View File

@@ -5,7 +5,7 @@
class AddIslandLayer : public Layer
{
public:
AddIslandLayer(int64_t seedMixup, std::shared_ptr<Layer>parent);
AddIslandLayer(int64_t seedMixup, shared_ptr<Layer>parent);
intArray getArea(int xo, int yo, int w, int h);
};

View File

@@ -25,7 +25,7 @@ AddMobPacket::~AddMobPacket()
delete unpack;
}
AddMobPacket::AddMobPacket(std::shared_ptr<Mob> mob, int yRotp, int xRotp, int xp, int yp, int zp, int yHeadRotp)
AddMobPacket::AddMobPacket(shared_ptr<Mob> mob, int yRotp, int xRotp, int xp, int yp, int zp, int yHeadRotp)
{
id = mob->entityId;
@@ -115,7 +115,7 @@ void AddMobPacket::handle(PacketListener *listener)
listener->handleAddMob(shared_from_this());
}
int AddMobPacket::getEstimatedSize()
int AddMobPacket::getEstimatedSize()
{
int size = 11;
if( entityData != NULL )
@@ -130,7 +130,7 @@ int AddMobPacket::getEstimatedSize()
return size;
}
vector<std::shared_ptr<SynchedEntityData::DataItem> > *AddMobPacket::getUnpackedData()
vector<shared_ptr<SynchedEntityData::DataItem> > *AddMobPacket::getUnpackedData()
{
if (unpack == NULL)
{

View File

@@ -16,22 +16,22 @@ public:
byte yRot, xRot, yHeadRot;
private:
std::shared_ptr<SynchedEntityData> entityData;
vector<std::shared_ptr<SynchedEntityData::DataItem> > *unpack;
shared_ptr<SynchedEntityData> entityData;
vector<shared_ptr<SynchedEntityData::DataItem> > *unpack;
public:
AddMobPacket();
~AddMobPacket();
AddMobPacket(std::shared_ptr<Mob> mob, int yRotp, int xRotp, int xp, int yp, int zp, int yHeadRotp);
AddMobPacket(shared_ptr<Mob> mob, int yRotp, int xRotp, int xp, int yp, int zp, int yHeadRotp);
virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos);
virtual void handle(PacketListener *listener);
virtual int getEstimatedSize();
vector<std::shared_ptr<SynchedEntityData::DataItem> > *getUnpackedData();
vector<shared_ptr<SynchedEntityData::DataItem> > *getUnpackedData();
public:
static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new AddMobPacket()); }
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddMobPacket()); }
virtual int getId() { return 24; }
};

View File

@@ -3,7 +3,7 @@
#include "net.minecraft.world.level.biome.h"
AddMushroomIslandLayer::AddMushroomIslandLayer(int64_t seedMixup, std::shared_ptr<Layer> parent) : Layer(seedMixup)
AddMushroomIslandLayer::AddMushroomIslandLayer(int64_t seedMixup, shared_ptr<Layer> parent) : Layer(seedMixup)
{
this->parent = parent;
}

View File

@@ -4,6 +4,6 @@
class AddMushroomIslandLayer : public Layer
{
public:
AddMushroomIslandLayer(int64_t seedMixup, std::shared_ptr<Layer> parent);
AddMushroomIslandLayer(int64_t seedMixup, shared_ptr<Layer> parent);
virtual intArray getArea(int xo, int yo, int w, int h);
};

View File

@@ -17,7 +17,7 @@ AddPaintingPacket::AddPaintingPacket()
motive = L"";
}
AddPaintingPacket::AddPaintingPacket(std::shared_ptr<Painting> e)
AddPaintingPacket::AddPaintingPacket(shared_ptr<Painting> e)
{
id = e->entityId;
x = e->xTile;

View File

@@ -15,13 +15,13 @@ public:
public:
AddPaintingPacket();
AddPaintingPacket(std::shared_ptr<Painting> e);
AddPaintingPacket(shared_ptr<Painting> e);
virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos);
virtual void handle(PacketListener *listener);
virtual int getEstimatedSize();
public:
static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new AddPaintingPacket()); }
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddPaintingPacket()); }
virtual int getId() { return 25; }
};

View File

@@ -32,7 +32,7 @@ AddPlayerPacket::~AddPlayerPacket()
if(unpack != NULL) delete unpack;
}
AddPlayerPacket::AddPlayerPacket(std::shared_ptr<Player> player, PlayerUID xuid, PlayerUID OnlineXuid,int xp, int yp, int zp, int yRotp, int xRotp, int yHeadRotp)
AddPlayerPacket::AddPlayerPacket(shared_ptr<Player> player, PlayerUID xuid, PlayerUID OnlineXuid,int xp, int yp, int zp, int yRotp, int xRotp, int yHeadRotp)
{
id = player->entityId;
name = player->name;
@@ -50,7 +50,7 @@ AddPlayerPacket::AddPlayerPacket(std::shared_ptr<Player> player, PlayerUID xuid,
//printf("%d: New add player (%f,%f,%f) : (%d,%d,%d) : xRot %d, yRot %d\n",id,player->x,player->y,player->z,x,y,z,xRot,yRot);
std::shared_ptr<ItemInstance> itemInstance = player->inventory->getSelected();
shared_ptr<ItemInstance> itemInstance = player->inventory->getSelected();
carriedItem = itemInstance == NULL ? 0 : itemInstance->id;
this->xuid = xuid;
@@ -72,14 +72,14 @@ void AddPlayerPacket::read(DataInputStream *dis) //throws IOException
y = dis->readInt();
z = dis->readInt();
yRot = dis->readByte();
xRot = dis->readByte();
xRot = dis->readByte();
yHeadRot = dis->readByte(); // 4J Added
carriedItem = dis->readShort();
xuid = dis->readPlayerUID();
OnlineXuid = dis->readPlayerUID();
m_playerIndex = dis->readByte();
INT skinId = dis->readInt();
m_skinId = *(DWORD *)&skinId;
m_skinId = *(DWORD *)&skinId;
INT capeId = dis->readInt();
m_capeId = *(DWORD *)&capeId;
INT privileges = dis->readInt();
@@ -132,7 +132,7 @@ int AddPlayerPacket::getEstimatedSize()
return iSize;
}
vector<std::shared_ptr<SynchedEntityData::DataItem> > *AddPlayerPacket::getUnpackedData()
vector<shared_ptr<SynchedEntityData::DataItem> > *AddPlayerPacket::getUnpackedData()
{
if (unpack == NULL)
{

View File

@@ -10,8 +10,8 @@ class AddPlayerPacket : public Packet, public enable_shared_from_this<AddPlayerP
{
private:
std::shared_ptr<SynchedEntityData> entityData;
vector<std::shared_ptr<SynchedEntityData::DataItem> > *unpack;
shared_ptr<SynchedEntityData> entityData;
vector<shared_ptr<SynchedEntityData::DataItem> > *unpack;
public:
int id;
@@ -29,15 +29,15 @@ public:
AddPlayerPacket();
~AddPlayerPacket();
AddPlayerPacket(std::shared_ptr<Player> player, PlayerUID xuid, PlayerUID OnlineXuid,int xp, int yp, int zp, int yRotp, int xRotp, int yHeadRotp);
AddPlayerPacket(shared_ptr<Player> player, PlayerUID xuid, PlayerUID OnlineXuid,int xp, int yp, int zp, int yRotp, int xRotp, int yHeadRotp);
virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos);
virtual void handle(PacketListener *listener);
virtual int getEstimatedSize();
vector<std::shared_ptr<SynchedEntityData::DataItem> > *getUnpackedData();
vector<shared_ptr<SynchedEntityData::DataItem> > *getUnpackedData();
public:
static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new AddPlayerPacket()); }
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddPlayerPacket()); }
virtual int getId() { return 20; }
};

View File

@@ -2,7 +2,7 @@
#include "net.minecraft.world.level.newbiome.layer.h"
#include "net.minecraft.world.level.biome.h"
AddSnowLayer::AddSnowLayer(int64_t seedMixup, std::shared_ptr<Layer> parent) : Layer(seedMixup)
AddSnowLayer::AddSnowLayer(int64_t seedMixup, shared_ptr<Layer> parent) : Layer(seedMixup)
{
this->parent = parent;
}

View File

@@ -4,6 +4,6 @@
class AddSnowLayer : public Layer
{
public:
AddSnowLayer(int64_t seedMixup, std::shared_ptr<Layer> parent);
AddSnowLayer(int64_t seedMixup, shared_ptr<Layer> parent);
virtual intArray getArea(int xo, int yo, int w, int h);
};

View File

@@ -9,5 +9,5 @@ class AdminLogCommand
public:
static const int LOGTYPE_DONT_SHOW_TO_SELF = 1;
virtual void logAdminCommand(std::shared_ptr<CommandSender> source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message = L"", int customData = -1, const wstring& additionalMessage = L"") = 0;
virtual void logAdminCommand(shared_ptr<CommandSender> source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message = L"", int customData = -1, const wstring& additionalMessage = L"") = 0;
};

View File

@@ -13,9 +13,9 @@ AgableMob::AgableMob(Level *level) : PathfinderMob(level)
registeredBBHeight = 0;
}
bool AgableMob::interact(std::shared_ptr<Player> player)
bool AgableMob::interact(shared_ptr<Player> player)
{
std::shared_ptr<ItemInstance> item = player->inventory->getSelected();
shared_ptr<ItemInstance> item = player->inventory->getSelected();
if (item != NULL && item->id == Item::monsterPlacer_Id)
{
@@ -24,7 +24,7 @@ bool AgableMob::interact(std::shared_ptr<Player> player)
eINSTANCEOF classToSpawn = EntityIO::getClass(item->getAuxValue());
if (classToSpawn != eTYPE_NOTSET && (classToSpawn & eTYPE_AGABLE_MOB) == eTYPE_AGABLE_MOB && classToSpawn == GetType() ) // 4J Added GetType() check to only spawn same type
{
std::shared_ptr<AgableMob> offspring = getBreedOffspring(dynamic_pointer_cast<AgableMob>(shared_from_this()));
shared_ptr<AgableMob> offspring = getBreedOffspring(dynamic_pointer_cast<AgableMob>(shared_from_this()));
if (offspring != NULL)
{
offspring->setAge(-20 * 60 * 20);

View File

@@ -13,13 +13,13 @@ private:
public:
AgableMob(Level *level);
virtual bool interact(std::shared_ptr<Player> player);
virtual bool interact(shared_ptr<Player> player);
protected:
virtual void defineSynchedData();
public:
virtual std::shared_ptr<AgableMob> getBreedOffspring(std::shared_ptr<AgableMob> target) = 0;
virtual shared_ptr<AgableMob> getBreedOffspring(shared_ptr<AgableMob> target) = 0;
virtual int getAge();
virtual void setAge(int age);
virtual void addAdditonalSaveData(CompoundTag *tag);

View File

@@ -18,7 +18,7 @@ Animal::Animal(Level *level) : AgableMob( level )
{
// inLove = 0; // 4J removed - now synched data
loveTime = 0;
loveCause = std::shared_ptr<Player>();
loveCause = shared_ptr<Player>();
setDespawnProtected();
}
@@ -62,7 +62,7 @@ void Animal::aiStep()
updateDespawnProtectedState(); // 4J added
}
void Animal::checkHurtTarget(std::shared_ptr<Entity> target, float d)
void Animal::checkHurtTarget(shared_ptr<Entity> target, float d)
{
if (dynamic_pointer_cast<Player>(target) != NULL)
{
@@ -75,7 +75,7 @@ void Animal::checkHurtTarget(std::shared_ptr<Entity> target, float d)
holdGround = true;
}
std::shared_ptr<Player> p = dynamic_pointer_cast<Player>(target);
shared_ptr<Player> p = dynamic_pointer_cast<Player>(target);
if (p->getSelectedItem() != NULL && this->isFood(p->getSelectedItem()))
{
}
@@ -87,7 +87,7 @@ void Animal::checkHurtTarget(std::shared_ptr<Entity> target, float d)
}
else if (dynamic_pointer_cast<Animal>(target) != NULL)
{
std::shared_ptr<Animal> a = dynamic_pointer_cast<Animal>(target);
shared_ptr<Animal> a = dynamic_pointer_cast<Animal>(target);
if (getAge() > 0 && a->getAge() < 0)
{
if (d < 2.5)
@@ -123,9 +123,9 @@ void Animal::checkHurtTarget(std::shared_ptr<Entity> target, float d)
}
void Animal::breedWith(std::shared_ptr<Animal> target)
void Animal::breedWith(shared_ptr<Animal> target)
{
std::shared_ptr<AgableMob> offspring = getBreedOffspring(target);
shared_ptr<AgableMob> offspring = getBreedOffspring(target);
setInLoveValue(0);
loveTime = 0;
@@ -154,7 +154,7 @@ void Animal::breedWith(std::shared_ptr<Animal> target)
}
level->addEntity(offspring);
level->addEntity( std::shared_ptr<ExperienceOrb>( new ExperienceOrb(level, x, y, z, random->nextInt(4) + 1) ) );
level->addEntity( shared_ptr<ExperienceOrb>( new ExperienceOrb(level, x, y, z, random->nextInt(4) + 1) ) );
}
setDespawnProtected();
@@ -170,7 +170,7 @@ bool Animal::hurt(DamageSource *dmgSource, int dmg)
{
if (dynamic_cast<EntityDamageSource *>(dmgSource) != NULL)
{
std::shared_ptr<Entity> source = dmgSource->getDirectEntity();
shared_ptr<Entity> source = dmgSource->getDirectEntity();
if (dynamic_pointer_cast<Player>(source) != NULL && !dynamic_pointer_cast<Player>(source)->isAllowedToAttackAnimals() )
{
@@ -179,7 +179,7 @@ bool Animal::hurt(DamageSource *dmgSource, int dmg)
if (source != NULL && source->GetType() == eTYPE_ARROW)
{
std::shared_ptr<Arrow> arrow = dynamic_pointer_cast<Arrow>(source);
shared_ptr<Arrow> arrow = dynamic_pointer_cast<Arrow>(source);
if (dynamic_pointer_cast<Player>(arrow->owner) != NULL && ! dynamic_pointer_cast<Player>(arrow->owner)->isAllowedToAttackAnimals() )
{
return false;
@@ -207,18 +207,18 @@ void Animal::readAdditionalSaveData(CompoundTag *tag)
setDespawnProtected();
}
std::shared_ptr<Entity> Animal::findAttackTarget()
shared_ptr<Entity> Animal::findAttackTarget()
{
if (fleeTime > 0) return nullptr;
float r = 8;
if (getInLoveValue() > 0)
{
vector<std::shared_ptr<Entity> > *others = level->getEntitiesOfClass(typeid(*this), bb->grow(r, r, r));
vector<shared_ptr<Entity> > *others = level->getEntitiesOfClass(typeid(*this), bb->grow(r, r, r));
//for (int i = 0; i < others->size(); i++)
for(AUTO_VAR(it, others->begin()); it != others->end(); ++it)
{
std::shared_ptr<Animal> p = dynamic_pointer_cast<Animal>(*it);
shared_ptr<Animal> p = dynamic_pointer_cast<Animal>(*it);
if (p != shared_from_this() && p->getInLoveValue() > 0)
{
delete others;
@@ -231,13 +231,13 @@ std::shared_ptr<Entity> Animal::findAttackTarget()
{
if (getAge() == 0)
{
vector<std::shared_ptr<Entity> > *players = level->getEntitiesOfClass(typeid(Player), bb->grow(r, r, r));
vector<shared_ptr<Entity> > *players = level->getEntitiesOfClass(typeid(Player), bb->grow(r, r, r));
//for (int i = 0; i < players.size(); i++)
for(AUTO_VAR(it, players->begin()); it != players->end(); ++it)
{
setDespawnProtected();
std::shared_ptr<Player> p = dynamic_pointer_cast<Player>(*it);
shared_ptr<Player> p = dynamic_pointer_cast<Player>(*it);
if (p->getSelectedItem() != NULL && this->isFood(p->getSelectedItem()))
{
delete players;
@@ -248,11 +248,11 @@ std::shared_ptr<Entity> Animal::findAttackTarget()
}
else if (getAge() > 0)
{
vector<std::shared_ptr<Entity> > *others = level->getEntitiesOfClass(typeid(*this), bb->grow(r, r, r));
//for (int i = 0; i < others.size(); i++)
vector<shared_ptr<Entity> > *others = level->getEntitiesOfClass(typeid(*this), bb->grow(r, r, r));
//for (int i = 0; i < others.size(); i++)
for(AUTO_VAR(it, others->begin()); it != others->end(); ++it)
{
std::shared_ptr<Animal> p = dynamic_pointer_cast<Animal>(*it);
shared_ptr<Animal> p = dynamic_pointer_cast<Animal>(*it);
if (p != shared_from_this() && p->getAge() < 0)
{
delete others;
@@ -283,19 +283,19 @@ bool Animal::removeWhenFarAway()
return !isDespawnProtected(); // 4J changed - was false
}
int Animal::getExperienceReward(std::shared_ptr<Player> killedBy)
int Animal::getExperienceReward(shared_ptr<Player> killedBy)
{
return 1 + level->random->nextInt(3);
}
bool Animal::isFood(std::shared_ptr<ItemInstance> itemInstance)
bool Animal::isFood(shared_ptr<ItemInstance> itemInstance)
{
return itemInstance->id == Item::wheat_Id;
}
bool Animal::interact(std::shared_ptr<Player> player)
bool Animal::interact(shared_ptr<Player> player)
{
std::shared_ptr<ItemInstance> item = player->inventory->getSelected();
shared_ptr<ItemInstance> item = player->inventory->getSelected();
if (item != NULL && isFood(item) && getAge() == 0)
{
if (!player->abilities.instabuild)
@@ -306,7 +306,7 @@ bool Animal::interact(std::shared_ptr<Player> player)
player->inventory->setItem(player->inventory->selected, nullptr);
}
}
// 4J-PB - If we can't produce another animal through breeding because of the spawn limits, display a message here
if(!level->isClientSide)
@@ -318,21 +318,21 @@ bool Animal::interact(std::shared_ptr<Player> player)
{
player->displayClientMessage(IDS_MAX_CHICKENS_BRED );
return false;
}
}
break;
case eTYPE_WOLF:
if( !level->canCreateMore(eTYPE_WOLF, Level::eSpawnType_Breed) )
{
player->displayClientMessage(IDS_MAX_WOLVES_BRED );
return false;
}
}
break;
case eTYPE_MUSHROOMCOW:
if( !level->canCreateMore(eTYPE_MUSHROOMCOW, Level::eSpawnType_Breed) )
{
player->displayClientMessage(IDS_MAX_MUSHROOMCOWS_BRED );
return false;
}
}
break;
default:
if((GetType() & eTYPE_ANIMALS_SPAWN_LIMIT_CHECK) == eTYPE_ANIMALS_SPAWN_LIMIT_CHECK)
@@ -380,13 +380,13 @@ void Animal::setInLoveValue(int value)
}
// 4J added
void Animal::setInLove(std::shared_ptr<Player> player)
void Animal::setInLove(shared_ptr<Player> player)
{
loveCause = player;
setInLoveValue(20*30);
}
std::shared_ptr<Player> Animal::getLoveCause()
shared_ptr<Player> Animal::getLoveCause()
{
return loveCause.lock();
}
@@ -400,7 +400,7 @@ void Animal::resetLove() {
entityData->set(DATA_IN_LOVE, 0);
}
bool Animal::canMate(std::shared_ptr<Animal> partner)
bool Animal::canMate(shared_ptr<Animal> partner)
{
if (partner == shared_from_this()) return false;
if (typeid(*partner) != typeid(*this)) return false;

View File

@@ -26,10 +26,10 @@ public:
virtual void aiStep();
protected:
virtual void checkHurtTarget(std::shared_ptr<Entity> target, float d);
virtual void checkHurtTarget(shared_ptr<Entity> target, float d);
private:
virtual void breedWith(std::shared_ptr<Animal> target);
virtual void breedWith(shared_ptr<Animal> target);
public:
virtual float getWalkTargetValue(int x, int y, int z);
@@ -40,7 +40,7 @@ public:
virtual void readAdditionalSaveData(CompoundTag *tag);
protected:
virtual std::shared_ptr<Entity> findAttackTarget();
virtual shared_ptr<Entity> findAttackTarget();
public:
virtual bool canSpawn();
@@ -48,22 +48,22 @@ public:
protected:
virtual bool removeWhenFarAway();
virtual int getExperienceReward(std::shared_ptr<Player> killedBy);
virtual int getExperienceReward(shared_ptr<Player> killedBy);
public:
virtual bool isFood(std::shared_ptr<ItemInstance> itemInstance);
virtual bool interact(std::shared_ptr<Player> player);
virtual bool isFood(shared_ptr<ItemInstance> itemInstance);
virtual bool interact(shared_ptr<Player> player);
protected:
int getInLoveValue(); // 4J added
public:
void setInLoveValue(int value); // 4J added
void setInLove(std::shared_ptr<Player> player); // 4J added, then modified to match latest Java for XboxOne achievements
std::shared_ptr<Player> getLoveCause();
void setInLove(shared_ptr<Player> player); // 4J added, then modified to match latest Java for XboxOne achievements
shared_ptr<Player> getLoveCause();
bool isInLove();
void resetLove();
virtual bool canMate(std::shared_ptr<Animal> partner);
virtual bool canMate(shared_ptr<Animal> partner);
// 4J added for determining whether animals are enclosed or not
private:

View File

@@ -13,30 +13,30 @@ AnimatePacket::AnimatePacket()
action = 0;
}
AnimatePacket::AnimatePacket(std::shared_ptr<Entity> e, int action)
AnimatePacket::AnimatePacket(shared_ptr<Entity> e, int action)
{
id = e->entityId;
this->action = action;
}
void AnimatePacket::read(DataInputStream *dis) //throws IOException
void AnimatePacket::read(DataInputStream *dis) //throws IOException
{
id = dis->readInt();
action = dis->readByte();
}
void AnimatePacket::write(DataOutputStream *dos) //throws IOException
void AnimatePacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeInt(id);
dos->writeByte(action);
}
void AnimatePacket::handle(PacketListener *listener)
void AnimatePacket::handle(PacketListener *listener)
{
listener->handleAnimate(shared_from_this());
}
int AnimatePacket::getEstimatedSize()
int AnimatePacket::getEstimatedSize()
{
return 5;
}

View File

@@ -9,7 +9,7 @@ public:
static const int SWING = 1;
static const int HURT = 2;
static const int WAKE_UP = 3;
static const int RESPAWN = 4;
static const int RESPAWN = 4;
static const int EAT = 5; // 1.8.2
static const int CRITICAL_HIT = 6;
static const int MAGIC_CRITICAL_HIT = 7;
@@ -18,14 +18,14 @@ public:
int action;
AnimatePacket();
AnimatePacket(std::shared_ptr<Entity> e, int action);
AnimatePacket(shared_ptr<Entity> e, int action);
virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos);
virtual void handle(PacketListener *listener);
virtual int getEstimatedSize();
public:
static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new AnimatePacket()); }
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AnimatePacket()); }
virtual int getId() { return 18; }
};

View File

@@ -55,7 +55,7 @@ void AnvilTile::registerIcons(IconRegister *iconRegister)
}
}
void AnvilTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr<Mob> by)
void AnvilTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr<Mob> by)
{
int dir = (Mth::floor(by->yRot * 4 / (360) + 0.5)) & 3;
int dmg = level->getData(x, y, z) >> 2;
@@ -67,7 +67,7 @@ void AnvilTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr<M
if (dir == 3) level->setData(x, y, z, Direction::WEST | (dmg << 2));
}
bool AnvilTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly)
bool AnvilTile::use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly)
{
if (level->isClientSide)
{
@@ -87,7 +87,7 @@ int AnvilTile::getSpawnResourcesAuxValue(int data)
return data >> 2;
}
void AnvilTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr<TileEntity> forceEntity)
void AnvilTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr<TileEntity> forceEntity)
{
int dir = level->getData(x, y, z) & 3;
@@ -101,7 +101,7 @@ void AnvilTile::updateShape(LevelSource *level, int x, int y, int z, int forceDa
}
}
void AnvilTile::falling(std::shared_ptr<FallingTile> entity)
void AnvilTile::falling(shared_ptr<FallingTile> entity)
{
entity->setHurtsEntities(true);
}

View File

@@ -35,14 +35,14 @@ public:
bool isSolidRender(bool isServerLevel = false);
Icon *getTexture(int face, int data);
void registerIcons(IconRegister *iconRegister);
void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr<Mob> by);
bool use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false);
void setPlacedBy(Level *level, int x, int y, int z, shared_ptr<Mob> by);
bool use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false);
int getRenderShape();
int getSpawnResourcesAuxValue(int data);
void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr<TileEntity> forceEntity = std::shared_ptr<TileEntity>());
void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>());
protected:
void falling(std::shared_ptr<FallingTile> entity);
void falling(shared_ptr<FallingTile> entity);
public:
void onLand(Level *level, int xt, int yt, int zt, int data);

View File

@@ -5,14 +5,14 @@
#include "net.minecraft.world.item.crafting.h"
#include "ArmorDyeRecipe.h"
bool ArmorDyeRecipe::matches(std::shared_ptr<CraftingContainer> craftSlots, Level *level)
bool ArmorDyeRecipe::matches(shared_ptr<CraftingContainer> craftSlots, Level *level)
{
std::shared_ptr<ItemInstance> target = nullptr;
vector<std::shared_ptr<ItemInstance> > dyes;
shared_ptr<ItemInstance> target = nullptr;
vector<shared_ptr<ItemInstance> > dyes;
for (int slot = 0; slot < craftSlots->getContainerSize(); slot++)
{
std::shared_ptr<ItemInstance> item = craftSlots->getItem(slot);
shared_ptr<ItemInstance> item = craftSlots->getItem(slot);
if (item == NULL) continue;
ArmorItem *armor = dynamic_cast<ArmorItem *>(item->getItem());
@@ -40,9 +40,9 @@ bool ArmorDyeRecipe::matches(std::shared_ptr<CraftingContainer> craftSlots, Leve
return target != NULL && !dyes.empty();
}
std::shared_ptr<ItemInstance> ArmorDyeRecipe::assembleDyedArmor(std::shared_ptr<CraftingContainer> craftSlots)
shared_ptr<ItemInstance> ArmorDyeRecipe::assembleDyedArmor(shared_ptr<CraftingContainer> craftSlots)
{
std::shared_ptr<ItemInstance> target = nullptr;
shared_ptr<ItemInstance> target = nullptr;
int colorTotals[3];
colorTotals[0] = 0;
colorTotals[1] = 0;
@@ -55,7 +55,7 @@ std::shared_ptr<ItemInstance> ArmorDyeRecipe::assembleDyedArmor(std::shared_ptr<
{
for (int slot = 0; slot < craftSlots->getContainerSize(); slot++)
{
std::shared_ptr<ItemInstance> item = craftSlots->getItem(slot);
shared_ptr<ItemInstance> item = craftSlots->getItem(slot);
if (item == NULL) continue;
armor = dynamic_cast<ArmorItem *>(item->getItem());
@@ -128,7 +128,7 @@ std::shared_ptr<ItemInstance> ArmorDyeRecipe::assembleDyedArmor(std::shared_ptr<
return target;
}
std::shared_ptr<ItemInstance> ArmorDyeRecipe::assemble(std::shared_ptr<CraftingContainer> craftSlots)
shared_ptr<ItemInstance> ArmorDyeRecipe::assemble(shared_ptr<CraftingContainer> craftSlots)
{
return ArmorDyeRecipe::assembleDyedArmor(craftSlots);
}
@@ -181,8 +181,8 @@ void ArmorDyeRecipe::requires(INGREDIENTS_REQUIRED *pIngReq)
{
ItemInstance *expected = *ingredient;
if (expected!=NULL)
{
if (expected!=NULL)
{
int iAuxVal = (*ingredient)->getAuxValue();
TempIngReq.uiGridA[iCount++]=expected->id | iAuxVal<<24;
// 4J-PB - put the ingredients in boxes 1,2,4,5 so we can see them in a 2x2 crafting screen

View File

@@ -5,17 +5,17 @@
class ArmorDyeRecipe : public Recipy
{
public:
bool matches(std::shared_ptr<CraftingContainer> craftSlots, Level *level);
bool matches(shared_ptr<CraftingContainer> craftSlots, Level *level);
// 4J Stu - Made static as we use this in a different way from the Java (but needs to be a different name otherwise Orbis compiler complains
static std::shared_ptr<ItemInstance> assembleDyedArmor(std::shared_ptr<CraftingContainer> craftSlots);
std::shared_ptr<ItemInstance> assemble(std::shared_ptr<CraftingContainer> craftSlots);
static shared_ptr<ItemInstance> assembleDyedArmor(shared_ptr<CraftingContainer> craftSlots);
shared_ptr<ItemInstance> assemble(shared_ptr<CraftingContainer> craftSlots);
int size();
const ItemInstance *getResultItem();
virtual const int getGroup();
virtual const int getGroup();
// 4J-PB
virtual bool requires(int iRecipe);

View File

@@ -88,7 +88,7 @@ ArmorItem::ArmorItem(int id, const ArmorMaterial *armorType, int icon, int slot)
maxStackSize = 1;
}
int ArmorItem::getColor(std::shared_ptr<ItemInstance> item, int spriteLayer)
int ArmorItem::getColor(shared_ptr<ItemInstance> item, int spriteLayer)
{
if (spriteLayer > 0)
{
@@ -116,7 +116,7 @@ const _ArmorMaterial *ArmorItem::getMaterial()
return armorType;
}
bool ArmorItem::hasCustomColor(std::shared_ptr<ItemInstance> item)
bool ArmorItem::hasCustomColor(shared_ptr<ItemInstance> item)
{
if (armorType != ArmorMaterial::CLOTH) return false;
if (!item->hasTag()) return false;
@@ -126,7 +126,7 @@ bool ArmorItem::hasCustomColor(std::shared_ptr<ItemInstance> item)
return true;
}
int ArmorItem::getColor(std::shared_ptr<ItemInstance> item)
int ArmorItem::getColor(shared_ptr<ItemInstance> item)
{
if (armorType != ArmorMaterial::CLOTH) return -1;
@@ -155,7 +155,7 @@ Icon *ArmorItem::getLayerIcon(int auxValue, int spriteLayer)
return Item::getLayerIcon(auxValue, spriteLayer);
}
void ArmorItem::clearColor(std::shared_ptr<ItemInstance> item)
void ArmorItem::clearColor(shared_ptr<ItemInstance> item)
{
if (armorType != ArmorMaterial::CLOTH) return;
CompoundTag *tag = item->getTag();
@@ -164,7 +164,7 @@ void ArmorItem::clearColor(std::shared_ptr<ItemInstance> item)
if (display->contains(L"color")) display->remove(L"color");
}
void ArmorItem::setColor(std::shared_ptr<ItemInstance> item, int color)
void ArmorItem::setColor(shared_ptr<ItemInstance> item, int color)
{
if (armorType != ArmorMaterial::CLOTH)
{
@@ -189,7 +189,7 @@ void ArmorItem::setColor(std::shared_ptr<ItemInstance> item, int color)
display->putInt(L"color", color);
}
bool ArmorItem::isValidRepairItem(std::shared_ptr<ItemInstance> source, std::shared_ptr<ItemInstance> repairItem)
bool ArmorItem::isValidRepairItem(shared_ptr<ItemInstance> source, shared_ptr<ItemInstance> repairItem)
{
if (armorType->getTierItemId() == repairItem->id)
{

View File

@@ -65,7 +65,7 @@ public:
ArmorItem(int id, const ArmorMaterial *armorType, int icon, int slot);
//@Override
int getColor(std::shared_ptr<ItemInstance> item, int spriteLayer);
int getColor(shared_ptr<ItemInstance> item, int spriteLayer);
//@Override
bool hasMultipleSpriteLayers();
@@ -73,15 +73,15 @@ public:
virtual int getEnchantmentValue();
const ArmorMaterial *getMaterial();
bool hasCustomColor(std::shared_ptr<ItemInstance> item);
int getColor(std::shared_ptr<ItemInstance> item);
bool hasCustomColor(shared_ptr<ItemInstance> item);
int getColor(shared_ptr<ItemInstance> item);
//@Override
Icon *getLayerIcon(int auxValue, int spriteLayer);
void clearColor(std::shared_ptr<ItemInstance> item);
void setColor(std::shared_ptr<ItemInstance> item, int color);
void clearColor(shared_ptr<ItemInstance> item);
void setColor(shared_ptr<ItemInstance> item, int color);
bool isValidRepairItem(std::shared_ptr<ItemInstance> source, std::shared_ptr<ItemInstance> repairItem);
bool isValidRepairItem(shared_ptr<ItemInstance> source, shared_ptr<ItemInstance> repairItem);
//@Override
void registerIcons(IconRegister *iconRegister);

View File

@@ -6,7 +6,7 @@
#include "net.minecraft.world.item.crafting.h"
#include "ArmorSlot.h"
ArmorSlot::ArmorSlot(int slotNum, std::shared_ptr<Container> container, int id, int x, int y)
ArmorSlot::ArmorSlot(int slotNum, shared_ptr<Container> container, int id, int x, int y)
: Slot( container, id, x, y ),
slotNum( slotNum )
{
@@ -17,7 +17,7 @@ int ArmorSlot::getMaxStackSize()
return 1;
}
bool ArmorSlot::mayPlace(std::shared_ptr<ItemInstance> item)
bool ArmorSlot::mayPlace(shared_ptr<ItemInstance> item)
{
if ( dynamic_cast<ArmorItem *>( item->getItem() ) != NULL)
{
@@ -36,9 +36,9 @@ Icon *ArmorSlot::getNoItemIcon()
}
//
//bool ArmorSlot::mayCombine(std::shared_ptr<ItemInstance> item)
//bool ArmorSlot::mayCombine(shared_ptr<ItemInstance> item)
//{
// std::shared_ptr<ItemInstance> thisItemI = getItem();
// shared_ptr<ItemInstance> thisItemI = getItem();
// if(thisItemI == NULL || item == NULL) return false;
//
// ArmorItem *thisItem = (ArmorItem *)thisItemI->getItem();
@@ -47,12 +47,12 @@ Icon *ArmorSlot::getNoItemIcon()
// return thisIsDyableArmor && itemIsDye;
//}
//
//std::shared_ptr<ItemInstance> ArmorSlot::combine(std::shared_ptr<ItemInstance> item)
//shared_ptr<ItemInstance> ArmorSlot::combine(shared_ptr<ItemInstance> item)
//{
// std::shared_ptr<CraftingContainer> craftSlots = std::shared_ptr<CraftingContainer>( new CraftingContainer(NULL, 2, 2) );
// shared_ptr<CraftingContainer> craftSlots = shared_ptr<CraftingContainer>( new CraftingContainer(NULL, 2, 2) );
// craftSlots->setItem(0, item);
// craftSlots->setItem(1, getItem()); // Armour item needs to go second
// std::shared_ptr<ItemInstance> result = ArmorDyeRecipe::assembleDyedArmor(craftSlots);
// shared_ptr<ItemInstance> result = ArmorDyeRecipe::assembleDyedArmor(craftSlots);
// craftSlots->setItem(0, nullptr);
// craftSlots->setItem(1, nullptr);
// return result;

View File

@@ -13,12 +13,12 @@ private:
const int slotNum;
public:
ArmorSlot(int slotNum, std::shared_ptr<Container> container, int id, int x, int y);
ArmorSlot(int slotNum, shared_ptr<Container> container, int id, int x, int y);
virtual ~ArmorSlot() {}
virtual int getMaxStackSize();
virtual bool mayPlace(std::shared_ptr<ItemInstance> item);
virtual bool mayPlace(shared_ptr<ItemInstance> item);
Icon *getNoItemIcon();
//virtual bool mayCombine(std::shared_ptr<ItemInstance> item); // 4J Added
//virtual std::shared_ptr<ItemInstance> combine(std::shared_ptr<ItemInstance> item); // 4J Added
//virtual bool mayCombine(shared_ptr<ItemInstance> item); // 4J Added
//virtual shared_ptr<ItemInstance> combine(shared_ptr<ItemInstance> item); // 4J Added
};

View File

@@ -105,11 +105,11 @@ typedef arrayWithLength<Level *> LevelArray;
typedef arrayWithLength<LevelRenderer *> LevelRendererArray;
typedef arrayWithLength<WeighedRandomItem *> WeighedRandomItemArray;
typedef arrayWithLength<WeighedTreasure *> WeighedTreasureArray;
typedef arrayWithLength< std::shared_ptr<Layer> > LayerArray;
typedef arrayWithLength< shared_ptr<Layer> > LayerArray;
//typedef arrayWithLength<Cube *> CubeArray;
typedef arrayWithLength<ModelPart *> ModelPartArray;
typedef arrayWithLength<Enchantment *> EnchantmentArray;
typedef arrayWithLength<ClipChunk> ClipChunkArray;
#include "ItemInstance.h"
typedef arrayWithLength<std::shared_ptr<ItemInstance> > ItemInstanceArray;
typedef arrayWithLength<shared_ptr<ItemInstance> > ItemInstanceArray;

View File

@@ -52,7 +52,7 @@ Arrow::Arrow(Level *level) : Entity( level )
this->setSize(0.5f, 0.5f);
}
Arrow::Arrow(Level *level, std::shared_ptr<Mob> mob, std::shared_ptr<Mob> target, float power, float uncertainty) : Entity( level )
Arrow::Arrow(Level *level, shared_ptr<Mob> mob, shared_ptr<Mob> target, float power, float uncertainty) : Entity( level )
{
_init();
@@ -88,8 +88,8 @@ Arrow::Arrow(Level *level, double x, double y, double z) : Entity( level )
this->setPos(x, y, z);
this->heightOffset = 0;
}
Arrow::Arrow(Level *level, std::shared_ptr<Mob> mob, float power) : Entity( level )
Arrow::Arrow(Level *level, shared_ptr<Mob> mob, float power) : Entity( level )
{
_init();
@@ -171,12 +171,12 @@ void Arrow::lerpMotion(double xd, double yd, double zd)
}
}
void Arrow::tick()
void Arrow::tick()
{
Entity::tick();
if (xRotO == 0 && yRotO == 0)
if (xRotO == 0 && yRotO == 0)
{
double sd = sqrt(xd * xd + zd * zd);
yRotO = this->yRot = (float) (atan2(xd, zd) * 180 / PI);
@@ -214,17 +214,17 @@ void Arrow::tick()
life = 0;
flightTime = 0;
return;
}
}
else
else
{
life++;
if (life == 20 * 60) remove();
return;
}
}
else
}
else
{
flightTime++;
}
@@ -239,13 +239,13 @@ void Arrow::tick()
{
to = Vec3::newTemp(res->pos->x, res->pos->y, res->pos->z);
}
std::shared_ptr<Entity> hitEntity = nullptr;
vector<std::shared_ptr<Entity> > *objects = level->getEntities(shared_from_this(), this->bb->expand(xd, yd, zd)->grow(1, 1, 1));
shared_ptr<Entity> hitEntity = nullptr;
vector<shared_ptr<Entity> > *objects = level->getEntities(shared_from_this(), this->bb->expand(xd, yd, zd)->grow(1, 1, 1));
double nearest = 0;
AUTO_VAR(itEnd, objects->end());
for (AUTO_VAR(it, objects->begin()); it != itEnd; it++)
{
std::shared_ptr<Entity> e = *it; //objects->at(i);
shared_ptr<Entity> e = *it; //objects->at(i);
if (!e->isPickable() || (e == owner && flightTime < 5)) continue;
float rr = 0.3f;
@@ -299,7 +299,7 @@ void Arrow::tick()
res->entity->setOnFire(5);
}
std::shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(res->entity);
shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(res->entity);
if (mob != NULL)
{
mob->arrowCount++;
@@ -333,7 +333,7 @@ void Arrow::tick()
// 4J - sound change brought forward from 1.2.3
level->playSound(shared_from_this(), eSoundType_RANDOM_BOW_HIT, 1.0f, 1.2f / (random->nextFloat() * 0.2f + 0.9f));
remove();
}
}
else
{
xd *= -0.1f;
@@ -343,7 +343,7 @@ void Arrow::tick()
yRotO += 180;
flightTime = 0;
}
delete damageSource;
}
else
@@ -464,7 +464,7 @@ void Arrow::readAdditionalSaveData(CompoundTag *tag)
}
}
void Arrow::playerTouch(std::shared_ptr<Player> player)
void Arrow::playerTouch(shared_ptr<Player> player)
{
if (level->isClientSide || !inGround || shakeTime > 0) return;
@@ -472,7 +472,7 @@ void Arrow::playerTouch(std::shared_ptr<Player> player)
if (pickup == PICKUP_ALLOWED)
{
if (!player->inventory->add( std::shared_ptr<ItemInstance>( new ItemInstance(Item::arrow, 1) ) ))
if (!player->inventory->add( shared_ptr<ItemInstance>( new ItemInstance(Item::arrow, 1) ) ))
{
bRemove = false;
}

View File

@@ -36,7 +36,7 @@ private:
public:
int pickup;
int shakeTime;
std::shared_ptr<Entity> owner;
shared_ptr<Entity> owner;
private:
double baseDamage;
@@ -52,9 +52,9 @@ private:
public:
Arrow(Level *level);
Arrow(Level *level, std::shared_ptr<Mob> mob, std::shared_ptr<Mob> target, float power, float uncertainty);
Arrow(Level *level, shared_ptr<Mob> mob, shared_ptr<Mob> target, float power, float uncertainty);
Arrow(Level *level, double x, double y, double z);
Arrow(Level *level, std::shared_ptr<Mob> mob, float power);
Arrow(Level *level, shared_ptr<Mob> mob, float power);
protected:
virtual void defineSynchedData();
@@ -66,7 +66,7 @@ public:
virtual void tick();
virtual void addAdditonalSaveData(CompoundTag *tag);
virtual void readAdditionalSaveData(CompoundTag *tag);
virtual void playerTouch(std::shared_ptr<Player> player);
virtual void playerTouch(shared_ptr<Player> player);
virtual float getShadowHeightOffs();
void setBaseDamage(double baseDamage);

View File

@@ -26,7 +26,7 @@ ArrowAttackGoal::ArrowAttackGoal(Mob *mob, float speed, int projectileType, int
bool ArrowAttackGoal::canUse()
{
std::shared_ptr<Mob> bestTarget = mob->getTarget();
shared_ptr<Mob> bestTarget = mob->getTarget();
if (bestTarget == NULL) return false;
target = weak_ptr<Mob>(bestTarget);
return true;
@@ -45,7 +45,7 @@ void ArrowAttackGoal::stop()
void ArrowAttackGoal::tick()
{
double attackRadiusSqr = 10 * 10;
std::shared_ptr<Mob> tar = target.lock();
shared_ptr<Mob> tar = target.lock();
double targetDistSqr = mob->distanceToSqr(tar->x, tar->bb->y0, tar->z);
bool canSee = mob->getSensing()->canSee(tar);
@@ -69,16 +69,16 @@ void ArrowAttackGoal::tick()
void ArrowAttackGoal::fireAtTarget()
{
std::shared_ptr<Mob> tar = target.lock();
shared_ptr<Mob> tar = target.lock();
if (projectileType == ArrowType)
{
std::shared_ptr<Arrow> arrow = std::shared_ptr<Arrow>( new Arrow(level, dynamic_pointer_cast<Mob>(mob->shared_from_this()), tar, 1.60f, 12) );
shared_ptr<Arrow> arrow = shared_ptr<Arrow>( new Arrow(level, dynamic_pointer_cast<Mob>(mob->shared_from_this()), tar, 1.60f, 12) );
level->playSound(mob->shared_from_this(), eSoundType_RANDOM_BOW, 1.0f, 1 / (mob->getRandom()->nextFloat() * 0.4f + 0.8f));
level->addEntity(arrow);
}
else if (projectileType == SnowballType)
{
std::shared_ptr<Snowball> snowball = std::shared_ptr<Snowball>( new Snowball(level, dynamic_pointer_cast<Mob>(mob->shared_from_this())) );
shared_ptr<Snowball> snowball = shared_ptr<Snowball>( new Snowball(level, dynamic_pointer_cast<Mob>(mob->shared_from_this())) );
double xd = tar->x - mob->x;
double yd = (tar->y + tar->getHeadHeight() - 1.1f) - snowball->y;
double zd = tar->z - mob->z;

View File

@@ -33,14 +33,14 @@ bool AvoidPlayerGoal::canUse()
{
if (avoidType == typeid(Player))
{
std::shared_ptr<TamableAnimal> tamableAnimal = dynamic_pointer_cast<TamableAnimal>(mob->shared_from_this());
shared_ptr<TamableAnimal> tamableAnimal = dynamic_pointer_cast<TamableAnimal>(mob->shared_from_this());
if (tamableAnimal != NULL && tamableAnimal->isTame()) return false;
toAvoid = weak_ptr<Entity>(mob->level->getNearestPlayer(mob->shared_from_this(), maxDist));
if (toAvoid.lock() == NULL) return false;
}
else
{
vector<std::shared_ptr<Entity> > *entities = mob->level->getEntitiesOfClass(avoidType, mob->bb->grow(maxDist, 3, maxDist));
vector<shared_ptr<Entity> > *entities = mob->level->getEntitiesOfClass(avoidType, mob->bb->grow(maxDist, 3, maxDist));
if (entities->empty())
{
delete entities;

View File

@@ -24,7 +24,7 @@ public:
virtual int getEstimatedSize();
virtual bool isAync();
static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new AwardStatPacket()); }
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AwardStatPacket()); }
virtual int getId() { return 200; }
public:

View File

@@ -12,7 +12,7 @@ BedItem::BedItem(int id) : Item( id )
{
}
bool BedItem::useOn(std::shared_ptr<ItemInstance> itemInstance, std::shared_ptr<Player> player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly)
bool BedItem::useOn(shared_ptr<ItemInstance> itemInstance, shared_ptr<Player> player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly)
{
if (face != Facing::UP)
{

View File

@@ -11,5 +11,5 @@ class BedItem : public Item
public:
BedItem(int id);
virtual bool useOn(std::shared_ptr<ItemInstance> itemInstance, std::shared_ptr<Player> player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false);
virtual bool useOn(shared_ptr<ItemInstance> itemInstance, shared_ptr<Player> player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false);
};

View File

@@ -28,7 +28,7 @@ void BedTile::updateDefaultShape()
}
// 4J-PB - Adding a TestUse for tooltip display
bool BedTile::TestUse(Level *level, int x, int y, int z, std::shared_ptr<Player> player)
bool BedTile::TestUse(Level *level, int x, int y, int z, shared_ptr<Player> player)
{
//if (level->isClientSide) return true;
@@ -65,7 +65,7 @@ bool BedTile::TestUse(Level *level, int x, int y, int z, std::shared_ptr<Player>
return false;
}
bool BedTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
bool BedTile::use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
{
if( soundOnly) return false;
if (level->isClientSide) return true;
@@ -106,11 +106,11 @@ bool BedTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> pla
if (BedTile::isOccupied(data))
{
std::shared_ptr<Player> sleepingPlayer = nullptr;
shared_ptr<Player> sleepingPlayer = nullptr;
AUTO_VAR(itEnd, level->players.end());
for (AUTO_VAR(it, level->players.begin()); it != itEnd; it++ )
{
std::shared_ptr<Player> p = *it;
shared_ptr<Player> p = *it;
if (p->isSleeping())
{
Pos pos = p->bedPosition;
@@ -128,7 +128,7 @@ bool BedTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> pla
else
{
player->displayClientMessage(IDS_TILE_BED_OCCUPIED );
return true;
}
}
@@ -142,7 +142,7 @@ bool BedTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> pla
if(level->AllPlayersAreSleeping()==false)
{
player->displayClientMessage(IDS_TILE_BED_PLAYERSLEEP);
}
}
return true;
}
@@ -211,7 +211,7 @@ bool BedTile::isSolidRender(bool isServerLevel)
return false;
}
void BedTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr<TileEntity> forceEntity) // 4J added forceData, forceEntity param
void BedTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr<TileEntity> forceEntity) // 4J added forceData, forceEntity param
{
setShape();
}

View File

@@ -23,17 +23,17 @@ public:
static int HEAD_DIRECTION_OFFSETS[4][2];
BedTile(int id);
virtual void updateDefaultShape();
virtual bool TestUse(Level *level, int x, int y, int z, std::shared_ptr<Player> player);
virtual bool use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param
virtual bool TestUse(Level *level, int x, int y, int z, shared_ptr<Player> player);
virtual bool use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param
virtual Icon *getTexture(int face, int data);
//@Override
void registerIcons(IconRegister *iconRegister);
virtual int getRenderShape();
virtual bool isCubeShaped();
virtual bool isSolidRender(bool isServerLevel = false);
virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr<TileEntity> forceEntity = std::shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
virtual void neighborChanged(Level *level, int x, int y, int z, int type);
virtual int getResource(int data, Random *random,int playerBonusLevel);

View File

@@ -51,9 +51,9 @@ void BegGoal::tick()
--lookTime;
}
bool BegGoal::playerHoldingInteresting(std::shared_ptr<Player> player)
bool BegGoal::playerHoldingInteresting(shared_ptr<Player> player)
{
std::shared_ptr<ItemInstance> item = player->inventory->getSelected();
shared_ptr<ItemInstance> item = player->inventory->getSelected();
if (item == NULL) return false;
if (!wolf->isTame() && item->id == Item::bone_Id) return true;
return wolf->isFood(item);

View File

@@ -23,7 +23,7 @@ public:
virtual void tick();
private:
bool playerHoldingInteresting(std::shared_ptr<Player> player);
bool playerHoldingInteresting(shared_ptr<Player> player);
public:
// 4J Added override to update ai elements when loading entity from schematics

View File

@@ -4,7 +4,7 @@
#include "net.minecraft.world.level.h"
#include "BiomeInitLayer.h"
BiomeInitLayer::BiomeInitLayer(int64_t seed, std::shared_ptr<Layer>parent, LevelType *levelType) : Layer(seed)
BiomeInitLayer::BiomeInitLayer(int64_t seed, shared_ptr<Layer>parent, LevelType *levelType) : Layer(seed)
{
this->parent = parent;

View File

@@ -10,7 +10,7 @@ private:
BiomeArray startBiomes;
public:
BiomeInitLayer(int64_t seed, std::shared_ptr<Layer> parent, LevelType *levelType);
BiomeInitLayer(int64_t seed, shared_ptr<Layer> parent, LevelType *levelType);
virtual ~BiomeInitLayer();
intArray getArea(int xo, int yo, int w, int h);
};

View File

@@ -13,8 +13,8 @@ class LevelType;
class BiomeSource
{
private:
std::shared_ptr<Layer> layer;
std::shared_ptr<Layer> zoomedLayer;
shared_ptr<Layer> layer;
shared_ptr<Layer> zoomedLayer;
public:
static const int CACHE_DIAMETER = 256;

View File

@@ -115,7 +115,7 @@ void Blaze::aiStep()
Monster::aiStep();
}
void Blaze::checkHurtTarget(std::shared_ptr<Entity> target, float d)
void Blaze::checkHurtTarget(shared_ptr<Entity> target, float d)
{
if (attackTime <= 0 && d < 2.0f && target->bb->y1 > bb->y0 && target->bb->y0 < bb->y1)
{
@@ -154,7 +154,7 @@ void Blaze::checkHurtTarget(std::shared_ptr<Entity> target, float d)
level->levelEvent(nullptr, LevelEvent::SOUND_BLAZE_FIREBALL, (int) x, (int) y, (int) z, 0);
// level.playSound(this, "mob.ghast.fireball", getSoundVolume(), (random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f);
for (int i = 0; i < 1; i++) {
std::shared_ptr<SmallFireball> ie = std::shared_ptr<SmallFireball>( new SmallFireball(level, dynamic_pointer_cast<Mob>( shared_from_this() ), xd + random->nextGaussian() * sqd, yd, zd + random->nextGaussian() * sqd) );
shared_ptr<SmallFireball> ie = shared_ptr<SmallFireball>( new SmallFireball(level, dynamic_pointer_cast<Mob>( shared_from_this() ), xd + random->nextGaussian() * sqd, yd, zd + random->nextGaussian() * sqd) );
// Vec3 v = getViewVector(1);
// ie.x = x + v.x * 1.5;
ie->y = y + bbHeight / 2 + 0.5f;

View File

@@ -32,7 +32,7 @@ public:
virtual void aiStep();
protected:
virtual void checkHurtTarget(std::shared_ptr<Entity> target, float d);
virtual void checkHurtTarget(shared_ptr<Entity> target, float d);
virtual void causeFallDamage(float distance);
virtual int getDeathLoot();

View File

@@ -28,6 +28,6 @@ public:
virtual int getEstimatedSize();
public:
static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new BlockRegionUpdatePacket()); }
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new BlockRegionUpdatePacket()); }
virtual int getId() { return 51; }
};

View File

@@ -56,7 +56,7 @@ void Boat::defineSynchedData()
}
AABB *Boat::getCollideAgainstBox(std::shared_ptr<Entity> entity)
AABB *Boat::getCollideAgainstBox(shared_ptr<Entity> entity)
{
return entity->bb;
}
@@ -98,9 +98,9 @@ bool Boat::hurt(DamageSource *source, int hurtDamage)
// Untrusted players shouldn't be able to damage minecarts or boats.
if (dynamic_cast<EntityDamageSource *>(source) != NULL)
{
std::shared_ptr<Entity> attacker = source->getDirectEntity();
shared_ptr<Entity> attacker = source->getDirectEntity();
if (dynamic_pointer_cast<Player>(attacker) != NULL &&
if (dynamic_pointer_cast<Player>(attacker) != NULL &&
!dynamic_pointer_cast<Player>(attacker)->isAllowedToHurtEntity( shared_from_this() ))
return false;
}
@@ -117,7 +117,7 @@ bool Boat::hurt(DamageSource *source, int hurtDamage)
markHurt();
// 4J Stu - Brought froward from 12w36 to fix #46611 - TU5: Gameplay: Minecarts and boat requires more hits than one to be destroyed in creative mode
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(source->getEntity());
shared_ptr<Player> player = dynamic_pointer_cast<Player>(source->getEntity());
if (player != NULL && player->abilities.instabuild) setDamage(100);
if (getDamage() > 20 * 2)
@@ -394,13 +394,13 @@ void Boat::tick()
if(level->isClientSide) return;
vector<std::shared_ptr<Entity> > *entities = level->getEntities(shared_from_this(), this->bb->grow(0.2f, 0, 0.2f));
vector<shared_ptr<Entity> > *entities = level->getEntities(shared_from_this(), this->bb->grow(0.2f, 0, 0.2f));
if (entities != NULL && !entities->empty())
{
AUTO_VAR(itEnd, entities->end());
for (AUTO_VAR(it, entities->begin()); it != itEnd; it++)
{
std::shared_ptr<Entity> e = (*it); // entities->at(i);
shared_ptr<Entity> e = (*it); // entities->at(i);
if (e != rider.lock() && e->isPushable() && e->GetType() == eTYPE_BOAT)
{
e->push(shared_from_this());
@@ -467,7 +467,7 @@ wstring Boat::getName()
return L"Boat";
}
bool Boat::interact(std::shared_ptr<Player> player)
bool Boat::interact(shared_ptr<Player> player)
{
if (rider.lock() != NULL && dynamic_pointer_cast<Player>(rider.lock())!=NULL && rider.lock() != player) return true;
if (!level->isClientSide)

View File

@@ -40,7 +40,7 @@ protected:
virtual void defineSynchedData();
public:
virtual AABB *getCollideAgainstBox(std::shared_ptr<Entity> entity);
virtual AABB *getCollideAgainstBox(shared_ptr<Entity> entity);
virtual AABB *getCollideBox();
virtual bool isPushable();
@@ -69,7 +69,7 @@ protected:
public:
virtual float getShadowHeightOffs();
wstring getName();
virtual bool interact(std::shared_ptr<Player> player);
virtual bool interact(shared_ptr<Player> player);
virtual void setDamage(int damage);
virtual int getDamage();

View File

@@ -12,7 +12,7 @@ BoatItem::BoatItem(int id) : Item( id )
this->maxStackSize = 1;
}
bool BoatItem::TestUse(Level *level, std::shared_ptr<Player> player)
bool BoatItem::TestUse(Level *level, shared_ptr<Player> player)
{
// 4J-PB - added for tooltips to test use
// 4J TODO really we should have the crosshair hitresult telling us if it hit water, and at what distance, so we don't need to do this again
@@ -49,7 +49,7 @@ bool BoatItem::TestUse(Level *level, std::shared_ptr<Player> player)
delete hr;
return false;
}
std::shared_ptr<ItemInstance> BoatItem::use(std::shared_ptr<ItemInstance> itemInstance, Level *level, std::shared_ptr<Player> player)
shared_ptr<ItemInstance> BoatItem::use(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player)
{
float a = 1;
@@ -80,11 +80,11 @@ std::shared_ptr<ItemInstance> BoatItem::use(std::shared_ptr<ItemInstance> itemIn
Vec3 *b = player->getViewVector(a);
bool hitEntity = false;
float overlap = 1;
vector<std::shared_ptr<Entity> > *objects = level->getEntities(player, player->bb->expand(b->x * (range), b->y * (range), b->z * (range))->grow(overlap, overlap, overlap));
vector<shared_ptr<Entity> > *objects = level->getEntities(player, player->bb->expand(b->x * (range), b->y * (range), b->z * (range))->grow(overlap, overlap, overlap));
//for (int i = 0; i < objects.size(); i++) {
for(AUTO_VAR(it, objects->begin()); it != objects->end(); ++it)
{
std::shared_ptr<Entity> e = *it; //objects.get(i);
shared_ptr<Entity> e = *it; //objects.get(i);
if (!e->isPickable()) continue;
float rr = e->getPickRadius();
@@ -105,12 +105,12 @@ std::shared_ptr<ItemInstance> BoatItem::use(std::shared_ptr<ItemInstance> itemIn
int yt = hr->y;
int zt = hr->z;
if (!level->isClientSide)
if (!level->isClientSide)
{
if (level->getTile(xt, yt, zt) == Tile::topSnow_Id) yt--;
if( level->countInstanceOf(eTYPE_BOAT, true) < Level::MAX_XBOX_BOATS ) // 4J - added limit
{
level->addEntity( std::shared_ptr<Boat>( new Boat(level, xt + 0.5f, yt + 1.0f, zt + 0.5f) ) );
level->addEntity( shared_ptr<Boat>( new Boat(level, xt + 0.5f, yt + 1.0f, zt + 0.5f) ) );
if (!player->abilities.instabuild)
{
itemInstance->count--;

View File

@@ -11,8 +11,8 @@ public:
BoatItem(int id);
virtual bool TestUse(Level *level, std::shared_ptr<Player> player);
virtual std::shared_ptr<ItemInstance> use(std::shared_ptr<ItemInstance> itemInstance, Level *level, std::shared_ptr<Player> player);
virtual bool TestUse(Level *level, shared_ptr<Player> player);
virtual shared_ptr<ItemInstance> use(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player);
/*
* public boolean useOn(ItemInstance instance, Player player, Level level,

View File

@@ -58,7 +58,7 @@ bool BonusChestFeature::place(Level *level, Random *random, int x, int y, int z,
if (force || ( level->isEmptyTile(x2, y2, z2) && level->isTopSolidBlocking(x2, y2 - 1, z2)))
{
level->setTile(x2, y2, z2, Tile::chest_Id);
std::shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x2, y2, z2));
shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x2, y2, z2));
if (chest != NULL)
{
WeighedTreasure::addChestItems(random, treasureList, chest, numRolls);

View File

@@ -6,7 +6,7 @@ BookItem::BookItem(int id) : Item(id)
{
}
bool BookItem::isEnchantable(std::shared_ptr<ItemInstance> itemInstance)
bool BookItem::isEnchantable(shared_ptr<ItemInstance> itemInstance)
{
return itemInstance->count == 1;
}

View File

@@ -7,6 +7,6 @@ class BookItem : public Item
public:
BookItem(int id);
bool isEnchantable(std::shared_ptr<ItemInstance> itemInstance);
bool isEnchantable(shared_ptr<ItemInstance> itemInstance);
int getEnchantmentValue();
};

View File

@@ -6,7 +6,7 @@
BossMob::BossMob(Level *level) : Mob( level )
{
maxHealth = 100;
// 4J Stu - This function call had to be moved here from the Entity ctor to ensure that the derived version of the function is called
@@ -18,7 +18,7 @@ int BossMob::getMaxHealth()
return maxHealth;
}
bool BossMob::hurt(std::shared_ptr<BossMobPart> bossMobPart, DamageSource *source, int damage)
bool BossMob::hurt(shared_ptr<BossMobPart> bossMobPart, DamageSource *source, int damage)
{
return hurt(source, damage);
}

View File

@@ -14,7 +14,7 @@ public:
BossMob(Level *level);
virtual int getMaxHealth();
virtual bool hurt(std::shared_ptr<BossMobPart> bossMobPart, DamageSource *source, int damage);
virtual bool hurt(shared_ptr<BossMobPart> bossMobPart, DamageSource *source, int damage);
virtual bool hurt(DamageSource *source, int damage);
protected:

View File

@@ -37,7 +37,7 @@ bool BossMobPart::hurt(DamageSource *source, int damage)
return bossMob->hurt( dynamic_pointer_cast<BossMobPart>( shared_from_this() ), source, damage);
}
bool BossMobPart::is(std::shared_ptr<Entity> other)
bool BossMobPart::is(shared_ptr<Entity> other)
{
return shared_from_this() == other || bossMob == other.get();
}

View File

@@ -23,5 +23,5 @@ protected:
public:
virtual bool isPickable();
virtual bool hurt(DamageSource *source, int damage);
virtual bool is(std::shared_ptr<Entity> other);
virtual bool is(shared_ptr<Entity> other);
};

View File

@@ -15,7 +15,7 @@ Icon *BottleItem::getIcon(int auxValue)
return Item::potion->getIcon(0);
}
std::shared_ptr<ItemInstance> BottleItem::use(std::shared_ptr<ItemInstance> itemInstance, Level *level, std::shared_ptr<Player> player)
shared_ptr<ItemInstance> BottleItem::use(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player)
{
HitResult *hr = getPlayerPOVHitResult(level, player, true);
if (hr == NULL) return itemInstance;
@@ -40,13 +40,13 @@ std::shared_ptr<ItemInstance> BottleItem::use(std::shared_ptr<ItemInstance> item
itemInstance->count--;
if (itemInstance->count <= 0)
{
return std::shared_ptr<ItemInstance>( new ItemInstance( (Item *)Item::potion) );
return shared_ptr<ItemInstance>( new ItemInstance( (Item *)Item::potion) );
}
else
{
if (!player->inventory->add(std::shared_ptr<ItemInstance>( new ItemInstance( (Item *)Item::potion) )))
if (!player->inventory->add(shared_ptr<ItemInstance>( new ItemInstance( (Item *)Item::potion) )))
{
player->drop( std::shared_ptr<ItemInstance>( new ItemInstance(Item::potion_Id, 1, 0) ));
player->drop( shared_ptr<ItemInstance>( new ItemInstance(Item::potion_Id, 1, 0) ));
}
}
}
@@ -60,7 +60,7 @@ std::shared_ptr<ItemInstance> BottleItem::use(std::shared_ptr<ItemInstance> item
}
// 4J-PB - added to allow tooltips
bool BottleItem::TestUse(Level *level, std::shared_ptr<Player> player)
bool BottleItem::TestUse(Level *level, shared_ptr<Player> player)
{
HitResult *hr = getPlayerPOVHitResult(level, player, true);
if (hr == NULL) return false;

View File

@@ -12,8 +12,8 @@ public:
//@Override
Icon *getIcon(int auxValue);
virtual std::shared_ptr<ItemInstance> use(std::shared_ptr<ItemInstance> itemInstance, Level *level, std::shared_ptr<Player> player);
virtual bool TestUse(Level *level, std::shared_ptr<Player> player);
virtual shared_ptr<ItemInstance> use(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player);
virtual bool TestUse(Level *level, shared_ptr<Player> player);
//@Override
void registerIcons(IconRegister *iconRegister);

View File

@@ -18,7 +18,7 @@ BowItem::BowItem(int id) : Item( id )
icons = NULL;
}
void BowItem::releaseUsing(std::shared_ptr<ItemInstance> itemInstance, Level *level, std::shared_ptr<Player> player, int durationLeft)
void BowItem::releaseUsing(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player, int durationLeft)
{
bool infiniteArrows = player->abilities.instabuild || EnchantmentHelper::getEnchantmentLevel(Enchantment::arrowInfinite->id, itemInstance) > 0;
@@ -30,7 +30,7 @@ void BowItem::releaseUsing(std::shared_ptr<ItemInstance> itemInstance, Level *le
if (pow < 0.1) return;
if (pow > 1) pow = 1;
std::shared_ptr<Arrow> arrow = std::shared_ptr<Arrow>( new Arrow(level, player, pow * 2.0f) );
shared_ptr<Arrow> arrow = shared_ptr<Arrow>( new Arrow(level, player, pow * 2.0f) );
if (pow == 1) arrow->setCritArrow(true);
int damageBonus = EnchantmentHelper::getEnchantmentLevel(Enchantment::arrowBonus->id, itemInstance);
if (damageBonus > 0)
@@ -62,22 +62,22 @@ void BowItem::releaseUsing(std::shared_ptr<ItemInstance> itemInstance, Level *le
}
}
std::shared_ptr<ItemInstance> BowItem::useTimeDepleted(std::shared_ptr<ItemInstance> instance, Level *level, std::shared_ptr<Player> player)
shared_ptr<ItemInstance> BowItem::useTimeDepleted(shared_ptr<ItemInstance> instance, Level *level, shared_ptr<Player> player)
{
return instance;
}
int BowItem::getUseDuration(std::shared_ptr<ItemInstance> itemInstance)
int BowItem::getUseDuration(shared_ptr<ItemInstance> itemInstance)
{
return 20 * 60 * 60;
}
UseAnim BowItem::getUseAnimation(std::shared_ptr<ItemInstance> itemInstance)
UseAnim BowItem::getUseAnimation(shared_ptr<ItemInstance> itemInstance)
{
return UseAnim_bow;
}
std::shared_ptr<ItemInstance> BowItem::use(std::shared_ptr<ItemInstance> instance, Level *level, std::shared_ptr<Player> player)
shared_ptr<ItemInstance> BowItem::use(shared_ptr<ItemInstance> instance, Level *level, shared_ptr<Player> player)
{
if (player->abilities.instabuild || player->inventory->hasResource(Item::arrow_Id))
{

View File

@@ -18,11 +18,11 @@ private:
public:
BowItem(int id);
virtual void releaseUsing(std::shared_ptr<ItemInstance> itemInstance, Level *level, std::shared_ptr<Player> player, int durationLeft);
virtual std::shared_ptr<ItemInstance> useTimeDepleted(std::shared_ptr<ItemInstance> instance, Level *level, std::shared_ptr<Player> player);
virtual int getUseDuration(std::shared_ptr<ItemInstance> itemInstance);
virtual UseAnim getUseAnimation(std::shared_ptr<ItemInstance> itemInstance);
virtual std::shared_ptr<ItemInstance> use(std::shared_ptr<ItemInstance> instance, Level *level, std::shared_ptr<Player> player);
virtual void releaseUsing(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player, int durationLeft);
virtual shared_ptr<ItemInstance> useTimeDepleted(shared_ptr<ItemInstance> instance, Level *level, shared_ptr<Player> player);
virtual int getUseDuration(shared_ptr<ItemInstance> itemInstance);
virtual UseAnim getUseAnimation(shared_ptr<ItemInstance> itemInstance);
virtual shared_ptr<ItemInstance> use(shared_ptr<ItemInstance> instance, Level *level, shared_ptr<Player> player);
virtual int getEnchantmentValue();
//@Override

View File

@@ -8,9 +8,9 @@ BowlFoodItem::BowlFoodItem(int id, int nutrition) : FoodItem( id, nutrition, fal
setMaxStackSize(1);
}
std::shared_ptr<ItemInstance> BowlFoodItem::useTimeDepleted(std::shared_ptr<ItemInstance> instance, Level *level, std::shared_ptr<Player> player)
shared_ptr<ItemInstance> BowlFoodItem::useTimeDepleted(shared_ptr<ItemInstance> instance, Level *level, shared_ptr<Player> player)
{
FoodItem::useTimeDepleted(instance, level, player);
return std::shared_ptr<ItemInstance>(new ItemInstance(Item::bowl));
return shared_ptr<ItemInstance>(new ItemInstance(Item::bowl));
}

View File

@@ -10,5 +10,5 @@ class BowlFoodItem : public FoodItem
public:
BowlFoodItem(int id, int nutrition);
std::shared_ptr<ItemInstance> useTimeDepleted(std::shared_ptr<ItemInstance> instance, Level *level, std::shared_ptr<Player> player);
shared_ptr<ItemInstance> useTimeDepleted(shared_ptr<ItemInstance> instance, Level *level, shared_ptr<Player> player);
};

View File

@@ -46,13 +46,13 @@ void BreedGoal::tick()
if (loveTime == 20 * 3) breed();
}
std::shared_ptr<Animal> BreedGoal::getFreePartner()
shared_ptr<Animal> BreedGoal::getFreePartner()
{
float r = 8;
vector<std::shared_ptr<Entity> > *others = level->getEntitiesOfClass(typeid(*animal), animal->bb->grow(r, r, r));
vector<shared_ptr<Entity> > *others = level->getEntitiesOfClass(typeid(*animal), animal->bb->grow(r, r, r));
for(AUTO_VAR(it, others->begin()); it != others->end(); ++it)
{
std::shared_ptr<Animal> p = dynamic_pointer_cast<Animal>(*it);
shared_ptr<Animal> p = dynamic_pointer_cast<Animal>(*it);
if (animal->canMate(p))
{
delete others;
@@ -65,7 +65,7 @@ std::shared_ptr<Animal> BreedGoal::getFreePartner()
void BreedGoal::breed()
{
std::shared_ptr<AgableMob> offspring = animal->getBreedOffspring(partner.lock());
shared_ptr<AgableMob> offspring = animal->getBreedOffspring(partner.lock());
animal->setDespawnProtected();
partner.lock()->setDespawnProtected();
if (offspring == NULL)
@@ -76,7 +76,7 @@ void BreedGoal::breed()
return;
}
std::shared_ptr<Player> loveCause = animal->getLoveCause();
shared_ptr<Player> loveCause = animal->getLoveCause();
if (loveCause == NULL && partner.lock()->getLoveCause() != NULL)
{
loveCause = partner.lock()->getLoveCause();
@@ -112,5 +112,5 @@ void BreedGoal::breed()
* animal->bbWidth * 2 - animal->bbWidth, xa, ya, za);
}
// 4J-PB - Fix for 106869- Customer Encountered: TU12: Content: Gameplay: Breeding animals does not give any Experience Orbs.
level->addEntity( std::shared_ptr<ExperienceOrb>( new ExperienceOrb(level, animal->x, animal->y, animal->z, random->nextInt(7) + 1) ) );
level->addEntity( shared_ptr<ExperienceOrb>( new ExperienceOrb(level, animal->x, animal->y, animal->z, random->nextInt(7) + 1) ) );
}

View File

@@ -23,7 +23,7 @@ public:
virtual void tick();
private:
std::shared_ptr<Animal> getFreePartner();
shared_ptr<Animal> getFreePartner();
void breed();
public:

View File

@@ -6,7 +6,7 @@
#include "net.minecraft.stats.h"
#include "BrewingStandMenu.h"
BrewingStandMenu::BrewingStandMenu(std::shared_ptr<Inventory> inventory, std::shared_ptr<BrewingStandTileEntity> brewingStand)
BrewingStandMenu::BrewingStandMenu(shared_ptr<Inventory> inventory, shared_ptr<BrewingStandTileEntity> brewingStand)
{
tc = 0;
@@ -57,14 +57,14 @@ void BrewingStandMenu::setData(int id, int value)
if (id == 0) brewingStand->setBrewTime(value);
}
bool BrewingStandMenu::stillValid(std::shared_ptr<Player> player)
bool BrewingStandMenu::stillValid(shared_ptr<Player> player)
{
return brewingStand->stillValid(player);
}
std::shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(std::shared_ptr<Player> player, int slotIndex)
shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(shared_ptr<Player> player, int slotIndex)
{
std::shared_ptr<ItemInstance> clicked = nullptr;
shared_ptr<ItemInstance> clicked = nullptr;
Slot *slot = slots->at(slotIndex);
Slot *IngredientSlot = slots->at(INGREDIENT_SLOT);
Slot *PotionSlot1 = slots->at(BOTTLE_SLOT_START);
@@ -73,7 +73,7 @@ std::shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(std::shared_ptr<P
if (slot != NULL && slot->hasItem())
{
std::shared_ptr<ItemInstance> stack = slot->getItem();
shared_ptr<ItemInstance> stack = slot->getItem();
clicked = stack->copy();
if ((slotIndex >= BOTTLE_SLOT_START && slotIndex <= BOTTLE_SLOT_END) || (slotIndex == INGREDIENT_SLOT))
@@ -101,7 +101,7 @@ std::shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(std::shared_ptr<P
else if (slotIndex >= INV_SLOT_START && slotIndex < INV_SLOT_END)
{
// 4J-PB - if the item is an ingredient, quickmove it into the ingredient slot
if( (Item::items[stack->id]->hasPotionBrewingFormula() || (stack->id == Item::netherStalkSeeds_Id) ) &&
if( (Item::items[stack->id]->hasPotionBrewingFormula() || (stack->id == Item::netherStalkSeeds_Id) ) &&
(!IngredientSlot->hasItem() || (stack->id==IngredientSlot->getItem()->id) ) )
{
if(!moveItemStackTo(stack, INGREDIENT_SLOT, INGREDIENT_SLOT+1, false))
@@ -125,7 +125,7 @@ std::shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(std::shared_ptr<P
else if (slotIndex >= USE_ROW_SLOT_START && slotIndex < USE_ROW_SLOT_END)
{
// 4J-PB - if the item is an ingredient, quickmove it into the ingredient slot
if((Item::items[stack->id]->hasPotionBrewingFormula() || (stack->id == Item::netherStalkSeeds_Id)) &&
if((Item::items[stack->id]->hasPotionBrewingFormula() || (stack->id == Item::netherStalkSeeds_Id)) &&
(!IngredientSlot->hasItem() || (stack->id==IngredientSlot->getItem()->id) ))
{
if(!moveItemStackTo(stack, INGREDIENT_SLOT, INGREDIENT_SLOT+1, false))
@@ -140,7 +140,7 @@ std::shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(std::shared_ptr<P
{
return nullptr;
}
}
}
else if (!moveItemStackTo(stack, INV_SLOT_START, INV_SLOT_END, false))
{
return nullptr;
@@ -173,12 +173,12 @@ std::shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(std::shared_ptr<P
return clicked;
}
BrewingStandMenu::PotionSlot::PotionSlot(std::shared_ptr<Player> player, std::shared_ptr<Container> container, int slot, int x, int y) : Slot(container, slot, x, y)
BrewingStandMenu::PotionSlot::PotionSlot(shared_ptr<Player> player, shared_ptr<Container> container, int slot, int x, int y) : Slot(container, slot, x, y)
{
this->player = player;
}
bool BrewingStandMenu::PotionSlot::mayPlace(std::shared_ptr<ItemInstance> item)
bool BrewingStandMenu::PotionSlot::mayPlace(shared_ptr<ItemInstance> item)
{
return mayPlaceItem(item);
}
@@ -188,7 +188,7 @@ int BrewingStandMenu::PotionSlot::getMaxStackSize()
return 1;
}
void BrewingStandMenu::PotionSlot::onTake(std::shared_ptr<Player> player, std::shared_ptr<ItemInstance> carried)
void BrewingStandMenu::PotionSlot::onTake(shared_ptr<Player> player, shared_ptr<ItemInstance> carried)
{
carried->onCraftedBy(this->player->level, dynamic_pointer_cast<Player>( this->player->shared_from_this() ), 1);
if (carried->id == Item::potion_Id && carried->getAuxValue() > 0)
@@ -196,23 +196,23 @@ void BrewingStandMenu::PotionSlot::onTake(std::shared_ptr<Player> player, std::s
Slot::onTake(player, carried);
}
bool BrewingStandMenu::PotionSlot::mayCombine(std::shared_ptr<ItemInstance> second)
bool BrewingStandMenu::PotionSlot::mayCombine(shared_ptr<ItemInstance> second)
{
return false;
}
bool BrewingStandMenu::PotionSlot::mayPlaceItem(std::shared_ptr<ItemInstance> item)
bool BrewingStandMenu::PotionSlot::mayPlaceItem(shared_ptr<ItemInstance> item)
{
return item != NULL && (item->id == Item::potion_Id || item->id == Item::glassBottle_Id);
}
BrewingStandMenu::IngredientsSlot::IngredientsSlot(std::shared_ptr<Container> container, int slot, int x, int y) : Slot(container, slot, x ,y)
BrewingStandMenu::IngredientsSlot::IngredientsSlot(shared_ptr<Container> container, int slot, int x, int y) : Slot(container, slot, x ,y)
{
}
bool BrewingStandMenu::IngredientsSlot::mayPlace(std::shared_ptr<ItemInstance> item)
bool BrewingStandMenu::IngredientsSlot::mayPlace(shared_ptr<ItemInstance> item)
{
if (item != NULL)
{
@@ -228,7 +228,7 @@ bool BrewingStandMenu::IngredientsSlot::mayPlace(std::shared_ptr<ItemInstance> i
return false;
}
bool BrewingStandMenu::IngredientsSlot::mayCombine(std::shared_ptr<ItemInstance> second)
bool BrewingStandMenu::IngredientsSlot::mayCombine(shared_ptr<ItemInstance> second)
{
return false;
}

View File

@@ -21,11 +21,11 @@ public:
static const int USE_ROW_SLOT_END = USE_ROW_SLOT_START + 9;
private:
std::shared_ptr<BrewingStandTileEntity> brewingStand;
shared_ptr<BrewingStandTileEntity> brewingStand;
Slot *ingredientSlot;
public:
BrewingStandMenu(std::shared_ptr<Inventory> inventory, std::shared_ptr<BrewingStandTileEntity> brewingStand);
BrewingStandMenu(shared_ptr<Inventory> inventory, shared_ptr<BrewingStandTileEntity> brewingStand);
private:
int tc;
@@ -34,32 +34,32 @@ public:
virtual void addSlotListener(ContainerListener *listener);
virtual void broadcastChanges();
virtual void setData(int id, int value);
virtual bool stillValid(std::shared_ptr<Player> player);
virtual std::shared_ptr<ItemInstance> quickMoveStack(std::shared_ptr<Player> player, int slotIndex);
virtual bool stillValid(shared_ptr<Player> player);
virtual shared_ptr<ItemInstance> quickMoveStack(shared_ptr<Player> player, int slotIndex);
private:
class PotionSlot : public Slot
{
private:
std::shared_ptr<Player> player;
shared_ptr<Player> player;
public:
PotionSlot(std::shared_ptr<Player> player, std::shared_ptr<Container> container, int slot, int x, int y);
PotionSlot(shared_ptr<Player> player, shared_ptr<Container> container, int slot, int x, int y);
virtual bool mayPlace(std::shared_ptr<ItemInstance> item);
virtual bool mayPlace(shared_ptr<ItemInstance> item);
virtual int getMaxStackSize();
virtual void onTake(std::shared_ptr<Player> player, std::shared_ptr<ItemInstance> carried);
static bool mayPlaceItem(std::shared_ptr<ItemInstance> item);
virtual bool mayCombine(std::shared_ptr<ItemInstance> item); // 4J Added
virtual void onTake(shared_ptr<Player> player, shared_ptr<ItemInstance> carried);
static bool mayPlaceItem(shared_ptr<ItemInstance> item);
virtual bool mayCombine(shared_ptr<ItemInstance> item); // 4J Added
};
class IngredientsSlot : public Slot
{
public:
IngredientsSlot(std::shared_ptr<Container> container, int slot, int x, int y);
IngredientsSlot(shared_ptr<Container> container, int slot, int x, int y);
virtual bool mayPlace(std::shared_ptr<ItemInstance> item);
virtual bool mayPlace(shared_ptr<ItemInstance> item);
virtual int getMaxStackSize();
virtual bool mayCombine(std::shared_ptr<ItemInstance> item); // 4J Added
virtual bool mayCombine(shared_ptr<ItemInstance> item); // 4J Added
};
};

View File

@@ -29,9 +29,9 @@ int BrewingStandTile::getRenderShape()
return SHAPE_BREWING_STAND;
}
std::shared_ptr<TileEntity> BrewingStandTile::newTileEntity(Level *level)
shared_ptr<TileEntity> BrewingStandTile::newTileEntity(Level *level)
{
return std::shared_ptr<TileEntity>(new BrewingStandTileEntity());
return shared_ptr<TileEntity>(new BrewingStandTileEntity());
}
bool BrewingStandTile::isCubeShaped()
@@ -39,7 +39,7 @@ bool BrewingStandTile::isCubeShaped()
return false;
}
void BrewingStandTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr<Entity> source)
void BrewingStandTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr<Entity> source)
{
setShape(7.0f / 16.0f, 0, 7.0f / 16.0f, 9.0f / 16.0f, 14.0f / 16.0f, 9.0f / 16.0f);
EntityTile::addAABBs(level, x, y, z, box, boxes, source);
@@ -52,7 +52,7 @@ void BrewingStandTile::updateDefaultShape()
setShape(0, 0, 0, 1, 2.0f / 16.0f, 1);
}
bool BrewingStandTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
bool BrewingStandTile::use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
{
if(soundOnly) return false;
@@ -60,7 +60,7 @@ bool BrewingStandTile::use(Level *level, int x, int y, int z, std::shared_ptr<Pl
{
return true;
}
std::shared_ptr<BrewingStandTileEntity> brewingStand = dynamic_pointer_cast<BrewingStandTileEntity>(level->getTileEntity(x, y, z));
shared_ptr<BrewingStandTileEntity> brewingStand = dynamic_pointer_cast<BrewingStandTileEntity>(level->getTileEntity(x, y, z));
if (brewingStand != NULL) player->openBrewingStand(brewingStand);
return true;
@@ -78,13 +78,13 @@ void BrewingStandTile::animateTick(Level *level, int xt, int yt, int zt, Random
void BrewingStandTile::onRemove(Level *level, int x, int y, int z, int id, int data)
{
std::shared_ptr<TileEntity> tileEntity = level->getTileEntity(x, y, z);
shared_ptr<TileEntity> tileEntity = level->getTileEntity(x, y, z);
if (tileEntity != NULL && ( dynamic_pointer_cast<BrewingStandTileEntity>(tileEntity) != NULL) )
{
std::shared_ptr<BrewingStandTileEntity> container = dynamic_pointer_cast<BrewingStandTileEntity>(tileEntity);
shared_ptr<BrewingStandTileEntity> container = dynamic_pointer_cast<BrewingStandTileEntity>(tileEntity);
for (int i = 0; i < container->getContainerSize(); i++)
{
std::shared_ptr<ItemInstance> item = container->getItem(i);
shared_ptr<ItemInstance> item = container->getItem(i);
if (item != NULL)
{
float xo = random->nextFloat() * 0.8f + 0.1f;
@@ -97,7 +97,7 @@ void BrewingStandTile::onRemove(Level *level, int x, int y, int z, int id, int d
if (count > item->count) count = item->count;
item->count -= count;
std::shared_ptr<ItemEntity> itemEntity = std::shared_ptr<ItemEntity>(new ItemEntity(level, x + xo, y + yo, z + zo, std::shared_ptr<ItemInstance>( new ItemInstance(item->id, count, item->getAuxValue()))));
shared_ptr<ItemEntity> itemEntity = shared_ptr<ItemEntity>(new ItemEntity(level, x + xo, y + yo, z + zo, shared_ptr<ItemInstance>( new ItemInstance(item->id, count, item->getAuxValue()))));
float pow = 0.05f;
itemEntity->xd = (float) random->nextGaussian() * pow;
itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f;

View File

@@ -18,11 +18,11 @@ public:
~BrewingStandTile();
virtual bool isSolidRender(bool isServerLevel = false);
virtual int getRenderShape();
virtual std::shared_ptr<TileEntity> newTileEntity(Level *level);
virtual shared_ptr<TileEntity> newTileEntity(Level *level);
virtual bool isCubeShaped();
virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr<Entity> source);
virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr<Entity> source);
virtual void updateDefaultShape();
virtual bool use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param
virtual bool use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param
virtual void animateTick(Level *level, int xt, int yt, int zt, Random *random);
virtual void onRemove(Level *level, int x, int y, int z, int id, int data);
virtual int getResource(int data, Random *random, int playerBonusLevel);

View File

@@ -79,7 +79,7 @@ bool BrewingStandTileEntity::isBrewable()
{
return false;
}
std::shared_ptr<ItemInstance> ingredient = items[INGREDIENT_SLOT];
shared_ptr<ItemInstance> ingredient = items[INGREDIENT_SLOT];
if (PotionBrewing::SIMPLIFIED_BREWING)
{
if (!Item::items[ingredient->id]->hasPotionBrewingFormula())
@@ -135,7 +135,7 @@ bool BrewingStandTileEntity::isBrewable()
}
else
{
if (!Item::items[ingredient->id]->hasPotionBrewingFormula() && ingredient->id != Item::bucket_water_Id && ingredient->id != Item::netherStalkSeeds_Id)
if (!Item::items[ingredient->id]->hasPotionBrewingFormula() && ingredient->id != Item::bucket_water_Id && ingredient->id != Item::netherStalkSeeds_Id)
{
return false;
}
@@ -172,7 +172,7 @@ void BrewingStandTileEntity::doBrew()
return;
}
std::shared_ptr<ItemInstance> ingredient = items[INGREDIENT_SLOT];
shared_ptr<ItemInstance> ingredient = items[INGREDIENT_SLOT];
if (PotionBrewing::SIMPLIFIED_BREWING)
{
@@ -233,14 +233,14 @@ void BrewingStandTileEntity::doBrew()
}
else if (isWater && items[dest] != NULL && items[dest]->id == Item::glassBottle_Id)
{
items[dest] = std::shared_ptr<ItemInstance>(new ItemInstance(Item::potion));
items[dest] = shared_ptr<ItemInstance>(new ItemInstance(Item::potion));
}
}
}
if (Item::items[ingredient->id]->hasCraftingRemainingItem())
{
items[INGREDIENT_SLOT] = std::shared_ptr<ItemInstance>(new ItemInstance(Item::items[ingredient->id]->getCraftingRemainingItem()));
items[INGREDIENT_SLOT] = shared_ptr<ItemInstance>(new ItemInstance(Item::items[ingredient->id]->getCraftingRemainingItem()));
}
else
{
@@ -252,7 +252,7 @@ void BrewingStandTileEntity::doBrew()
}
}
int BrewingStandTileEntity::applyIngredient(int currentBrew, std::shared_ptr<ItemInstance> ingredient)
int BrewingStandTileEntity::applyIngredient(int currentBrew, shared_ptr<ItemInstance> ingredient)
{
if (ingredient == NULL)
{
@@ -278,7 +278,7 @@ int BrewingStandTileEntity::applyIngredient(int currentBrew, std::shared_ptr<Ite
}
return currentBrew;
}
void BrewingStandTileEntity::load(CompoundTag *base)
{
TileEntity::load(base);
@@ -305,7 +305,7 @@ void BrewingStandTileEntity::save(CompoundTag *base)
for (int i = 0; i < items.length; i++)
{
if (items[i] != NULL)
if (items[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) i);
@@ -316,7 +316,7 @@ void BrewingStandTileEntity::save(CompoundTag *base)
base->put(L"Items", listTag);
}
std::shared_ptr<ItemInstance> BrewingStandTileEntity::getItem(unsigned int slot)
shared_ptr<ItemInstance> BrewingStandTileEntity::getItem(unsigned int slot)
{
if (slot >= 0 && slot < items.length)
{
@@ -325,7 +325,7 @@ std::shared_ptr<ItemInstance> BrewingStandTileEntity::getItem(unsigned int slot)
return nullptr;
}
std::shared_ptr<ItemInstance> BrewingStandTileEntity::removeItem(unsigned int slot, int count)
shared_ptr<ItemInstance> BrewingStandTileEntity::removeItem(unsigned int slot, int count)
{
// 4J Stu - Changed the implementation of this function to be the same as ChestTileEntity to enable the "Pickup Half"
// option on the ingredients slot
@@ -333,18 +333,18 @@ std::shared_ptr<ItemInstance> BrewingStandTileEntity::removeItem(unsigned int sl
if (slot >= 0 && slot < items.length && items[slot] != NULL)
{
if (items[slot]->count <= count)
if (items[slot]->count <= count)
{
std::shared_ptr<ItemInstance> item = items[slot];
shared_ptr<ItemInstance> item = items[slot];
items[slot] = nullptr;
this->setChanged();
// 4J Stu - Fix for duplication glitch
if(item->count <= 0) return nullptr;
return item;
}
else
}
else
{
std::shared_ptr<ItemInstance> i = items[slot]->remove(count);
shared_ptr<ItemInstance> i = items[slot]->remove(count);
if (items[slot]->count == 0) items[slot] = nullptr;
this->setChanged();
// 4J Stu - Fix for duplication glitch
@@ -354,19 +354,19 @@ std::shared_ptr<ItemInstance> BrewingStandTileEntity::removeItem(unsigned int sl
}
return nullptr;
}
std::shared_ptr<ItemInstance> BrewingStandTileEntity::removeItemNoUpdate(int slot)
shared_ptr<ItemInstance> BrewingStandTileEntity::removeItemNoUpdate(int slot)
{
if (slot >= 0 && slot < items.length)
{
std::shared_ptr<ItemInstance> item = items[slot];
shared_ptr<ItemInstance> item = items[slot];
items[slot] = nullptr;
return item;
}
return nullptr;
}
void BrewingStandTileEntity::setItem(unsigned int slot, std::shared_ptr<ItemInstance> item)
void BrewingStandTileEntity::setItem(unsigned int slot, shared_ptr<ItemInstance> item)
{
if (slot >= 0 && slot < items.length)
{
@@ -379,7 +379,7 @@ int BrewingStandTileEntity::getMaxStackSize()
return 1;
}
bool BrewingStandTileEntity::stillValid(std::shared_ptr<Player> player)
bool BrewingStandTileEntity::stillValid(shared_ptr<Player> player)
{
if (level->getTileEntity(x, y, z) != shared_from_this()) return false;
if (player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 8 * 8) return false;
@@ -413,9 +413,9 @@ int BrewingStandTileEntity::getPotionBits()
}
// 4J Added
std::shared_ptr<TileEntity> BrewingStandTileEntity::clone()
shared_ptr<TileEntity> BrewingStandTileEntity::clone()
{
std::shared_ptr<BrewingStandTileEntity> result = std::shared_ptr<BrewingStandTileEntity>( new BrewingStandTileEntity() );
shared_ptr<BrewingStandTileEntity> result = shared_ptr<BrewingStandTileEntity>( new BrewingStandTileEntity() );
TileEntity::clone(result);
result->brewTime = brewTime;

View File

@@ -29,17 +29,17 @@ private:
bool isBrewable();
void doBrew();
int applyIngredient(int currentBrew, std::shared_ptr<ItemInstance> ingredient);
int applyIngredient(int currentBrew, shared_ptr<ItemInstance> ingredient);
public:
virtual void load(CompoundTag *base);
virtual void save(CompoundTag *base);
virtual std::shared_ptr<ItemInstance> getItem(unsigned int slot);
virtual std::shared_ptr<ItemInstance> removeItem(unsigned int slot, int i);
virtual std::shared_ptr<ItemInstance> removeItemNoUpdate(int slot);
virtual void setItem(unsigned int slot, std::shared_ptr<ItemInstance> item);
virtual shared_ptr<ItemInstance> getItem(unsigned int slot);
virtual shared_ptr<ItemInstance> removeItem(unsigned int slot, int i);
virtual shared_ptr<ItemInstance> removeItemNoUpdate(int slot);
virtual void setItem(unsigned int slot, shared_ptr<ItemInstance> item);
virtual int getMaxStackSize();
virtual bool stillValid(std::shared_ptr<Player> player);
virtual bool stillValid(shared_ptr<Player> player);
virtual void startOpen();
virtual void stopOpen();
virtual void setBrewTime(int value);
@@ -47,5 +47,5 @@ public:
int getPotionBits();
// 4J Added
virtual std::shared_ptr<TileEntity> clone();
virtual shared_ptr<TileEntity> clone();
};

View File

@@ -24,7 +24,7 @@ BucketItem::BucketItem(int id, int content) : Item( id )
this->content = content;
}
bool BucketItem::TestUse(Level *level, std::shared_ptr<Player> player)
bool BucketItem::TestUse(Level *level, shared_ptr<Player> player)
{
// double x = player->xo + (player->x - player->xo);
// double y = player->yo + (player->y - player->yo) + 1.62 - player->heightOffset;
@@ -47,7 +47,7 @@ bool BucketItem::TestUse(Level *level, std::shared_ptr<Player> player)
}
if (content == 0)
{
{
if (!player->mayBuild(xt, yt, zt)) return false;
if (level->getMaterial(xt, yt, zt) == Material::water && level->getData(xt, yt, zt) == 0)
{
@@ -73,7 +73,7 @@ bool BucketItem::TestUse(Level *level, std::shared_ptr<Player> player)
if (hr->f == 3) zt++;
if (hr->f == 4) xt--;
if (hr->f == 5) xt++;
if (!player->mayBuild(xt, yt, zt)) return false;
if (level->isEmptyTile(xt, yt, zt) || !level->getMaterial(xt, yt, zt)->isSolid())
@@ -99,7 +99,7 @@ bool BucketItem::TestUse(Level *level, std::shared_ptr<Player> player)
return false;
}
std::shared_ptr<ItemInstance> BucketItem::use(std::shared_ptr<ItemInstance> itemInstance, Level *level, std::shared_ptr<Player> player)
shared_ptr<ItemInstance> BucketItem::use(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player)
{
float a = 1;
@@ -120,19 +120,19 @@ std::shared_ptr<ItemInstance> BucketItem::use(std::shared_ptr<ItemInstance> item
if (!level->mayInteract(player, xt, yt, zt,content))
{
app.DebugPrintf("!!!!!!!!!!! Can't place that here\n");
std::shared_ptr<ServerPlayer> servPlayer = dynamic_pointer_cast<ServerPlayer>(player);
shared_ptr<ServerPlayer> servPlayer = dynamic_pointer_cast<ServerPlayer>(player);
if( servPlayer != NULL )
{
app.DebugPrintf("Sending ChatPacket::e_ChatCannotPlaceLava to player\n");
servPlayer->connection->send( std::shared_ptr<ChatPacket>( new ChatPacket(L"", ChatPacket::e_ChatCannotPlaceLava ) ) );
servPlayer->connection->send( shared_ptr<ChatPacket>( new ChatPacket(L"", ChatPacket::e_ChatCannotPlaceLava ) ) );
}
delete hr;
return itemInstance;
}
if (content == 0)
{
{
if (!player->mayBuild(xt, yt, zt)) return itemInstance;
if (level->getMaterial(xt, yt, zt) == Material::water && level->getData(xt, yt, zt) == 0)
{
@@ -145,13 +145,13 @@ std::shared_ptr<ItemInstance> BucketItem::use(std::shared_ptr<ItemInstance> item
if (--itemInstance->count <= 0)
{
return std::shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_water) );
return shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_water) );
}
else
{
if (!player->inventory->add(std::shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_water))))
if (!player->inventory->add(shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_water))))
{
player->drop(std::shared_ptr<ItemInstance>(new ItemInstance(Item::bucket_water_Id, 1, 0)));
player->drop(shared_ptr<ItemInstance>(new ItemInstance(Item::bucket_water_Id, 1, 0)));
}
return itemInstance;
}
@@ -160,7 +160,7 @@ std::shared_ptr<ItemInstance> BucketItem::use(std::shared_ptr<ItemInstance> item
{
if( level->dimension->id == -1 )
player->awardStat(
GenericStats::netherLavaCollected(),
GenericStats::netherLavaCollected(),
GenericStats::param_noArgs()
);
@@ -172,13 +172,13 @@ std::shared_ptr<ItemInstance> BucketItem::use(std::shared_ptr<ItemInstance> item
}
if (--itemInstance->count <= 0)
{
return std::shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_lava) );
return shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_lava) );
}
else
{
if (!player->inventory->add(std::shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_lava))))
if (!player->inventory->add(shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_lava))))
{
player->drop(std::shared_ptr<ItemInstance>(new ItemInstance(Item::bucket_lava_Id, 1, 0)));
player->drop(shared_ptr<ItemInstance>(new ItemInstance(Item::bucket_lava_Id, 1, 0)));
}
return itemInstance;
}
@@ -187,7 +187,7 @@ std::shared_ptr<ItemInstance> BucketItem::use(std::shared_ptr<ItemInstance> item
else if (content < 0)
{
delete hr;
return std::shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_empty) );
return shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_empty) );
}
else
{
@@ -197,13 +197,13 @@ std::shared_ptr<ItemInstance> BucketItem::use(std::shared_ptr<ItemInstance> item
if (hr->f == 3) zt++;
if (hr->f == 4) xt--;
if (hr->f == 5) xt++;
if (!player->mayBuild(xt, yt, zt)) return itemInstance;
if (emptyBucket(level, x, y, z, xt, yt, zt) && !player->abilities.instabuild)
{
return std::shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_empty) );
return shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_empty) );
}
}
@@ -217,13 +217,13 @@ std::shared_ptr<ItemInstance> BucketItem::use(std::shared_ptr<ItemInstance> item
delete hr;
if (--itemInstance->count <= 0)
{
return std::shared_ptr<ItemInstance>( new ItemInstance(Item::milk) );
return shared_ptr<ItemInstance>( new ItemInstance(Item::milk) );
}
else
{
if (!player->inventory->add(std::shared_ptr<ItemInstance>( new ItemInstance(Item::milk))))
if (!player->inventory->add(shared_ptr<ItemInstance>( new ItemInstance(Item::milk))))
{
player->drop(std::shared_ptr<ItemInstance>(new ItemInstance(Item::milk_Id, 1, 0)));
player->drop(shared_ptr<ItemInstance>(new ItemInstance(Item::milk_Id, 1, 0)));
}
return itemInstance;
}
@@ -234,22 +234,22 @@ std::shared_ptr<ItemInstance> BucketItem::use(std::shared_ptr<ItemInstance> item
return itemInstance;
}
bool BucketItem::emptyBucket(Level *level, double x, double y, double z, int xt, int yt, int zt)
bool BucketItem::emptyBucket(Level *level, double x, double y, double z, int xt, int yt, int zt)
{
if (content <= 0) return false;
if (level->isEmptyTile(xt, yt, zt) || !level->getMaterial(xt, yt, zt)->isSolid())
if (level->isEmptyTile(xt, yt, zt) || !level->getMaterial(xt, yt, zt)->isSolid())
{
if (level->dimension->ultraWarm && content == Tile::water_Id)
if (level->dimension->ultraWarm && content == Tile::water_Id)
{
level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, eSoundType_RANDOM_FIZZ, 0.5f, 2.6f + (level->random->nextFloat() - level->random->nextFloat()) * 0.8f);
for (int i = 0; i < 8; i++)
for (int i = 0; i < 8; i++)
{
level->addParticle(eParticleType_largesmoke, xt + Math::random(), yt + Math::random(), zt + Math::random(), 0, 0, 0);
}
}
else
}
else
{
level->setTileAndData(xt, yt, zt, content, 0);
}

View File

@@ -13,8 +13,8 @@ private:
public:
BucketItem(int id, int content);
virtual bool TestUse(Level *level, std::shared_ptr<Player> player);
virtual std::shared_ptr<ItemInstance> use(std::shared_ptr<ItemInstance> itemInstance, Level *level, std::shared_ptr<Player> player);
virtual bool TestUse(Level *level, shared_ptr<Player> player);
virtual shared_ptr<ItemInstance> use(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player);
// TU9
bool emptyBucket(Level *level, double x, double y, double z, int xt, int yt, int zt);

View File

@@ -141,7 +141,7 @@ bool ButtonTile::checkCanSurvive(Level *level, int x, int y, int z)
return true;
}
void ButtonTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr<TileEntity> forceEntity) // 4J added forceData, forceEntity param
void ButtonTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr<TileEntity> forceEntity) // 4J added forceData, forceEntity param
{
int data = level->getData(x, y, z);
updateShape(data);
@@ -176,7 +176,7 @@ void ButtonTile::updateShape(int data)
}
}
void ButtonTile::attack(Level *level, int x, int y, int z, std::shared_ptr<Player> player)
void ButtonTile::attack(Level *level, int x, int y, int z, shared_ptr<Player> player)
{
//use(level, x, y, z, player, 0, 0, 0, 0);
}
@@ -187,7 +187,7 @@ bool ButtonTile::TestUse()
return true;
}
bool ButtonTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
bool ButtonTile::use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
{
if( soundOnly)
{
@@ -279,7 +279,7 @@ void ButtonTile::updateDefaultShape()
setShape(0.5f - x, 0.5f - y, 0.5f - z, 0.5f + x, 0.5f + y, 0.5f + z);
}
void ButtonTile::entityInside(Level *level, int x, int y, int z, std::shared_ptr<Entity> entity)
void ButtonTile::entityInside(Level *level, int x, int y, int z, shared_ptr<Entity> entity)
{
if (level->isClientSide) return;
if (!sensitive) return;
@@ -301,7 +301,7 @@ void ButtonTile::checkPressed(Level *level, int x, int y, int z)
updateShape(data);
Tile::ThreadStorage *tls = (Tile::ThreadStorage *)TlsGetValue(Tile::tlsIdxShape);
vector<std::shared_ptr<Entity> > *entities = level->getEntitiesOfClass(typeid(Arrow), AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1));
vector<shared_ptr<Entity> > *entities = level->getEntitiesOfClass(typeid(Arrow), AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1));
shouldBePressed = !entities->empty();
delete entities;

View File

@@ -37,22 +37,22 @@ private:
bool checkCanSurvive(Level *level, int x, int y, int z);
public:
virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr<TileEntity> forceEntity = std::shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
private:
void updateShape(int data);
public:
virtual void attack(Level *level, int x, int y, int z, std::shared_ptr<Player> player);
virtual void attack(Level *level, int x, int y, int z, shared_ptr<Player> player);
virtual bool TestUse();
virtual bool use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param
virtual bool use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param
virtual void onRemove(Level *level, int x, int y, int z, int id, int data);
virtual bool getSignal(LevelSource *level, int x, int y, int z, int dir);
virtual bool getDirectSignal(Level *level, int x, int y, int z, int dir);
virtual bool isSignalSource();
virtual void tick(Level *level, int x, int y, int z, Random *random);
virtual void updateDefaultShape();
void entityInside(Level *level, int x, int y, int z, std::shared_ptr<Entity> entity);
void entityInside(Level *level, int x, int y, int z, shared_ptr<Entity> entity);
private:
void checkPressed(Level *level, int x, int y, int z);
@@ -60,7 +60,7 @@ private:
public:
void registerIcons(IconRegister *iconRegister);
// 4J Added so we can check before we try to add a tile to the tick list if it's actually going to do seomthing
virtual bool shouldTileTick(Level *level, int x,int y,int z);
};

View File

@@ -18,7 +18,7 @@ CactusTile::CactusTile(int id) : Tile(id, Material::cactus,isSolidRender())
void CactusTile::tick(Level *level, int x, int y, int z, Random *random)
{
if (level->isEmptyTile(x, y + 1, z))
{
{
int height = 1;
while (level->getTile(x, y - height, z) == id)
{
@@ -100,7 +100,7 @@ bool CactusTile::canSurvive(Level *level, int x, int y, int z)
return below == Tile::cactus_Id || below == Tile::sand_Id;
}
void CactusTile::entityInside(Level *level, int x, int y, int z, std::shared_ptr<Entity> entity)
void CactusTile::entityInside(Level *level, int x, int y, int z, shared_ptr<Entity> entity)
{
entity->hurt(DamageSource::cactus, 1);
}

View File

@@ -30,10 +30,10 @@ public:
virtual bool mayPlace(Level *level, int x, int y, int z);
virtual void neighborChanged(Level *level, int x, int y, int z, int type);
virtual bool canSurvive(Level *level, int x, int y, int z);
virtual void entityInside(Level *level, int x, int y, int z, std::shared_ptr<Entity> entity);
virtual void entityInside(Level *level, int x, int y, int z, shared_ptr<Entity> entity);
//@Override
void registerIcons(IconRegister *iconRegister);
// 4J Added so we can check before we try to add a tile to the tick list if it's actually going to do seomthing
virtual bool shouldTileTick(Level *level, int x,int y,int z);
};

View File

@@ -18,7 +18,7 @@ CakeTile::CakeTile(int id) : Tile(id, Material::cake,isSolidRender())
iconInner = NULL;
}
void CakeTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr<TileEntity> forceEntity) // 4J added forceData, forceEntity param
void CakeTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr<TileEntity> forceEntity) // 4J added forceData, forceEntity param
{
int d = level->getData(x, y, z);
float r = 1 / 16.0f;
@@ -84,19 +84,19 @@ bool CakeTile::TestUse()
return true;
}
bool CakeTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
bool CakeTile::use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
{
if( soundOnly ) return false;
eat(level, x, y, z, player);
return true;
}
void CakeTile::attack(Level *level, int x, int y, int z, std::shared_ptr<Player> player)
void CakeTile::attack(Level *level, int x, int y, int z, shared_ptr<Player> player)
{
eat(level, x, y, z, player);
}
void CakeTile::eat(Level *level, int x, int y, int z, std::shared_ptr<Player> player)
void CakeTile::eat(Level *level, int x, int y, int z, shared_ptr<Player> player)
{
if (player->canEat(false))
{

View File

@@ -20,7 +20,7 @@ private:
protected:
CakeTile(int id);
virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr<TileEntity> forceEntity = std::shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
virtual void updateDefaultShape();
virtual AABB *getAABB(Level *level, int x, int y, int z);
virtual AABB *getTileAABB(Level *level, int x, int y, int z);
@@ -30,10 +30,10 @@ protected:
virtual bool isCubeShaped();
virtual bool isSolidRender(bool isServerLevel = false);
virtual bool TestUse();
virtual bool use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param
virtual void attack(Level *level, int x, int y, int z, std::shared_ptr<Player> player);
virtual bool use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param
virtual void attack(Level *level, int x, int y, int z, shared_ptr<Player> player);
private:
void eat(Level *level, int x, int y, int z, std::shared_ptr<Player> player);
void eat(Level *level, int x, int y, int z, shared_ptr<Player> player);
public:
virtual bool mayPlace(Level *level, int x, int y, int z);
virtual void neighborChanged(Level *level, int x, int y, int z, int type);

View File

@@ -21,11 +21,11 @@ bool CarrotOnAStickItem::isMirroredArt()
return true;
}
std::shared_ptr<ItemInstance> CarrotOnAStickItem::use(std::shared_ptr<ItemInstance> itemInstance, Level *level, std::shared_ptr<Player> player)
shared_ptr<ItemInstance> CarrotOnAStickItem::use(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player)
{
if (player->isRiding())
{
std::shared_ptr<Pig> pig = dynamic_pointer_cast<Pig>(player->riding);
shared_ptr<Pig> pig = dynamic_pointer_cast<Pig>(player->riding);
if(pig)
{
if (pig->getControlGoal()->canBoost() && itemInstance->getMaxDamage() - itemInstance->getAuxValue() >= 7)
@@ -35,7 +35,7 @@ std::shared_ptr<ItemInstance> CarrotOnAStickItem::use(std::shared_ptr<ItemInstan
if (itemInstance->count == 0)
{
std::shared_ptr<ItemInstance> replacement = std::shared_ptr<ItemInstance>(new ItemInstance(Item::fishingRod));
shared_ptr<ItemInstance> replacement = shared_ptr<ItemInstance>(new ItemInstance(Item::fishingRod));
replacement->setTag(itemInstance->tag);
return replacement;
}

View File

@@ -9,5 +9,5 @@ public:
bool isHandEquipped();
bool isMirroredArt();
std::shared_ptr<ItemInstance> use(std::shared_ptr<ItemInstance> itemInstance, Level *level, std::shared_ptr<Player> player);
shared_ptr<ItemInstance> use(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player);
};

View File

@@ -46,7 +46,7 @@ Icon *CauldronTile::getTexture(const wstring &name)
return NULL;
}
void CauldronTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr<Entity> source)
void CauldronTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr<Entity> source)
{
setShape(0, 0, 0, 1, 5.0f / 16.0f, 1);
Tile::addAABBs(level, x, y, z, box, boxes, source);
@@ -83,7 +83,7 @@ bool CauldronTile::isCubeShaped()
return false;
}
bool CauldronTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
{
if(soundOnly) return false;
@@ -92,7 +92,7 @@ bool CauldronTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player
return true;
}
std::shared_ptr<ItemInstance> item = player->inventory->getSelected();
shared_ptr<ItemInstance> item = player->inventory->getSelected();
if (item == NULL)
{
return true;
@@ -106,7 +106,7 @@ bool CauldronTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player
{
if (!player->abilities.instabuild)
{
player->inventory->setItem(player->inventory->selected, std::shared_ptr<ItemInstance>(new ItemInstance(Item::bucket_empty)));
player->inventory->setItem(player->inventory->selected, shared_ptr<ItemInstance>(new ItemInstance(Item::bucket_empty)));
}
level->setData(x, y, z, 3);
@@ -117,10 +117,10 @@ bool CauldronTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player
{
if (currentData > 0)
{
std::shared_ptr<ItemInstance> potion = std::shared_ptr<ItemInstance>(new ItemInstance(Item::potion, 1, 0));
shared_ptr<ItemInstance> potion = shared_ptr<ItemInstance>(new ItemInstance(Item::potion, 1, 0));
if (!player->inventory->add(potion))
{
level->addEntity(std::shared_ptr<ItemEntity>(new ItemEntity(level, x + 0.5, y + 1.5, z + 0.5, potion)));
level->addEntity(shared_ptr<ItemEntity>(new ItemEntity(level, x + 0.5, y + 1.5, z + 0.5, potion)));
}
// 4J Stu - Brought forward change to update inventory when filling bottles with water
else if (dynamic_pointer_cast<ServerPlayer>( player ) != NULL)

View File

@@ -21,12 +21,12 @@ public:
//@Override
void registerIcons(IconRegister *iconRegister);
static Icon *getTexture(const wstring &name);
virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr<Entity> source);
virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr<Entity> source);
virtual void updateDefaultShape();
virtual bool isSolidRender(bool isServerLevel = false);
virtual int getRenderShape();
virtual bool isCubeShaped();
virtual bool use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param
virtual bool use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param
virtual void handleRain(Level *level, int x, int y, int z);
virtual int getResource(int data, Random *random, int playerBonusLevel);
virtual int cloneTileId(Level *level, int x, int y, int z);

View File

@@ -28,7 +28,7 @@ float CaveSpider::getModelScale()
}
bool CaveSpider::doHurtTarget(std::shared_ptr<Entity> target)
bool CaveSpider::doHurtTarget(shared_ptr<Entity> target)
{
if (Spider::doHurtTarget(target))
{

View File

@@ -13,6 +13,6 @@ class CaveSpider : public Spider
virtual int getMaxHealth();
virtual float getModelScale();
virtual bool doHurtTarget(std::shared_ptr<Entity> target);
virtual bool doHurtTarget(shared_ptr<Entity> target);
void finalizeMobSpawn();
};

View File

@@ -92,7 +92,7 @@ public:
virtual int getEstimatedSize();
public:
static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new ChatPacket()); }
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new ChatPacket()); }
virtual int getId() { return 3; }
};

View File

@@ -37,7 +37,7 @@ int ChestTile::getRenderShape()
return Tile::SHAPE_ENTITYTILE_ANIMATED;
}
void ChestTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr<TileEntity> forceEntity)
void ChestTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr<TileEntity> forceEntity)
{
if (level->getTile(x, y, z - 1) == id)
{
@@ -76,7 +76,7 @@ void ChestTile::onPlace(Level *level, int x, int y, int z)
if (e == id) recalcLockDir(level, x + 1, y, z);
}
void ChestTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr<Mob> by)
void ChestTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr<Mob> by)
{
int n = level->getTile(x, y, z - 1); // face = 2
int s = level->getTile(x, y, z + 1); // face = 3
@@ -200,18 +200,18 @@ bool ChestTile::isFullChest(Level *level, int x, int y, int z)
void ChestTile::neighborChanged(Level *level, int x, int y, int z, int type)
{
EntityTile::neighborChanged(level, x, y, z, type);
std::shared_ptr<ChestTileEntity>(cte) = dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x, y, z));
shared_ptr<ChestTileEntity>(cte) = dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x, y, z));
if (cte != NULL) cte->clearCache();
}
void ChestTile::onRemove(Level *level, int x, int y, int z, int id, int data)
{
std::shared_ptr<Container> container = dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z) );
shared_ptr<Container> container = dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z) );
if (container != NULL )
{
for (unsigned int i = 0; i < container->getContainerSize(); i++)
{
std::shared_ptr<ItemInstance> item = container->getItem(i);
shared_ptr<ItemInstance> item = container->getItem(i);
if (item != NULL)
{
float xo = random->nextFloat() * 0.8f + 0.1f;
@@ -224,9 +224,9 @@ void ChestTile::onRemove(Level *level, int x, int y, int z, int id, int data)
if (count > item->count) count = item->count;
item->count -= count;
std::shared_ptr<ItemInstance> newItem = std::shared_ptr<ItemInstance>( new ItemInstance(item->id, count, item->getAuxValue()) );
shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>( new ItemInstance(item->id, count, item->getAuxValue()) );
newItem->set4JData( item->get4JData() );
std::shared_ptr<ItemEntity> itemEntity = std::shared_ptr<ItemEntity>(new ItemEntity(level, x + xo, y + yo, z + zo, newItem ) );
shared_ptr<ItemEntity> itemEntity = shared_ptr<ItemEntity>(new ItemEntity(level, x + xo, y + yo, z + zo, newItem ) );
float pow = 0.05f;
itemEntity->xd = (float) random->nextGaussian() * pow;
itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f;
@@ -254,7 +254,7 @@ bool ChestTile::TestUse()
}
// 4J-PB - changing to 1.5 equivalent
bool ChestTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
bool ChestTile::use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
{
if( soundOnly ) return true;
@@ -263,21 +263,21 @@ bool ChestTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> p
return true;
}
std::shared_ptr<Container> container = dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z) );
shared_ptr<Container> container = dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z) );
if (container == NULL) return true;
if (level->isSolidBlockingTile(x, y + 1, z)) return true;
if (isCatSittingOnChest(level,x, y, z)) return true;
if (isCatSittingOnChest(level,x, y, z)) return true;
if (level->getTile(x - 1, y, z) == id && (level->isSolidBlockingTile(x - 1, y + 1, z) || isCatSittingOnChest(level, x - 1, y, z))) return true;
if (level->getTile(x + 1, y, z) == id && (level->isSolidBlockingTile(x + 1, y + 1, z) || isCatSittingOnChest(level, x + 1, y, z))) return true;
if (level->getTile(x, y, z - 1) == id && (level->isSolidBlockingTile(x, y + 1, z - 1) || isCatSittingOnChest(level, x, y, z - 1))) return true;
if (level->getTile(x, y, z + 1) == id && (level->isSolidBlockingTile(x, y + 1, z + 1) || isCatSittingOnChest(level, x, y, z + 1))) return true;
if (level->getTile(x - 1, y, z) == id) container = std::shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x - 1, y, z) ), container) );
if (level->getTile(x + 1, y, z) == id) container = std::shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, container, dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x + 1, y, z) )) );
if (level->getTile(x, y, z - 1) == id) container = std::shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z - 1) ), container) );
if (level->getTile(x, y, z + 1) == id) container = std::shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, container, dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z + 1) )) );
if (level->getTile(x - 1, y, z) == id) container = shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x - 1, y, z) ), container) );
if (level->getTile(x + 1, y, z) == id) container = shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, container, dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x + 1, y, z) )) );
if (level->getTile(x, y, z - 1) == id) container = shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z - 1) ), container) );
if (level->getTile(x, y, z + 1) == id) container = shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, container, dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z + 1) )) );
player->openContainer(container);
@@ -285,12 +285,12 @@ bool ChestTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> p
}
// 4J-PB - added from 1.5
bool ChestTile::isCatSittingOnChest(Level *level, int x, int y, int z)
bool ChestTile::isCatSittingOnChest(Level *level, int x, int y, int z)
{
vector<std::shared_ptr<Entity> > *entities = level->getEntitiesOfClass(typeid(Ozelot), AABB::newTemp(x, y + 1, z, x + 1, y + 2, z + 1));
vector<shared_ptr<Entity> > *entities = level->getEntitiesOfClass(typeid(Ozelot), AABB::newTemp(x, y + 1, z, x + 1, y + 2, z + 1));
for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it)
{
std::shared_ptr<Ozelot> ocelot = dynamic_pointer_cast<Ozelot>(*it);
shared_ptr<Ozelot> ocelot = dynamic_pointer_cast<Ozelot>(*it);
if(ocelot->isSitting())
{
return true;
@@ -300,15 +300,15 @@ bool ChestTile::isCatSittingOnChest(Level *level, int x, int y, int z)
return false;
}
std::shared_ptr<TileEntity> ChestTile::newTileEntity(Level *level)
shared_ptr<TileEntity> ChestTile::newTileEntity(Level *level)
{
MemSect(50);
std::shared_ptr<TileEntity> retval = std::shared_ptr<TileEntity>( new ChestTileEntity() );
shared_ptr<TileEntity> retval = shared_ptr<TileEntity>( new ChestTileEntity() );
MemSect(0);
return retval;
}
void ChestTile::registerIcons(IconRegister *iconRegister)
void ChestTile::registerIcons(IconRegister *iconRegister)
{
// Register wood as the chest's icon, because it's used by the particles
// when destroying the chest

View File

@@ -19,9 +19,9 @@ public:
virtual bool isSolidRender(bool isServerLevel = false);
virtual bool isCubeShaped();
virtual int getRenderShape();
virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr<TileEntity> forceEntity = std::shared_ptr<TileEntity>());
virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>());
virtual void onPlace(Level *level, int x, int y, int z);
virtual void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr<Mob> by);
virtual void setPlacedBy(Level *level, int x, int y, int z, shared_ptr<Mob> by);
void recalcLockDir(Level *level, int x, int y, int z);
virtual bool mayPlace(Level *level, int x, int y, int z);
private:
@@ -31,8 +31,8 @@ public:
virtual void neighborChanged(Level *level, int x, int y, int z, int type);
virtual void onRemove(Level *level, int x, int y, int z, int id, int data);
virtual bool TestUse();
virtual bool use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param
std::shared_ptr<TileEntity> newTileEntity(Level *level);
virtual bool use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param
shared_ptr<TileEntity> newTileEntity(Level *level);
//@Override
void registerIcons(IconRegister *iconRegister);
};

View File

@@ -32,32 +32,32 @@ ChestTileEntity::~ChestTileEntity()
delete items;
}
unsigned int ChestTileEntity::getContainerSize()
unsigned int ChestTileEntity::getContainerSize()
{
return 9 * 3;
}
std::shared_ptr<ItemInstance> ChestTileEntity::getItem(unsigned int slot)
shared_ptr<ItemInstance> ChestTileEntity::getItem(unsigned int slot)
{
return items->data[slot];
}
std::shared_ptr<ItemInstance> ChestTileEntity::removeItem(unsigned int slot, int count)
shared_ptr<ItemInstance> ChestTileEntity::removeItem(unsigned int slot, int count)
{
if (items->data[slot] != NULL)
{
if (items->data[slot]->count <= count)
if (items->data[slot]->count <= count)
{
std::shared_ptr<ItemInstance> item = items->data[slot];
shared_ptr<ItemInstance> item = items->data[slot];
items->data[slot] = nullptr;
this->setChanged();
// 4J Stu - Fix for duplication glitch
if(item->count <= 0) return nullptr;
return item;
}
else
}
else
{
std::shared_ptr<ItemInstance> i = items->data[slot]->remove(count);
shared_ptr<ItemInstance> i = items->data[slot]->remove(count);
if (items->data[slot]->count == 0) items->data[slot] = nullptr;
this->setChanged();
// 4J Stu - Fix for duplication glitch
@@ -68,18 +68,18 @@ std::shared_ptr<ItemInstance> ChestTileEntity::removeItem(unsigned int slot, int
return nullptr;
}
std::shared_ptr<ItemInstance> ChestTileEntity::removeItemNoUpdate(int slot)
shared_ptr<ItemInstance> ChestTileEntity::removeItemNoUpdate(int slot)
{
if (items->data[slot] != NULL)
{
std::shared_ptr<ItemInstance> item = items->data[slot];
shared_ptr<ItemInstance> item = items->data[slot];
items->data[slot] = nullptr;
return item;
}
return nullptr;
}
void ChestTileEntity::setItem(unsigned int slot, std::shared_ptr<ItemInstance> item)
void ChestTileEntity::setItem(unsigned int slot, shared_ptr<ItemInstance> item)
{
items->data[slot] = item;
if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize();
@@ -118,7 +118,7 @@ void ChestTileEntity::save(CompoundTag *base)
for (unsigned int i = 0; i < items->length; i++)
{
if (items->data[i] != NULL)
if (items->data[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) i);
@@ -135,14 +135,14 @@ int ChestTileEntity::getMaxStackSize()
return Container::LARGE_MAX_STACK_SIZE;
}
bool ChestTileEntity::stillValid(std::shared_ptr<Player> player)
bool ChestTileEntity::stillValid(shared_ptr<Player> player)
{
if (level->getTileEntity(x, y, z) != shared_from_this() ) return false;
if (player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 8 * 8) return false;
return true;
}
void ChestTileEntity::setChanged()
void ChestTileEntity::setChanged()
{
TileEntity::setChanged();
}
@@ -208,7 +208,7 @@ void ChestTileEntity::tick()
if (s.lock() != NULL) zc += 0.5;
if (e.lock() != NULL) xc += 0.5;
// 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit
// 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit
level->playSound(xc, y + 0.5, zc, eSoundType_RANDOM_CHEST_OPEN, 0.2f, level->random->nextFloat() * 0.1f + 0.9f);
}
}
@@ -233,7 +233,7 @@ void ChestTileEntity::tick()
if (s.lock() != NULL) zc += 0.5;
if (e.lock() != NULL) xc += 0.5;
// 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit
// 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit
level->playSound(xc, y + 0.5, zc, eSoundType_RANDOM_CHEST_CLOSE, 0.2f, level->random->nextFloat() * 0.1f + 0.9f);
}
}
@@ -273,9 +273,9 @@ void ChestTileEntity::setRemoved()
}
// 4J Added
std::shared_ptr<TileEntity> ChestTileEntity::clone()
shared_ptr<TileEntity> ChestTileEntity::clone()
{
std::shared_ptr<ChestTileEntity> result = std::shared_ptr<ChestTileEntity>( new ChestTileEntity() );
shared_ptr<ChestTileEntity> result = shared_ptr<ChestTileEntity>( new ChestTileEntity() );
TileEntity::clone(result);
for (unsigned int i = 0; i < items->length; i++)

View File

@@ -40,15 +40,15 @@ private:
public:
virtual unsigned int getContainerSize();
virtual std::shared_ptr<ItemInstance> getItem(unsigned int slot);
virtual std::shared_ptr<ItemInstance> removeItem(unsigned int slot, int count);
virtual std::shared_ptr<ItemInstance> removeItemNoUpdate(int slot);
virtual void setItem(unsigned int slot, std::shared_ptr<ItemInstance> item);
virtual shared_ptr<ItemInstance> getItem(unsigned int slot);
virtual shared_ptr<ItemInstance> removeItem(unsigned int slot, int count);
virtual shared_ptr<ItemInstance> removeItemNoUpdate(int slot);
virtual void setItem(unsigned int slot, shared_ptr<ItemInstance> item);
virtual int getName();
virtual void load(CompoundTag *base);
virtual void save(CompoundTag *base);
virtual int getMaxStackSize();
virtual bool stillValid(std::shared_ptr<Player> player);
virtual bool stillValid(shared_ptr<Player> player);
virtual void setChanged();
virtual void clearCache();
virtual void checkNeighbors();
@@ -59,5 +59,5 @@ public:
virtual void setRemoved();
// 4J Added
virtual std::shared_ptr<TileEntity> clone();
virtual shared_ptr<TileEntity> clone();
};

View File

@@ -68,7 +68,7 @@ void Chicken::aiStep()
if (!onGround && flapping < 1) flapping = 1;
flapping *= 0.9;
if (!onGround && yd < 0)
if (!onGround && yd < 0)
{
yd *= 0.6;
}
@@ -77,7 +77,7 @@ void Chicken::aiStep()
if (!isBaby())
{
if (!level->isClientSide && --eggTime <= 0)
if (!level->isClientSide && --eggTime <= 0)
{
level->playSound(shared_from_this(), eSoundType_MOB_CHICKENPLOP, 1.0f, (random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f);
spawnAtLocation(Item::egg->id, 1);
@@ -87,27 +87,27 @@ void Chicken::aiStep()
}
void Chicken::causeFallDamage(float distance)
void Chicken::causeFallDamage(float distance)
{
}
int Chicken::getAmbientSound()
int Chicken::getAmbientSound()
{
return eSoundType_MOB_CHICKEN_AMBIENT;
}
int Chicken::getHurtSound()
int Chicken::getHurtSound()
{
return eSoundType_MOB_CHICKEN_HURT;
}
int Chicken::getDeathSound()
int Chicken::getDeathSound()
{
return eSoundType_MOB_CHICKEN_HURT;
}
int Chicken::getDeathLoot()
int Chicken::getDeathLoot()
{
return Item::feather->id;
}
@@ -121,7 +121,7 @@ void Chicken::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel)
spawnAtLocation(Item::feather_Id, 1);
}
// and some meat
if (this->isOnFire())
if (this->isOnFire())
{
spawnAtLocation(Item::chicken_cooked_Id, 1);
}
@@ -131,12 +131,12 @@ void Chicken::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel)
}
}
std::shared_ptr<AgableMob> Chicken::getBreedOffspring(std::shared_ptr<AgableMob> target)
shared_ptr<AgableMob> Chicken::getBreedOffspring(shared_ptr<AgableMob> target)
{
// 4J - added limit to chickens that can be bred
if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) )
{
return std::shared_ptr<Chicken>(new Chicken(level));
return shared_ptr<Chicken>(new Chicken(level));
}
else
{
@@ -144,7 +144,7 @@ std::shared_ptr<AgableMob> Chicken::getBreedOffspring(std::shared_ptr<AgableMob>
}
}
bool Chicken::isFood(std::shared_ptr<ItemInstance> itemInstance)
bool Chicken::isFood(shared_ptr<ItemInstance> itemInstance)
{
return (itemInstance->id == Item::seeds_wheat_Id) || (itemInstance->id == Item::netherStalkSeeds_Id) || (itemInstance->id == Item::seeds_melon_Id) || (itemInstance->id == Item::seeds_pumpkin_Id);
}

Some files were not shown because too many files have changed in this diff Show More