summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/BlockID.h32
-rw-r--r--src/Enchantments.h1
-rw-r--r--src/Mobs/Blaze.cpp4
-rw-r--r--src/Mobs/Cavespider.cpp8
-rw-r--r--src/Mobs/Chicken.cpp6
-rw-r--r--src/Mobs/Cow.cpp6
-rw-r--r--src/Mobs/Creeper.cpp6
-rw-r--r--src/Mobs/Enderman.cpp6
-rw-r--r--src/Mobs/Ghast.cpp6
-rw-r--r--src/Mobs/Horse.cpp6
-rw-r--r--src/Mobs/Monster.cpp49
-rw-r--r--src/Mobs/Monster.h32
-rw-r--r--src/Mobs/Mooshroom.cpp45
-rw-r--r--src/Mobs/Mooshroom.h1
-rw-r--r--src/Mobs/Pig.cpp6
-rw-r--r--src/Mobs/Skeleton.cpp20
-rw-r--r--src/Mobs/Slime.cpp6
-rw-r--r--src/Mobs/Spider.cpp8
-rw-r--r--src/Mobs/Squid.cpp6
-rw-r--r--src/Mobs/Witch.cpp24
-rw-r--r--src/Mobs/Zombie.cpp13
-rw-r--r--src/Mobs/Zombiepigman.cpp9
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp8
-rw-r--r--src/WorldStorage/WSSAnvil.cpp183
-rw-r--r--src/WorldStorage/WSSAnvil.h7
25 files changed, 417 insertions, 81 deletions
diff --git a/src/BlockID.h b/src/BlockID.h
index e23a0f82a..740c5fc90 100644
--- a/src/BlockID.h
+++ b/src/BlockID.h
@@ -392,38 +392,6 @@ enum ENUM_ITEM_ID
-// ENCHANTMENT IDS
-enum
-{
- E_ENCHANTMENT_PROTECTION = 0,
- E_ENCHANTMENT_FIRE_PROTECTION = 1,
- E_ENCHANTMENT_FEATHER_FALLING = 2,
- E_ENCHANTMENT_BLAST_PROTECTION = 3,
- E_ENCHANTMENT_PROJECTILE_PROTECTION= 4,
- E_ENCHANTMENT_RESPIRATION = 5,
- E_ENCHANTMENT_AQUA_AFFINITY = 6,
- E_ENCHANTMENT_THORNS = 7,
- E_ENCHANTMENT_SHARPNESS = 16,
- E_ENCHANTMENT_SMITE = 17,
- E_ENCHANTMENT_BANE_OF_ARTHROPODS = 18,
- E_ENCHANTMENT_KNOCKBACK = 19,
- E_ENCHANTMENT_FIREASPECT = 20,
- E_ENCHANTMENT_LOOTING = 21,
- E_ENCHANTMENT_EFFICIENCY = 32,
- E_ENCHANTMENT_SILKTOUCH = 33,
- E_ENCHANTMENT_UNBREAKING = 34,
- E_ENCHANTMENT_FORTUNE = 35,
- E_ENCHANTMENT_POWER = 48,
- E_ENCHANTMENT_PUNCH = 49,
- E_ENCHANTMENT_FLAME = 50,
- E_ENCHANTMENT_INFINITY = 51,
- E_ENCHANTMENT_LUCKOFTHESEA = 61,
- E_ENCHANTMENT_LURE = 62,
-};
-
-
-
-
enum
{
diff --git a/src/Enchantments.h b/src/Enchantments.h
index e984df92e..f77b535d8 100644
--- a/src/Enchantments.h
+++ b/src/Enchantments.h
@@ -21,7 +21,6 @@ class cParsedNBT;
-
/** Class that stores item enchantments or stored-enchantments
The enchantments may be serialized to a stringspec and read back from such stringspec.
The format for the stringspec is "id=lvl;id=lvl;id=lvl...", with an optional semicolon at the end,
diff --git a/src/Mobs/Blaze.cpp b/src/Mobs/Blaze.cpp
index bd16a36e2..ac42cf40b 100644
--- a/src/Mobs/Blaze.cpp
+++ b/src/Mobs/Blaze.cpp
@@ -19,9 +19,9 @@ cBlaze::cBlaze(void) :
void cBlaze::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- if (a_Killer->IsA("cPlayer") || a_Killer->IsA("cWolf"))
+ if ((a_Killer != NULL) && (a_Killer->IsPlayer() || a_Killer->IsA("cWolf")))
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_BLAZE_ROD);
}
}
diff --git a/src/Mobs/Cavespider.cpp b/src/Mobs/Cavespider.cpp
index 7274820b7..94e93283d 100644
--- a/src/Mobs/Cavespider.cpp
+++ b/src/Mobs/Cavespider.cpp
@@ -31,9 +31,13 @@ void cCavespider::Tick(float a_Dt, cChunk & a_Chunk)
void cCavespider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STRING);
- if (a_Killer->IsA("cPlayer") || a_Killer->IsA("cWolf"))
+ if ((a_Killer != NULL) && (a_Killer->IsPlayer() || a_Killer->IsA("cWolf")))
{
AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_SPIDER_EYE);
}
diff --git a/src/Mobs/Chicken.cpp b/src/Mobs/Chicken.cpp
index 9388e1097..f7e44238f 100644
--- a/src/Mobs/Chicken.cpp
+++ b/src/Mobs/Chicken.cpp
@@ -48,7 +48,11 @@ void cChicken::Tick(float a_Dt, cChunk & a_Chunk)
void cChicken::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_FEATHER);
AddRandomDropItem(a_Drops, 1, 1, IsOnFire() ? E_ITEM_COOKED_CHICKEN : E_ITEM_RAW_CHICKEN);
}
diff --git a/src/Mobs/Cow.cpp b/src/Mobs/Cow.cpp
index cda067fac..9914df6b5 100644
--- a/src/Mobs/Cow.cpp
+++ b/src/Mobs/Cow.cpp
@@ -21,7 +21,11 @@ cCow::cCow(void) :
void cCow::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER);
AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF);
}
diff --git a/src/Mobs/Creeper.cpp b/src/Mobs/Creeper.cpp
index 0ae78eee3..40ee20e44 100644
--- a/src/Mobs/Creeper.cpp
+++ b/src/Mobs/Creeper.cpp
@@ -39,7 +39,11 @@ void cCreeper::Tick(float a_Dt, cChunk & a_Chunk)
void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER);
if ((a_Killer != NULL) && (a_Killer->IsProjectile()))
diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp
index 4a5ad25be..becc99a86 100644
--- a/src/Mobs/Enderman.cpp
+++ b/src/Mobs/Enderman.cpp
@@ -21,7 +21,11 @@ cEnderman::cEnderman(void) :
void cEnderman::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_ENDER_PEARL);
}
diff --git a/src/Mobs/Ghast.cpp b/src/Mobs/Ghast.cpp
index a73ed0944..fe18f5e76 100644
--- a/src/Mobs/Ghast.cpp
+++ b/src/Mobs/Ghast.cpp
@@ -18,7 +18,11 @@ cGhast::cGhast(void) :
void cGhast::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER);
AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_GHAST_TEAR);
}
diff --git a/src/Mobs/Horse.cpp b/src/Mobs/Horse.cpp
index 3c29e3682..9d130301f 100644
--- a/src/Mobs/Horse.cpp
+++ b/src/Mobs/Horse.cpp
@@ -140,7 +140,11 @@ void cHorse::OnRightClicked(cPlayer & a_Player)
void cHorse::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER);
if (m_bIsSaddled)
{
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 66629474b..4ab485321 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -81,6 +81,12 @@ cMonster::cMonster(const AString & a_ConfigName, eType a_MobType, const AString
, m_AttackDamage(1)
, m_AttackRange(2)
, m_AttackInterval(0)
+ , m_DropChanceWeapon(0.085)
+ , m_DropChanceHelmet(0.085)
+ , m_DropChanceChestplate(0.085)
+ , m_DropChanceLeggings(0.085)
+ , m_DropChanceBoots(0.085)
+ , m_CanPickUpLoot(true)
, m_SightDistance(25)
, m_BurnsInDaylight(false)
{
@@ -884,7 +890,7 @@ void cMonster::AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short
{
MTRand r1;
int Count = r1.randInt() % 1000;
- if (Count < (a_Chance*10))
+ if (Count < (a_Chance * 10))
{
a_Drops.push_back(cItem(a_Item, 1, a_ItemHealth));
}
@@ -909,6 +915,47 @@ void cMonster::AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a
+void cMonster::AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel)
+{
+ MTRand r1;
+ if (r1.randInt() % 200 < ((m_DropChanceHelmet * 200) + (a_LootingLevel * 2)))
+ {
+ if (!GetEquippedHelmet().IsEmpty()) a_Drops.push_back(GetEquippedHelmet());
+ }
+
+ if (r1.randInt() % 200 < ((m_DropChanceChestplate * 200) + (a_LootingLevel * 2)))
+ {
+ if (!GetEquippedChestplate().IsEmpty()) a_Drops.push_back(GetEquippedChestplate());
+ }
+
+ if (r1.randInt() % 200 < ((m_DropChanceLeggings * 200) + (a_LootingLevel * 2)))
+ {
+ if (!GetEquippedLeggings().IsEmpty()) a_Drops.push_back(GetEquippedLeggings());
+ }
+
+ if (r1.randInt() % 200 < ((m_DropChanceBoots * 200) + (a_LootingLevel * 2)))
+ {
+ if (!GetEquippedBoots().IsEmpty()) a_Drops.push_back(GetEquippedBoots());
+ }
+}
+
+
+
+
+
+void cMonster::AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel)
+{
+ MTRand r1;
+ if (r1.randInt() % 200 < ((m_DropChanceWeapon * 200) + (a_LootingLevel * 2)))
+ {
+ if (!GetEquippedWeapon().IsEmpty()) a_Drops.push_back(GetEquippedWeapon());
+ }
+}
+
+
+
+
+
void cMonster::HandleDaylightBurning(cChunk & a_Chunk)
{
if (!m_BurnsInDaylight)
diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h
index 909504213..49d0cf9ef 100644
--- a/src/Mobs/Monster.h
+++ b/src/Mobs/Monster.h
@@ -5,6 +5,7 @@
#include "../Defines.h"
#include "../BlockID.h"
#include "../Item.h"
+#include "../Enchantments.h"
@@ -118,6 +119,19 @@ public:
void SetAttackDamage(int a_AttackDamage) { m_AttackDamage = a_AttackDamage; }
void SetSightDistance(int a_SightDistance) { m_SightDistance = a_SightDistance; }
+ float GetDropChanceWeapon() { return m_DropChanceWeapon; }
+ float GetDropChanceHelmet() { return m_DropChanceHelmet; }
+ float GetDropChanceChestplate() { return m_DropChanceChestplate; }
+ float GetDropChanceLeggings() { return m_DropChanceLeggings; }
+ float GetDropChanceBoots() { return m_DropChanceBoots; }
+ bool CanPickUpLoot() { return m_CanPickUpLoot; }
+ void SetDropChanceWeapon(float a_DropChanceWeapon) { m_DropChanceWeapon = a_DropChanceWeapon; }
+ void SetDropChanceHelmet(float a_DropChanceHelmet) { m_DropChanceHelmet = a_DropChanceHelmet; }
+ void SetDropChanceChestplate(float a_DropChanceChestplate) { m_DropChanceChestplate = a_DropChanceChestplate; }
+ void SetDropChanceLeggings(float a_DropChanceLeggings) { m_DropChanceLeggings = a_DropChanceLeggings; }
+ void SetDropChanceBoots(float a_DropChanceBoots) { m_DropChanceBoots = a_DropChanceBoots; }
+ void SetCanPickUpLoot(bool a_CanPickUpLoot) { m_CanPickUpLoot = a_CanPickUpLoot; }
+
/// Sets whether the mob burns in daylight. Only evaluated at next burn-decision tick
void SetBurnsInDaylight(bool a_BurnsInDaylight) { m_BurnsInDaylight = a_BurnsInDaylight; }
@@ -220,13 +234,31 @@ protected:
float m_AttackInterval;
int m_SightDistance;
+ float m_DropChanceWeapon;
+ float m_DropChanceHelmet;
+ float m_DropChanceChestplate;
+ float m_DropChanceLeggings;
+ float m_DropChanceBoots;
+ bool m_CanPickUpLoot;
+
void HandleDaylightBurning(cChunk & a_Chunk);
bool m_BurnsInDaylight;
+ /** Adds a random number of a_Item between a_Min and a_Max to itemdrops a_Drops*/
void AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth = 0);
+
+ /** Adds a item a_Item with the chance of a_Chance (in percent) to itemdrops a_Drops*/
void AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth = 0);
+
+ /** Adds one rare item out of the list of rare items a_Items modified by the looting level a_LootingLevel(I-III or custom) to the itemdrop a_Drops*/
void AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a_LootingLevel);
+ /** Adds armor that is equipped with the chance of 8,5% (Looting 3: 11,5%) to the drop*/
+ void AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel);
+
+ /** Adds weapon that is equipped with the chance of 8,5% (Looting 3: 11,5%) to the drop*/
+ void AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel);
+
} ; // tolua_export
diff --git a/src/Mobs/Mooshroom.cpp b/src/Mobs/Mooshroom.cpp
index 17995ce91..8e4c52ae6 100644
--- a/src/Mobs/Mooshroom.cpp
+++ b/src/Mobs/Mooshroom.cpp
@@ -2,11 +2,12 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Mooshroom.h"
+#include "../Entities/Player.h"
+
-// TODO: Milk Cow
@@ -23,10 +24,50 @@ cMooshroom::cMooshroom(void) :
void cMooshroom::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER);
AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF);
}
+
+
+void cMooshroom::OnRightClicked(cPlayer & a_Player)
+{
+ switch (a_Player.GetEquippedItem().m_ItemType)
+ {
+ case E_ITEM_BUCKET:
+ {
+ if (!a_Player.IsGameModeCreative())
+ {
+ a_Player.GetInventory().RemoveOneEquippedItem();
+ a_Player.GetInventory().AddItem(E_ITEM_MILK);
+ }
+ } break;
+ case E_ITEM_BOWL:
+ {
+ if (!a_Player.IsGameModeCreative())
+ {
+ a_Player.GetInventory().RemoveOneEquippedItem();
+ a_Player.GetInventory().AddItem(E_ITEM_MUSHROOM_SOUP);
+ }
+ } break;
+ case E_ITEM_SHEARS:
+ {
+ if (!a_Player.IsGameModeCreative())
+ {
+ a_Player.UseEquippedItem();
+ }
+
+ cItems Drops;
+ Drops.push_back(cItem(E_BLOCK_RED_MUSHROOM, 5, 0));
+ m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10);
+ } break;
+ }
+}
+
diff --git a/src/Mobs/Mooshroom.h b/src/Mobs/Mooshroom.h
index c94301098..16f6c8248 100644
--- a/src/Mobs/Mooshroom.h
+++ b/src/Mobs/Mooshroom.h
@@ -18,6 +18,7 @@ public:
CLASS_PROTODEF(cMooshroom);
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+ virtual void OnRightClicked(cPlayer & a_Player) override;
virtual const cItem GetFollowedItem(void) const override { return cItem(E_ITEM_WHEAT); }
} ;
diff --git a/src/Mobs/Pig.cpp b/src/Mobs/Pig.cpp
index e4e46dfec..e862f5aaa 100644
--- a/src/Mobs/Pig.cpp
+++ b/src/Mobs/Pig.cpp
@@ -21,7 +21,11 @@ cPig::cPig(void) :
void cPig::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_COOKED_PORKCHOP : E_ITEM_RAW_PORKCHOP);
if (m_bIsSaddled)
{
diff --git a/src/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp
index 622cb5ceb..47fcdbb26 100644
--- a/src/Mobs/Skeleton.cpp
+++ b/src/Mobs/Skeleton.cpp
@@ -20,28 +20,26 @@ cSkeleton::cSkeleton(bool IsWither) :
void cSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
if (IsWither())
{
- AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_BONE);
AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_COAL);
cItems RareDrops;
RareDrops.Add(cItem(E_ITEM_HEAD, 1, 1));
- if (!GetEquippedWeapon().IsEmpty()) RareDrops.Add(GetEquippedWeapon());
AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
}
else
{
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_ARROW);
- AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_BONE);
- cItems RareDrops;
- if (!GetEquippedHelmet().IsEmpty()) RareDrops.Add(GetEquippedHelmet());
- if (!GetEquippedChestplate().IsEmpty()) RareDrops.Add(GetEquippedChestplate());
- if (!GetEquippedLeggings().IsEmpty()) RareDrops.Add(GetEquippedLeggings());
- if (!GetEquippedBoots().IsEmpty()) RareDrops.Add(GetEquippedBoots());
- if (!GetEquippedWeapon().IsEmpty()) RareDrops.Add(GetEquippedWeapon());
- AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
+
}
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_BONE);
+ AddRandomArmorDropItem(a_Drops, LootingLevel);
+ AddRandomWeaponDropItem(a_Drops, LootingLevel);
}
diff --git a/src/Mobs/Slime.cpp b/src/Mobs/Slime.cpp
index 7941e2452..52a52bb39 100644
--- a/src/Mobs/Slime.cpp
+++ b/src/Mobs/Slime.cpp
@@ -20,7 +20,11 @@ cSlime::cSlime(int a_Size) :
void cSlime::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
if (GetSize() == 1)
{
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SLIMEBALL);
diff --git a/src/Mobs/Spider.cpp b/src/Mobs/Spider.cpp
index aeb6e1bcc..8b978ff6b 100644
--- a/src/Mobs/Spider.cpp
+++ b/src/Mobs/Spider.cpp
@@ -18,9 +18,13 @@ cSpider::cSpider(void) :
void cSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STRING);
- if (a_Killer->IsA("cPlayer") || a_Killer->IsA("cWolf"))
+ if ((a_Killer != NULL) && (a_Killer->IsPlayer() || a_Killer->IsA("cWolf")))
{
AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_SPIDER_EYE);
}
diff --git a/src/Mobs/Squid.cpp b/src/Mobs/Squid.cpp
index 4f2abf574..ba9171b39 100644
--- a/src/Mobs/Squid.cpp
+++ b/src/Mobs/Squid.cpp
@@ -21,7 +21,11 @@ cSquid::cSquid(void) :
void cSquid::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
// Drops 0-3 Ink Sacs
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
AddRandomDropItem(a_Drops, 0, 3 + LootingLevel, E_ITEM_DYE, E_META_DYE_BLACK);
}
diff --git a/src/Mobs/Witch.cpp b/src/Mobs/Witch.cpp
index 6cb103645..6956f7b7a 100644
--- a/src/Mobs/Witch.cpp
+++ b/src/Mobs/Witch.cpp
@@ -18,7 +18,11 @@ cWitch::cWitch(void) :
void cWitch::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
MTRand r1;
int DropTypeCount = (r1.randInt() % 3) + 1;
for (int i = 0; i < DropTypeCount; i++)
@@ -26,18 +30,16 @@ void cWitch::GetDrops(cItems & a_Drops, cEntity * a_Killer)
int DropType = r1.randInt() % 7;
switch (DropType)
{
- case 0: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GLASS_BOTTLE);
- case 1: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GLOWSTONE_DUST);
- case 2: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER);
- case 3: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_REDSTONE_DUST);
- case 4: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SPIDER_EYE);
- case 5: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STICK);
- case 6: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SUGAR);
+ case 0: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GLASS_BOTTLE); break;
+ case 1: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GLOWSTONE_DUST); break;
+ case 2: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER); break;
+ case 3: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_REDSTONE_DUST); break;
+ case 4: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SPIDER_EYE); break;
+ case 5: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STICK); break;
+ case 6: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SUGAR); break;
}
}
- cItems RareDrops;
- if (!GetEquippedWeapon().IsEmpty()) RareDrops.Add(GetEquippedWeapon());
- AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
+ AddRandomWeaponDropItem(a_Drops, LootingLevel);
}
diff --git a/src/Mobs/Zombie.cpp b/src/Mobs/Zombie.cpp
index 6a007683b..f19e096ee 100644
--- a/src/Mobs/Zombie.cpp
+++ b/src/Mobs/Zombie.cpp
@@ -23,18 +23,19 @@ cZombie::cZombie(bool a_IsVillagerZombie) :
void cZombie::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_ROTTEN_FLESH);
cItems RareDrops;
RareDrops.Add(cItem(E_ITEM_IRON));
RareDrops.Add(cItem(E_ITEM_CARROT));
RareDrops.Add(cItem(E_ITEM_POTATO));
- if (!GetEquippedHelmet().IsEmpty()) RareDrops.Add(GetEquippedHelmet());
- if (!GetEquippedChestplate().IsEmpty()) RareDrops.Add(GetEquippedChestplate());
- if (!GetEquippedLeggings().IsEmpty()) RareDrops.Add(GetEquippedLeggings());
- if (!GetEquippedBoots().IsEmpty()) RareDrops.Add(GetEquippedBoots());
- if (!GetEquippedWeapon().IsEmpty()) RareDrops.Add(GetEquippedWeapon());
AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
+ AddRandomArmorDropItem(a_Drops, LootingLevel);
+ AddRandomWeaponDropItem(a_Drops, LootingLevel);
}
diff --git a/src/Mobs/Zombiepigman.cpp b/src/Mobs/Zombiepigman.cpp
index ca222f9fe..a0142b566 100644
--- a/src/Mobs/Zombiepigman.cpp
+++ b/src/Mobs/Zombiepigman.cpp
@@ -19,14 +19,19 @@ cZombiePigman::cZombiePigman(void) :
void cZombiePigman::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(E_ENCHANTMENT_LOOTING);
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_ROTTEN_FLESH);
AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_GOLD_NUGGET);
cItems RareDrops;
RareDrops.Add(cItem(E_ITEM_GOLD));
- if (!GetEquippedWeapon().IsEmpty()) RareDrops.Add(GetEquippedWeapon());
AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
+ AddRandomArmorDropItem(a_Drops, LootingLevel);
+ AddRandomWeaponDropItem(a_Drops, LootingLevel);
}
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index 2a1eda523..c1c659b36 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -409,6 +409,14 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
m_Writer.BeginCompound("");
AddBasicEntity(a_Monster, EntityClass);
+ m_Writer.BeginList("DropChances", TAG_Float);
+ m_Writer.AddFloat("", a_Monster->GetDropChanceWeapon());
+ m_Writer.AddFloat("", a_Monster->GetDropChanceHelmet());
+ m_Writer.AddFloat("", a_Monster->GetDropChanceChestplate());
+ m_Writer.AddFloat("", a_Monster->GetDropChanceLeggings());
+ m_Writer.AddFloat("", a_Monster->GetDropChanceBoots());
+ m_Writer.EndList();
+ m_Writer.AddByte("CanPickUpLoot", (char)a_Monster->CanPickUpLoot());
switch (a_Monster->GetMobType())
{
case cMonster::mtBat:
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index d4490c7fe..05332d23d 100644
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -1485,6 +1485,11 @@ void cWSSAnvil::LoadBatFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NB
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1500,6 +1505,11 @@ void cWSSAnvil::LoadBlazeFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1515,6 +1525,11 @@ void cWSSAnvil::LoadCaveSpiderFromNBT(cEntityList & a_Entities, const cParsedNBT
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1530,6 +1545,11 @@ void cWSSAnvil::LoadChickenFromNBT(cEntityList & a_Entities, const cParsedNBT &
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1545,6 +1565,11 @@ void cWSSAnvil::LoadCowFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NB
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1560,6 +1585,11 @@ void cWSSAnvil::LoadCreeperFromNBT(cEntityList & a_Entities, const cParsedNBT &
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1575,6 +1605,11 @@ void cWSSAnvil::LoadEnderDragonFromNBT(cEntityList & a_Entities, const cParsedNB
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1591,6 +1626,11 @@ void cWSSAnvil::LoadEndermanFromNBT(cEntityList & a_Entities, const cParsedNBT &
return;
}
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -1606,6 +1646,11 @@ void cWSSAnvil::LoadGhastFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
return;
}
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -1620,6 +1665,11 @@ void cWSSAnvil::LoadGiantFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1646,6 +1696,11 @@ void cWSSAnvil::LoadHorseFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1661,6 +1716,11 @@ void cWSSAnvil::LoadIronGolemFromNBT(cEntityList & a_Entities, const cParsedNBT
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1682,6 +1742,11 @@ void cWSSAnvil::LoadMagmaCubeFromNBT(cEntityList & a_Entities, const cParsedNBT
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1697,6 +1762,11 @@ void cWSSAnvil::LoadMooshroomFromNBT(cEntityList & a_Entities, const cParsedNBT
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1712,6 +1782,11 @@ void cWSSAnvil::LoadOcelotFromNBT(cEntityList & a_Entities, const cParsedNBT & a
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1727,6 +1802,11 @@ void cWSSAnvil::LoadPigFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NB
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1748,6 +1828,11 @@ void cWSSAnvil::LoadSheepFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1763,6 +1848,11 @@ void cWSSAnvil::LoadSilverfishFromNBT(cEntityList & a_Entities, const cParsedNBT
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1784,6 +1874,11 @@ void cWSSAnvil::LoadSkeletonFromNBT(cEntityList & a_Entities, const cParsedNBT &
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1805,6 +1900,11 @@ void cWSSAnvil::LoadSlimeFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1820,6 +1920,11 @@ void cWSSAnvil::LoadSnowGolemFromNBT(cEntityList & a_Entities, const cParsedNBT
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1835,6 +1940,11 @@ void cWSSAnvil::LoadSpiderFromNBT(cEntityList & a_Entities, const cParsedNBT & a
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1850,6 +1960,11 @@ void cWSSAnvil::LoadSquidFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1871,6 +1986,11 @@ void cWSSAnvil::LoadVillagerFromNBT(cEntityList & a_Entities, const cParsedNBT &
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1886,6 +2006,11 @@ void cWSSAnvil::LoadWitchFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1901,6 +2026,11 @@ void cWSSAnvil::LoadWitherFromNBT(cEntityList & a_Entities, const cParsedNBT & a
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1916,6 +2046,10 @@ void cWSSAnvil::LoadWolfFromNBT(cEntityList & a_Entities, const cParsedNBT & a_N
{
return;
}
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
int OwnerIdx = a_NBT.FindChildByName(a_TagIdx, "Owner");
if (OwnerIdx > 0)
{
@@ -1964,6 +2098,11 @@ void cWSSAnvil::LoadZombieFromNBT(cEntityList & a_Entities, const cParsedNBT & a
{
return;
}
+
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
a_Entities.push_back(Monster.release());
}
@@ -1980,6 +2119,11 @@ void cWSSAnvil::LoadPigZombieFromNBT(cEntityList & a_Entities, const cParsedNBT
return;
}
+ if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -2023,6 +2167,27 @@ bool cWSSAnvil::LoadEntityBaseFromNBT(cEntity & a_Entity, const cParsedNBT & a_N
+bool cWSSAnvil::LoadMonsterBaseFromNBT(cMonster & a_Monster, const cParsedNBT & a_NBT, int a_TagIdx)
+{
+ float DropChance[5];
+ if (!LoadFloatsListFromNBT(DropChance, 5, a_NBT, a_NBT.FindChildByName(a_TagIdx, "DropChance")))
+ {
+ return false;
+ }
+ a_Monster.SetDropChanceWeapon(DropChance[0]);
+ a_Monster.SetDropChanceHelmet(DropChance[1]);
+ a_Monster.SetDropChanceChestplate(DropChance[2]);
+ a_Monster.SetDropChanceLeggings(DropChance[3]);
+ a_Monster.SetDropChanceBoots(DropChance[4]);
+ bool CanPickUpLoot = (a_NBT.GetByte(a_NBT.FindChildByName(a_TagIdx, "CanPickUpLoot")) == 1);
+ a_Monster.SetCanPickUpLoot(CanPickUpLoot);
+ return true;
+}
+
+
+
+
+
bool cWSSAnvil::LoadProjectileBaseFromNBT(cProjectileEntity & a_Entity, const cParsedNBT & a_NBT, int a_TagIdx)
{
if (!LoadEntityBaseFromNBT(a_Entity, a_NBT, a_TagIdx))
@@ -2065,6 +2230,24 @@ bool cWSSAnvil::LoadDoublesListFromNBT(double * a_Doubles, int a_NumDoubles, con
+bool cWSSAnvil::LoadFloatsListFromNBT(float * a_Floats, int a_NumFloats, const cParsedNBT & a_NBT, int a_TagIdx)
+{
+ if ((a_TagIdx < 0) || (a_NBT.GetType(a_TagIdx) != TAG_List) || (a_NBT.GetChildrenType(a_TagIdx) != TAG_Float))
+ {
+ return false;
+ }
+ int idx = 0;
+ for (int Tag = a_NBT.GetFirstChild(a_TagIdx); (Tag > 0) && (idx < a_NumFloats); Tag = a_NBT.GetNextSibling(Tag), ++idx)
+ {
+ a_Floats[idx] = a_NBT.GetFloat(Tag);
+ } // for Tag - PosTag[]
+ return (idx == a_NumFloats); // Did we read enough doubles?
+}
+
+
+
+
+
bool cWSSAnvil::GetBlockEntityNBTPos(const cParsedNBT & a_NBT, int a_TagIdx, int & a_X, int & a_Y, int & a_Z)
{
int x = a_NBT.FindChildByName(a_TagIdx, "x");
diff --git a/src/WorldStorage/WSSAnvil.h b/src/WorldStorage/WSSAnvil.h
index 541371560..4acf3f2a1 100644
--- a/src/WorldStorage/WSSAnvil.h
+++ b/src/WorldStorage/WSSAnvil.h
@@ -10,6 +10,7 @@
#include "WorldStorage.h"
#include "FastNBT.h"
+#include "../Mobs/Monster.h"
@@ -194,12 +195,18 @@ protected:
/// Loads entity common data from the NBT compound; returns true if successful
bool LoadEntityBaseFromNBT(cEntity & a_Entity, const cParsedNBT & a_NBT, int a_TagIdx);
+ /// Loads monster common data from the NBT compound; returns true if successful
+ bool LoadMonsterBaseFromNBT(cMonster & a_Monster, const cParsedNBT & a_NBT, int a_TagIdx);
+
/// Loads projectile common data from the NBT compound; returns true if successful
bool LoadProjectileBaseFromNBT(cProjectileEntity & a_Entity, const cParsedNBT & a_NBT, int a_TagIx);
/// Loads an array of doubles of the specified length from the specified NBT list tag a_TagIdx; returns true if successful
bool LoadDoublesListFromNBT(double * a_Doubles, int a_NumDoubles, const cParsedNBT & a_NBT, int a_TagIdx);
+ /// Loads an array of floats of the specified length from the specified NBT list tag a_TagIdx; returns true if successful
+ bool LoadFloatsListFromNBT(float * a_Floats, int a_NumFloats, const cParsedNBT & a_NBT, int a_TagIdx);
+
/// Helper function for extracting the X, Y, and Z int subtags of a NBT compound; returns true if successful
bool GetBlockEntityNBTPos(const cParsedNBT & a_NBT, int a_TagIdx, int & a_X, int & a_Y, int & a_Z);