mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-14 03:51:07 +00:00
fix inventory
This commit is contained in:
parent
6239d88431
commit
76e5d006fc
1 changed files with 14 additions and 12 deletions
|
|
@ -2,18 +2,18 @@ module.exports=inject;
|
|||
|
||||
function inject(serv, player)
|
||||
{
|
||||
heldItemSlot=0;
|
||||
heldItem=0;
|
||||
inventory=new Array(44);
|
||||
player.heldItemSlot=0;
|
||||
player.heldItem=0;
|
||||
player.inventory=new Array(44);
|
||||
|
||||
player._client.on("held_item_slot", function (packet) {
|
||||
heldItemSlot = packet.slotId;
|
||||
if(inventory[36+heldItemSlot]===undefined){
|
||||
inventory[36+heldItemSlot]={
|
||||
player.heldItemSlot = packet.slotId;
|
||||
if(player.inventory[36+heldItemSlot]===undefined){
|
||||
player.inventory[36+heldItemSlot]={
|
||||
blockId:-1
|
||||
};
|
||||
}
|
||||
heldItem = inventory[36+heldItemSlot];
|
||||
player.heldItem = player.inventory[36+heldItemSlot];
|
||||
player._writeOthers("entity_equipment",{
|
||||
entityId:player.entity.id,
|
||||
slot:0,
|
||||
|
|
@ -22,7 +22,13 @@ function inject(serv, player)
|
|||
});
|
||||
|
||||
player._client.on("set_creative_slot", function (packet) {
|
||||
inventory[packet.slot]=packet.item;
|
||||
player.inventory[packet.slot]=packet.item;
|
||||
if (packet.slot==36)
|
||||
player._writeOthers("entity_equipment",{
|
||||
entityId:player.entity.id,
|
||||
slot:0,
|
||||
item:packet.item
|
||||
});
|
||||
if (packet.slot==5)
|
||||
player._writeOthers("entity_equipment",{
|
||||
entityId:player.entity.id,
|
||||
|
|
@ -49,8 +55,4 @@ function inject(serv, player)
|
|||
});
|
||||
|
||||
});
|
||||
|
||||
player.heldItem = heldItem;
|
||||
player.heldItemSlot = heldItemSlot;
|
||||
player.inventory = inventory;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue