Skip to content

Commit 7ec6b4d

Browse files
committed
1.21.80
1 parent 7139f9e commit 7ec6b4d

File tree

11 files changed

+2683
-2572
lines changed

11 files changed

+2683
-2572
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ MiNET (CobwebSMP edition)
55
[![NuGet Version](https://img.shields.io/nuget/v/MiNET-CobwebSMP.svg)
66
[![Downloads count](https://img.shields.io/nuget/dt/MiNET-CobwebSMP.svg)
77

8+
## Warning!
9+
10+
As a result of our network shut down updates for this software may be delayed, incomplete or even stopped.
11+
Consider migrating to: [CRPE-Team/MiNET](https://github.com/CRPE-Team/MiNET)
12+
813
## What is this?
914

1015
This is fork of [MiNET](https://github.com/NiclasOlofsson/MiNET), that includes additional changes and features:

src/MiNET/MiNET.Client/BedrockTraceHandler.cs

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -771,22 +771,36 @@ public override void HandleMcpeAvailableEntityIdentifiers(McpeAvailableEntityIde
771771

772772
public override void HandleMcpeBiomeDefinitionList(McpeBiomeDefinitionList message)
773773
{
774-
NbtCompound list = new NbtCompound("");
775-
foreach (var biome in message.namedtag.NbtFile.RootTag as NbtCompound)
774+
var sb = new StringBuilder();
775+
776+
sb.AppendLine("public class BiomeUtils");
777+
sb.AppendLine("{");
778+
sb.AppendLine("\tpublic static Biome[] Biomes =");
779+
sb.AppendLine("\t{");
780+
781+
int index = 0;
782+
foreach (var biome in message.biomes)
776783
{
777-
string biomeName = biome.Name;
778-
float downfall = (biome["downfall"] as NbtFloat).Value;
779-
float temperature = (biome["temperature"] as NbtFloat).Value;
780-
list.Add(
781-
new NbtCompound(biomeName)
782-
{
783-
new NbtFloat("temperature", temperature),
784-
new NbtFloat("downfall", downfall),
785-
}
786-
);
784+
string defName = biome.DefinitionName;
785+
string displayName = string.Join(" ", defName.Split('_').Select(word => char.ToUpper(word[0]) + word.Substring(1)));
786+
787+
sb.AppendLine("\t\tnew Biome");
788+
sb.AppendLine("\t\t{");
789+
sb.AppendLine($"\t\t\tId = {index},");
790+
sb.AppendLine($"\t\t\tName = \"{displayName}\",");
791+
sb.AppendLine($"\t\t\tDefinitionName = \"{defName}\",");
792+
sb.AppendLine($"\t\t\tTemperature = {biome.Temperature.ToString("0.0")}f,");
793+
sb.AppendLine($"\t\t\tDownfall = {biome.Downfall.ToString("0.0")}f");
794+
sb.AppendLine(index < message.biomes.Count() - 1 ? "\t\t}," : "\t\t}");
795+
index++;
787796
}
788797

789-
File.WriteAllText("newResources/biomes.txt", list.ToString());
798+
sb.AppendLine("\t};");
799+
sb.AppendLine("}");
800+
801+
Directory.CreateDirectory("newResources");
802+
File.WriteAllText("newResources/biomes.txt", sb.ToString());
803+
790804
Log.Warn("Received biome definitions exported to newResources/biomes.txt\n");
791805
}
792806

src/MiNET/MiNET.Console/server.conf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ ForceResourcePacks=false
8989
# ======================================= ADVANCED =======================================
9090
# Change this only on purpose. Don't touch if you are not sure.
9191

92-
#Use Server-Authoritative movement system.
93-
ServerAuthoritativeMovement=true
94-
9592
#Should server check if player is logged in Xbox Live? In public server this should be true to avoid fake usernames.
9693
ForceXBLAuthentication=true
9794

src/MiNET/MiNET/LoginMessageHandler.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -697,10 +697,6 @@ public void HandleMcpeBlockEntityData(McpeBlockEntityData message)
697697
{
698698
}
699699

700-
public void HandleMcpePlayerInput(McpePlayerInput message)
701-
{
702-
}
703-
704700
public void HandleMcpeSetPlayerGameType(McpeSetPlayerGameType message)
705701
{
706702
}

src/MiNET/MiNET/Net/BedrockMessageHandler.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,6 @@ private void HandleBedrockMessage(IMcpeMessageHandler handler, Packet message)
180180
case McpeItemStackRequest nms:
181181
handler.HandleMcpeItemStackRequest(nms);
182182
break;
183-
case McpePlayerInput msg:
184-
handler.HandleMcpePlayerInput(msg);
185-
break;
186183
case McpeRiderJump msg:
187184
handler.HandleMcpeRiderJump(msg);
188185
break;

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

Lines changed: 7 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,14 @@
4040
using MiNET.Utils.Nbt;
4141
using System.Linq;
4242
using System.Collections.Generic;
43+
using MiNET.Worlds;
4344

4445
namespace MiNET.Net
4546
{
4647
public class McpeProtocolInfo
4748
{
48-
public const int ProtocolVersion = 786;
49-
public const string GameVersion = "1.21.70";
49+
public const int ProtocolVersion = 800;
50+
public const string GameVersion = "1.21.80";
5051
}
5152

5253
public interface IMcpeMessageHandler
@@ -79,7 +80,6 @@ public interface IMcpeMessageHandler
7980
void HandleMcpeCraftingEvent(McpeCraftingEvent message);
8081
void HandleMcpeAdventureSettings(McpeAdventureSettings message);
8182
void HandleMcpeBlockEntityData(McpeBlockEntityData message);
82-
void HandleMcpePlayerInput(McpePlayerInput message);
8383
void HandleMcpeSetPlayerGameType(McpeSetPlayerGameType message);
8484
void HandleMcpeMapInfoRequest(McpeMapInfoRequest message);
8585
void HandleMcpeRequestChunkRadius(McpeRequestChunkRadius message);
@@ -837,8 +837,6 @@ public static Packet Create(short messageId, ReadOnlyMemory<byte> buffer, string
837837
return McpeAdventureSettings.CreateObject().Decode(buffer);
838838
case 0x38:
839839
return McpeBlockEntityData.CreateObject().Decode(buffer);
840-
case 0x39:
841-
return McpePlayerInput.CreateObject().Decode(buffer);
842840
case 0x3a:
843841
return McpeLevelChunk.CreateObject().Decode(buffer);
844842
case 0x3b:
@@ -5241,66 +5239,6 @@ protected override void ResetPacket()
52415239

52425240
}
52435241

5244-
public partial class McpePlayerInput : Packet<McpePlayerInput>
5245-
{
5246-
5247-
public float motionX; // = null;
5248-
public float motionZ; // = null;
5249-
public bool jumping; // = null;
5250-
public bool sneaking; // = null;
5251-
5252-
public McpePlayerInput()
5253-
{
5254-
Id = 0x39;
5255-
IsMcpe = true;
5256-
}
5257-
5258-
protected override void EncodePacket()
5259-
{
5260-
base.EncodePacket();
5261-
5262-
BeforeEncode();
5263-
5264-
Write(motionX);
5265-
Write(motionZ);
5266-
Write(jumping);
5267-
Write(sneaking);
5268-
5269-
AfterEncode();
5270-
}
5271-
5272-
partial void BeforeEncode();
5273-
partial void AfterEncode();
5274-
5275-
protected override void DecodePacket()
5276-
{
5277-
base.DecodePacket();
5278-
5279-
BeforeDecode();
5280-
5281-
motionX = ReadFloat();
5282-
motionZ = ReadFloat();
5283-
jumping = ReadBool();
5284-
sneaking = ReadBool();
5285-
5286-
AfterDecode();
5287-
}
5288-
5289-
partial void BeforeDecode();
5290-
partial void AfterDecode();
5291-
5292-
protected override void ResetPacket()
5293-
{
5294-
base.ResetPacket();
5295-
5296-
motionX=default(float);
5297-
motionZ=default(float);
5298-
jumping=default(bool);
5299-
sneaking=default(bool);
5300-
}
5301-
5302-
}
5303-
53045242
public partial class McpeLevelChunk : Packet<McpeLevelChunk>
53055243
{
53065244

@@ -8604,7 +8542,7 @@ protected override void ResetPacket()
86048542
public partial class McpeBiomeDefinitionList : Packet<McpeBiomeDefinitionList>
86058543
{
86068544

8607-
public Nbt namedtag; // = null;
8545+
public Biome[] biomes; // = null;
86088546

86098547
public McpeBiomeDefinitionList()
86108548
{
@@ -8618,7 +8556,7 @@ protected override void EncodePacket()
86188556

86198557
BeforeEncode();
86208558

8621-
Write(namedtag);
8559+
Write(biomes);
86228560

86238561
AfterEncode();
86248562
}
@@ -8632,7 +8570,7 @@ protected override void DecodePacket()
86328570

86338571
BeforeDecode();
86348572

8635-
namedtag = ReadNbt();
8573+
biomes = ReadBiomes();
86368574

86378575
AfterDecode();
86388576
}
@@ -8644,7 +8582,7 @@ protected override void ResetPacket()
86448582
{
86458583
base.ResetPacket();
86468584

8647-
namedtag=default(Nbt);
8585+
biomes = default(Biome[]);
86488586
}
86498587

86508588
}

src/MiNET/MiNET/Net/Packet.cs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
using MiNET.Utils.Nbt;
4949
using MiNET.Utils.Skins;
5050
using MiNET.Utils.Vectors;
51+
using MiNET.Worlds;
5152
using Newtonsoft.Json;
5253
using static MiNET.Net.McpePlayerAuthInput;
5354

@@ -530,6 +531,7 @@ public void Write(PlayerRecords records)
530531
Write(false); // is teacher
531532
Write(false); // is host
532533
Write(false); // subclient?
534+
Write(0); //color
533535
}
534536
}
535537
else if (records is PlayerRemoveRecords)
@@ -575,6 +577,7 @@ public PlayerRecords ReadPlayerRecords()
575577
ReadBool(); // is teacher
576578
ReadBool(); // is host
577579
ReadBool(); // is subclient
580+
ReadInt(); //color
578581

579582
player.PlayerInfo = new PlayerInfo()
580583
{
@@ -3986,6 +3989,60 @@ public void Write(fogStack stack)
39863989
}
39873990
}
39883991

3992+
public void Write(Biome[] biomes)
3993+
{
3994+
WriteUnsignedVarInt((uint)biomes.Count());
3995+
for (short i = 0; i < biomes.Count(); i++)
3996+
{
3997+
Write(i);
3998+
Write(false);
3999+
Write(biomes[i].Temperature);
4000+
Write(biomes[i].Downfall);
4001+
Write(biomes[i].RedSporeDensity);
4002+
Write(biomes[i].BlueSporeDensity);
4003+
Write(biomes[i].AshDensity);
4004+
Write(biomes[i].WhiteAshDensity);
4005+
Write(biomes[i].Depth);
4006+
Write(biomes[i].Scale);
4007+
Write(biomes[i].WaterColor);
4008+
Write(biomes[i].Downfall > 0 ? true : false);
4009+
Write(false);
4010+
Write(false);
4011+
}
4012+
4013+
WriteUnsignedVarInt((uint)biomes.Count());
4014+
foreach (Biome biome in biomes)
4015+
{
4016+
Write(biome.DefinitionName);
4017+
}
4018+
}
4019+
4020+
public Biome[] ReadBiomes()
4021+
{
4022+
var biomeCount = ReadUnsignedVarInt();
4023+
var biomes = new Biome[biomeCount];
4024+
for (int i = 0; i < biomeCount; i++)
4025+
{
4026+
var biome = new Biome();
4027+
if (ReadBool())
4028+
{
4029+
biome.Id = ReadShort();
4030+
}
4031+
biome.Temperature = ReadFloat();
4032+
biome.Downfall = ReadFloat();
4033+
//.....
4034+
biomes[i] = biome;
4035+
}
4036+
4037+
var biomeNameCount = ReadUnsignedVarInt();
4038+
for (int i = 0; i < biomeNameCount; i++)
4039+
{
4040+
biomes[i].DefinitionName = ReadString();
4041+
}
4042+
4043+
return biomes;
4044+
}
4045+
39894046
public bool CanRead()
39904047
{
39914048
return _reader.Position < _reader.Length;

src/MiNET/MiNET/Player.cs

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,6 @@ public virtual void SendResourcePackStack()
508508
SendPacket(packStack);
509509
}
510510

511-
public virtual void HandleMcpePlayerInput(McpePlayerInput message)
512-
{
513-
Log.Debug($"Player input: x={message.motionX}, z={message.motionZ}, jumping={message.jumping}, sneaking={message.sneaking}");
514-
}
515-
516511
public virtual void HandleMcpeRiderJump(McpeRiderJump message)
517512
{
518513
if (IsRiding && Vehicle > 0)
@@ -1215,18 +1210,8 @@ public virtual void SendAvailableEntityIdentifiers()
12151210

12161211
public virtual void SendBiomeDefinitionList()
12171212
{
1218-
var nbt = new Nbt
1219-
{
1220-
NbtFile = new NbtFile
1221-
{
1222-
BigEndian = false,
1223-
UseVarInt = true,
1224-
RootTag = BiomeUtils.GenerateDefinitionList(),
1225-
}
1226-
};
1227-
12281213
var pk = McpeBiomeDefinitionList.CreateObject();
1229-
pk.namedtag = nbt;
1214+
pk.biomes = BiomeUtils.Biomes;
12301215
SendPacket(pk);
12311216
}
12321217

@@ -3456,13 +3441,9 @@ public void SendStartGame()
34563441
startGame.isTrial = false;
34573442
startGame.currentTick = Level.TickTime;
34583443
startGame.enchantmentSeed = 123456;
3459-
if (Config.GetProperty("ServerAuthoritativeMovement", true))
3460-
{
3461-
startGame.movementType = 3;
3462-
startGame.movementRewindHistorySize = 40;
3463-
startGame.enableNewBlockBreakSystem = true;
3464-
}
3465-
3444+
startGame.movementType = 2;
3445+
startGame.movementRewindHistorySize = 40;
3446+
startGame.enableNewBlockBreakSystem = true;
34663447
startGame.enableNewInventorySystem = true;
34673448
startGame.blockPaletteChecksum = 0;
34683449
startGame.serverVersion = McpeProtocolInfo.GameVersion;

0 commit comments

Comments
 (0)