Upload from upload_mods.ps1
This commit is contained in:
48
Scripts/Network/NetPackageClearBagSlot.cs
Normal file
48
Scripts/Network/NetPackageClearBagSlot.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
public class NetPackageClearBagSlot : NetPackage
|
||||
{
|
||||
private int playerID;
|
||||
private int slot;
|
||||
|
||||
public NetPackageClearBagSlot Setup(int playerID, int slot)
|
||||
{
|
||||
this.playerID = playerID;
|
||||
this.slot = slot;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.playerID = _br.ReadInt32();
|
||||
this.slot = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.playerID);
|
||||
_bw.Write(this.slot);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
Log.Out("NetPackageClearBagSlot-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
Log.Out("NetPackageClearBagSlot-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (GameManager.Instance.World.GetEntity(this.playerID) is EntityPlayer player)
|
||||
{
|
||||
Log.Out("NetPackageClearBagSlot-ProcessPackage 2");
|
||||
player.bag.SetSlot(this.slot, ItemStack.Empty.Clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user