mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-07-03 13:37:02 +00:00
fix aux bug
This commit is contained in:
parent
9af38d7a9d
commit
dd6bc32821
|
|
@ -1,3 +1,4 @@
|
|||
#include "ItemInstance.h"
|
||||
#include "stdafx.h"
|
||||
#include "com.mojang.nbt.h"
|
||||
#include "net.minecraft.locale.h"
|
||||
|
|
@ -220,6 +221,11 @@ void ItemInstance::setAuxValue(int value)
|
|||
}
|
||||
}
|
||||
|
||||
void ItemInstance::setRawAuxValue(int value)
|
||||
{
|
||||
auxValue = value;
|
||||
}
|
||||
|
||||
int ItemInstance::getMaxDamage()
|
||||
{
|
||||
return Item::items[id]->getMaxDamage();
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ public:
|
|||
int getDamageValue();
|
||||
int getAuxValue() const;
|
||||
void setAuxValue(int value);
|
||||
void setRawAuxValue(int value);
|
||||
int getMaxDamage();
|
||||
bool hurt(int dmg, Random *random);
|
||||
void hurtAndBreak(int dmg, shared_ptr<LivingEntity> owner);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "Recipes.h"
|
||||
#include "Recipes.h"
|
||||
#include "Recipes.h"
|
||||
#include "Recipes.h"
|
||||
#include "stdafx.h"
|
||||
#include "Container.h"
|
||||
#include "AbstractContainerMenu.h"
|
||||
|
|
@ -1343,7 +1345,7 @@ Recipy::INGREDIENTS_REQUIRED *Recipes::getRecipeIngredientsArray(void)
|
|||
return m_pRecipeIngredientsRequired;
|
||||
}
|
||||
|
||||
inline void serializeItemInstance(DataOutputStream* dos, ItemInstance* result) {
|
||||
inline void Recipes::serializeItemInstance(DataOutputStream* dos, ItemInstance* result) {
|
||||
dos->writeInt(result->id);
|
||||
dos->writeByte(result->count);
|
||||
dos->writeShort(result->getAuxValue());
|
||||
|
|
@ -1397,14 +1399,15 @@ inline void serializeItemInstance(DataOutputStream* dos, ItemInstance* result) {
|
|||
}
|
||||
}
|
||||
|
||||
inline ItemInstance* parseItemInstance(DataInputStream* dis) {
|
||||
inline ItemInstance* Recipes::parseItemInstance(DataInputStream* dis) {
|
||||
int itemId = dis->readInt();
|
||||
int itemCount = dis->readByte();
|
||||
int itemAux = dis->readShort();
|
||||
|
||||
unsigned char itemFlags = dis->readByte();
|
||||
|
||||
ItemInstance* item = new ItemInstance(itemId, itemCount, itemAux);
|
||||
ItemInstance* item = new ItemInstance(itemId, itemCount, 0);
|
||||
item->setRawAuxValue(itemAux); //ctor limits aux to < 0 cause we are creating item by id and not tile or item instance
|
||||
|
||||
if (itemFlags & 0x01) {
|
||||
int enchantmentCount = dis->readByte();
|
||||
|
|
|
|||
|
|
@ -111,6 +111,9 @@ private:
|
|||
void buildRecipeIngredientsArray();
|
||||
Recipy::INGREDIENTS_REQUIRED *m_pRecipeIngredientsRequired;
|
||||
|
||||
void serializeItemInstance(DataOutputStream* dos, ItemInstance* result);
|
||||
ItemInstance* parseItemInstance(DataInputStream* dis);
|
||||
|
||||
public:
|
||||
static ToolRecipies *pToolRecipies;
|
||||
static WeaponRecipies *pWeaponRecipies;
|
||||
|
|
|
|||
Loading…
Reference in a new issue