Skip to content

Commit aec1111

Browse files
committed
Merge branch 'master' into release
2 parents 929a081 + 5d8fe1e commit aec1111

File tree

7 files changed

+44
-9
lines changed

7 files changed

+44
-9
lines changed

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ jobs:
3838
file: src/MiNET/MiNET.Console/minet.zip
3939
asset_name: MiNET.zip
4040
tag: ${{ github.ref }}
41-
release_name: MiNET-CobwebSMP 1.13.0.8 (1.20.70)
41+
release_name: MiNET-CobwebSMP 1.13.0.9 (1.20.70)
4242
body: ${{ github.event.head_commit.message }}

src/MiNET/MiNET.Client/McpeClientMessageHandlerBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ public virtual void HandleMcpeEntityEvent(McpeEntityEvent message)
260260

261261
public virtual void HandleMcpeMobEffect(McpeMobEffect message)
262262
{
263+
Log.Warn($"I got effect: {message.runtimeEntityId} / {message.eventId} / {message.effectId} / {message.amplifier} / {message.particles} / {message.duration} / {message.tick}");
263264
}
264265

265266
public virtual void HandleMcpeUpdateAttributes(McpeUpdateAttributes message)

src/MiNET/MiNET.Console/minet.zip

94 Bytes
Binary file not shown.

src/MiNET/MiNET/MiNET.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
44
<PackageId>MiNET-CobwebSMP</PackageId>
5-
<Version>1.13.0.8</Version>
5+
<Version>1.13.0.9</Version>
66
<Authors>gurun</Authors>
77
<Company>Niclas Olofsson</Company>
88
<Description>MiNET - a Minecraft PocketEdition Server</Description>

src/MiNET/MiNET/Net/MCPE Protocol.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
using MiNET.Utils.Metadata;
4242
using MiNET.Utils.Vectors;
4343
using MiNET.Utils.Nbt;
44-
using MiNET.Net;
4544

4645
namespace MiNET.Net
4746
{
@@ -2217,6 +2216,7 @@ public partial class McpeResourcePacksInfo : Packet<McpeResourcePacksInfo>
22172216
public bool forceServerPacks; // = null;
22182217
public ResourcePackInfos behahaviorpackinfos; // = null;
22192218
public TexturePackInfos texturepacks; // = null;
2219+
public uint cndUrls; // = null;
22202220

22212221
public McpeResourcePacksInfo()
22222222
{
@@ -2236,7 +2236,7 @@ protected override void EncodePacket()
22362236
Write(forceServerPacks);
22372237
Write(behahaviorpackinfos);
22382238
Write(texturepacks);
2239-
WriteUnsignedVarInt(0);
2239+
WriteUnsignedVarInt(cndUrls);
22402240

22412241
AfterEncode();
22422242
}
@@ -2256,6 +2256,7 @@ protected override void DecodePacket()
22562256
forceServerPacks = ReadBool();
22572257
behahaviorpackinfos = ReadResourcePackInfos();
22582258
texturepacks = ReadTexturePackInfos();
2259+
cndUrls = ReadUnsignedVarInt();
22592260

22602261
AfterDecode();
22612262
}
@@ -2273,6 +2274,7 @@ protected override void ResetPacket()
22732274
forceServerPacks=default(bool);
22742275
behahaviorpackinfos=default(ResourcePackInfos);
22752276
texturepacks=default(TexturePackInfos);
2277+
cndUrls= default(uint);
22762278
}
22772279

22782280
}
@@ -3655,7 +3657,7 @@ protected override void EncodePacket()
36553657
WriteSignedVarInt(amplifier);
36563658
Write(particles);
36573659
WriteSignedVarInt(duration);
3658-
WriteUnsignedVarLong(20);
3660+
Write(tick);
36593661

36603662
AfterEncode();
36613663
}
@@ -3675,7 +3677,7 @@ protected override void DecodePacket()
36753677
amplifier = ReadSignedVarInt();
36763678
particles = ReadBool();
36773679
duration = ReadSignedVarInt();
3678-
tick = ReadUnsignedVarLong();
3680+
tick = ReadLong();
36793681

36803682
AfterDecode();
36813683
}
@@ -4361,7 +4363,7 @@ protected override void EncodePacket()
43614363

43624364
WriteUnsignedVarLong(runtimeEntityId);
43634365
Write(velocity);
4364-
WriteUnsignedVarLong(20);
4366+
WriteUnsignedVarLong(tick);
43654367

43664368
AfterEncode();
43674369
}
@@ -8869,6 +8871,8 @@ protected override void ResetPacket()
88698871
public partial class McpeLevelEventGeneric : Packet<McpeLevelEventGeneric>
88708872
{
88718873

8874+
public int eventId; // = null;
8875+
public Nbt eventData; // = null;
88728876

88738877
public McpeLevelEventGeneric()
88748878
{
@@ -8882,6 +8886,8 @@ protected override void EncodePacket()
88828886

88838887
BeforeEncode();
88848888

8889+
WriteSignedVarInt(eventId);
8890+
Write(eventData);
88858891

88868892
AfterEncode();
88878893
}
@@ -8895,6 +8901,8 @@ protected override void DecodePacket()
88958901

88968902
BeforeDecode();
88978903

8904+
eventId = ReadSignedVarInt();
8905+
eventData = ReadNbt();
88988906

88998907
AfterDecode();
89008908
}
@@ -8906,6 +8914,8 @@ protected override void ResetPacket()
89068914
{
89078915
base.ResetPacket();
89088916

8917+
eventId = default(int);
8918+
eventData = default(Nbt);
89098919
}
89108920

89118921
}

src/MiNET/MiNET/Player.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3227,8 +3227,13 @@ public virtual void HandleMcpeBlockPickRequest(McpeBlockPickRequest message)
32273227
}
32283228

32293229
Block block = Level.GetBlock(message.x, message.y, message.z);
3230-
Log.Debug($"Picked block {block.Name} from blockstate {block.GetRuntimeId()}. Expected block to be in slot {message.selectedSlot}");
3231-
Item item = block.GetItem();
3230+
Log.Debug($"Picked block {block.Id}:{block.Metadata} from blockstate {block.GetRuntimeId()}. Expected block to be in slot {message.selectedSlot}");
3231+
var id = block.Id;
3232+
if (id > 255)
3233+
{
3234+
id = -(id - 255);
3235+
}
3236+
Item item = ItemFactory.GetItem((short) id, block.Metadata, 1);
32323237
if (item is ItemBlock blockItem)
32333238
{
32343239
Log.Debug($"Have BlockItem with block state {blockItem.Block.GetRuntimeId()}");

src/MiNET/MiNET/PlayerInventory.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,25 @@ private bool FirstEmptySlot(Item item, bool update, int si)
253253

254254
public bool AddItem(Item item, bool update)
255255
{
256+
for (int si = 0; si < Slots.Count; si++)
257+
{
258+
Item existingItem = Slots[si];
259+
260+
if (item.Id == existingItem.Id && item.Metadata == existingItem.Metadata)
261+
{
262+
int remainingCount = 64 - existingItem.Count;
263+
264+
if (remainingCount > 0)
265+
{
266+
int itemsToAdd = Math.Min(remainingCount, item.Count);
267+
Slots[si].Count += (byte) itemsToAdd;
268+
item.Count -= (byte) itemsToAdd;
269+
if (update) SendSetSlot(si);
270+
if (item.Count == 0) return true;
271+
}
272+
}
273+
}
274+
256275
for (int si = 0; si < Slots.Count; si++)
257276
{
258277
Item existingItem = Slots[si];

0 commit comments

Comments
 (0)