mirror of
https://github.com/neoStudiosLCE/neoLegacy.git
synced 2026-06-09 00:33:00 +00:00
Feat: Armour Quick Equip, Fix: Baby Armour on Players
This commit is contained in:
parent
490ac0eed1
commit
c038506071
|
|
@ -229,9 +229,47 @@ const WCHAR *ConsoleSoundEngine::wchSoundNames[eSoundType_MAX]=
|
|||
L"mob.rabbit.bunnymurder",
|
||||
L"mob.rabbit.hop",
|
||||
|
||||
|
||||
L"item.armor.equip_leather1",
|
||||
L"item.armor.equip_leather2",
|
||||
L"item.armor.equip_leather3",
|
||||
L"item.armor.equip_leather4",
|
||||
L"item.armor.equip_leather5",
|
||||
L"item.armor.equip_leather6",
|
||||
|
||||
L"item.armor.equip_chain1",
|
||||
L"item.armor.equip_chain2",
|
||||
L"item.armor.equip_chain3",
|
||||
L"item.armor.equip_chain4",
|
||||
L"item.armor.equip_chain5",
|
||||
L"item.armor.equip_chain6",
|
||||
|
||||
L"item.armor.equip_iron1",
|
||||
L"item.armor.equip_iron2",
|
||||
L"item.armor.equip_iron3",
|
||||
L"item.armor.equip_iron4",
|
||||
L"item.armor.equip_iron5",
|
||||
L"item.armor.equip_iron6",
|
||||
|
||||
L"item.armor.equip_gold1",
|
||||
L"item.armor.equip_gold2",
|
||||
L"item.armor.equip_gold3",
|
||||
L"item.armor.equip_gold4",
|
||||
L"item.armor.equip_gold5",
|
||||
L"item.armor.equip_gold6",
|
||||
|
||||
L"item.armor.equip_diamond1",
|
||||
L"item.armor.equip_diamond2",
|
||||
L"item.armor.equip_diamond3",
|
||||
L"item.armor.equip_diamond4",
|
||||
L"item.armor.equip_diamond5",
|
||||
L"item.armor.equip_diamond6",
|
||||
|
||||
L"item.armor.equip_generic1",
|
||||
L"item.armor.equip_generic2",
|
||||
L"item.armor.equip_generic3",
|
||||
L"item.armor.equip_generic4",
|
||||
L"item.armor.equip_generic5",
|
||||
L"item.armor.equip_generic6"
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2646,6 +2646,28 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
|||
case Item::writtenBook_Id:
|
||||
*piUse = IDS_TOOLTIPS_READ;
|
||||
break;
|
||||
case Item::helmet_leather_Id:
|
||||
case Item::helmet_chain_Id:
|
||||
case Item::helmet_iron_Id:
|
||||
case Item::helmet_gold_Id:
|
||||
case Item::helmet_diamond_Id:
|
||||
case Item::chestplate_leather_Id:
|
||||
case Item::chestplate_chain_Id:
|
||||
case Item::chestplate_iron_Id:
|
||||
case Item::chestplate_gold_Id:
|
||||
case Item::chestplate_diamond_Id:
|
||||
case Item::leggings_leather_Id:
|
||||
case Item::leggings_chain_Id:
|
||||
case Item::leggings_iron_Id:
|
||||
case Item::leggings_gold_Id:
|
||||
case Item::leggings_diamond_Id:
|
||||
case Item::boots_leather_Id:
|
||||
case Item::boots_chain_Id:
|
||||
case Item::boots_iron_Id:
|
||||
case Item::boots_gold_Id:
|
||||
case Item::boots_diamond_Id:
|
||||
*piUse = IDS_TOOLTIPS_EQUIP;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
Model::Model()
|
||||
{
|
||||
riding = false;
|
||||
young=true;
|
||||
young=false; //andi change
|
||||
texWidth=64;
|
||||
texHeight=32;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -324,6 +324,7 @@ bool ServerPlayerGameMode::useItem(shared_ptr<Player> player, Level *level, shar
|
|||
player->inventory->items[player->inventory->selected] = itemInstance;
|
||||
if (isCreative())
|
||||
{
|
||||
//if (!(Item::items[itemInstance->id]->getBaseItemType() == 7 || Item::items[itemInstance->id]->getBaseItemType() == 8 || Item::items[itemInstance->id]->getBaseItemType() == 9 || Item::items[itemInstance->id]->getBaseItemType() == 10))
|
||||
itemInstance->count = oldCount;
|
||||
if (itemInstance->isDamageableItem()) itemInstance->setAuxValue(oldAux);
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,4 +1,5 @@
|
|||
#include "stdafx.h"
|
||||
#include <random>
|
||||
#include "../Minecraft.Client/Minecraft.h"
|
||||
#include "net.minecraft.world.h"
|
||||
#include "net.minecraft.world.level.tile.h"
|
||||
|
|
@ -128,6 +129,54 @@ ArmorItem::ArmorItem(int id, const ArmorMaterial *armorType, int icon, int slot)
|
|||
DispenserTile::REGISTRY.add(this, new ArmorDispenseItemBehavior());
|
||||
}
|
||||
|
||||
shared_ptr<ItemInstance> ArmorItem::use(shared_ptr<ItemInstance> instance, Level* level, shared_ptr<Player> player) {
|
||||
int slot = Mob::getEquipmentSlotForItem(instance) - 1;
|
||||
|
||||
// If player is in survival mode (not creative)
|
||||
if (!player->abilities.instabuild) { //
|
||||
// Equip the armor to the appropriate slot
|
||||
ItemInstance copy = *instance->copy_not_shared();
|
||||
if (player->inventory->armor[slot] == nullptr) {
|
||||
player->inventory->armor[slot] = make_shared<ItemInstance>(copy);
|
||||
player->inventory->removeItemNoUpdate(player->inventory->selected);
|
||||
// Remove the item from hand (set count to 0)
|
||||
instance->count = 0;
|
||||
}
|
||||
else {
|
||||
player->inventory->setItem(player->inventory->selected, player->inventory->armor[slot]);
|
||||
player->inventory->armor[slot] = make_shared<ItemInstance>(copy);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ItemInstance copy = *instance->copy_not_shared();
|
||||
if (player->inventory->armor[slot] == nullptr) {
|
||||
player->inventory->armor[slot] = make_shared<ItemInstance>(copy);
|
||||
}
|
||||
else {
|
||||
player->inventory->setItem(player->inventory->selected, player->inventory->armor[slot]);
|
||||
player->inventory->armor[slot] = make_shared<ItemInstance>(copy);
|
||||
}
|
||||
}
|
||||
|
||||
int material = Item::items[instance->id]->getMaterial();
|
||||
int lo, hi;
|
||||
switch (material) {
|
||||
case Item::eMaterial_cloth: lo = 194; hi = 199; break;
|
||||
case Item::eMaterial_chain: lo = 200; hi = 205; break;
|
||||
case Item::eMaterial_iron: lo = 206; hi = 211; break;
|
||||
case Item::eMaterial_gold: lo = 212; hi = 217; break;
|
||||
case Item::eMaterial_diamond: lo = 218; hi = 223; break;
|
||||
default: lo = 224; hi = 229; break;
|
||||
}
|
||||
|
||||
std::mt19937 rng(std::random_device{}());
|
||||
std::uniform_int_distribution<int> dist(lo, hi);
|
||||
player->playSound(dist(rng), 0.5f, 1.0f);
|
||||
|
||||
// Return the (now empty) instance
|
||||
return instance;
|
||||
}
|
||||
|
||||
int ArmorItem::getColor(shared_ptr<ItemInstance> item, int spriteLayer)
|
||||
{
|
||||
if (spriteLayer > 0)
|
||||
|
|
|
|||
|
|
@ -87,5 +87,7 @@ public:
|
|||
virtual bool isValidRepairItem(shared_ptr<ItemInstance> source, shared_ptr<ItemInstance> repairItem);
|
||||
virtual void registerIcons(IconRegister *iconRegister);
|
||||
|
||||
virtual shared_ptr<ItemInstance> use(shared_ptr<ItemInstance> instance, Level* level, shared_ptr<Player> player);
|
||||
|
||||
static Icon *getEmptyIcon(int slot);
|
||||
};
|
||||
|
|
@ -218,7 +218,47 @@ enum eSOUND_TYPE
|
|||
eSoundType_MOB_RABBIT_DEATH,
|
||||
eSoundType_MOB_RABBIT_HOP,
|
||||
|
||||
eSoundType_ITEM_ARMOR_equipLeather1,
|
||||
eSoundType_ITEM_ARMOR_equipLeather2,
|
||||
eSoundType_ITEM_ARMOR_equipLeather3,
|
||||
eSoundType_ITEM_ARMOR_equipLeather4,
|
||||
eSoundType_ITEM_ARMOR_equipLeather5,
|
||||
eSoundType_ITEM_ARMOR_equipLeather6,
|
||||
|
||||
eSoundType_ITEM_ARMOR_equipChain1,
|
||||
eSoundType_ITEM_ARMOR_equipChain2,
|
||||
eSoundType_ITEM_ARMOR_equipChain3,
|
||||
eSoundType_ITEM_ARMOR_equipChain4,
|
||||
eSoundType_ITEM_ARMOR_equipChain5,
|
||||
eSoundType_ITEM_ARMOR_equipChain6,
|
||||
|
||||
eSoundType_ITEM_ARMOR_equipIron1,
|
||||
eSoundType_ITEM_ARMOR_equipIron2,
|
||||
eSoundType_ITEM_ARMOR_equipIron3,
|
||||
eSoundType_ITEM_ARMOR_equipIron4,
|
||||
eSoundType_ITEM_ARMOR_equipIron5,
|
||||
eSoundType_ITEM_ARMOR_equipIron6,
|
||||
|
||||
eSoundType_ITEM_ARMOR_equipGold1,
|
||||
eSoundType_ITEM_ARMOR_equipGold2,
|
||||
eSoundType_ITEM_ARMOR_equipGold3,
|
||||
eSoundType_ITEM_ARMOR_equipGold4,
|
||||
eSoundType_ITEM_ARMOR_equipGold5,
|
||||
eSoundType_ITEM_ARMOR_equipGold6,
|
||||
|
||||
eSoundType_ITEM_ARMOR_equipDiamond1,
|
||||
eSoundType_ITEM_ARMOR_equipDiamond2,
|
||||
eSoundType_ITEM_ARMOR_equipDiamond3,
|
||||
eSoundType_ITEM_ARMOR_equipDiamond4,
|
||||
eSoundType_ITEM_ARMOR_equipDiamond5,
|
||||
eSoundType_ITEM_ARMOR_equipDiamond6,
|
||||
|
||||
eSoundType_ITEM_ARMOR_equipGeneric1,
|
||||
eSoundType_ITEM_ARMOR_equipGeneric2,
|
||||
eSoundType_ITEM_ARMOR_equipGeneric3,
|
||||
eSoundType_ITEM_ARMOR_equipGeneric4,
|
||||
eSoundType_ITEM_ARMOR_equipGeneric5,
|
||||
eSoundType_ITEM_ARMOR_equipGeneric6,
|
||||
|
||||
eSoundType_MAX
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue