Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.19 update #638

Open
wants to merge 67 commits into
base: master
Choose a base branch
from
Open

Conversation

DarkLexFirst
Copy link
Contributor

No description provided.

@kennyvv
Copy link
Collaborator

kennyvv commented Oct 23, 2023

Thank you for submitting! I'll need a bit to go through all of the changes, as said on discord.

Copy link
Collaborator

@kennyvv kennyvv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I still need to test it, but it looks very promising. Could you check my feedback? It's mainly a few small things

@@ -4,6 +4,7 @@ on:
push:
branches:
- master
- 1.19-update
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -107,7 +107,7 @@
</appender>

<root>
<level value="INFO" />
<level value="TRACE" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you put the default back to INFO?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 50 to 61
// TODO - 1.19-update

//foreach (KeyValuePair<string, int> keyValuePair in ItemFactory.IdToRuntimeId)
//{
// if(keyValuePair.Key.Equals("sapling")) Console.WriteLine(keyValuePair.Key);
//}
//var itemId = ItemFactory.GetItemIdByName("minecraft:sapling");
//Assert.AreEqual(6, itemId);

//Item item = ItemFactory.GetItem("minecraft:sapling");
//Assert.AreEqual("minecraft:sapling", item.Name);
//Assert.IsNotNull(item as ItemBlock);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you fix this? Could change it into ID based

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it makes any sense now...

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

speaking in general, as a testing automation engineer in the past, I can say that the MINET auto tests look bad.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I'm done with the features, I could write some good tests.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of the current tests are... Not great, i agree with that. It would be nice to get some proper ones at some point!

Copy link
Contributor Author

@DarkLexFirst DarkLexFirst Nov 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it so that it would at least test something.

src/MiNET/MiNET/Blocks/Block.cs Outdated Show resolved Hide resolved
src/MiNET/MiNET/Blocks/Block.cs Show resolved Hide resolved
src/MiNET/MiNET/Plugins/PluginManager.cs Outdated Show resolved Hide resolved
src/MiNET/MiNET/Worlds/BlockDataCompressionUtils.cs Outdated Show resolved Hide resolved
@@ -189,7 +189,9 @@ public ChunkColumn GetChunk(ChunkCoordinates coordinates, IWorldGenerator genera
if (flatDataBytes != null)
{
Buffer.BlockCopy(flatDataBytes.AsSpan().Slice(0, 512).ToArray(), 0, chunkColumn.height, 0, 512);
chunkColumn.biomeId = flatDataBytes.AsSpan().Slice(512, 256).ToArray();

// TODO - 1.20 - update
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance you could look into loading the biome id's in still?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be supported, since the client is currently working with 3d chunks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be active?

// TODO - 1.20 - update
//for (int i = 0; i < chunk.biomeId.Length; i++)
//{
// chunk.biomeId[i] = biomeId;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance you could keep this working?

Copy link
Contributor Author

@DarkLexFirst DarkLexFirst Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not? But before that, I need to rework data storage in chunks, since the current one is outdated and inconvenient.

When I'm done, it will turn into something like:

subChunk.Biomes.Fill(id);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be active?

src/MiNET/MiNET/Player.cs Outdated Show resolved Hide resolved
@@ -1189,7 +1317,7 @@ public virtual void Teleport(PlayerLocation newPosition)
Monitor.Exit(_teleportSync);
}

MiNetServer.FastThreadPool.QueueUserWorkItem(SendChunksForKnownPosition);
//MiNetServer.FastThreadPool.QueueUserWorkItem(SendChunksForKnownPosition);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for not doing this anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chunks are often sent before the client can process them, because of this they are lost.
The most correct solution is to send them only after teleportation. After that, they will not go, since MINET thinks that the player has already received them.

@@ -1176,7 +1303,8 @@ public virtual void Teleport(PlayerLocation newPosition)
HeadYaw = 91,
});

ForcedSendChunk(newPosition);
//ForcedSendChunk(newPosition);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for not doing this anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this particular case can be returned, but I'm afraid to cache it, since the player may lose it again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -1670,14 +1799,14 @@ public virtual void SpawnLevel(Level toLevel, PlayerLocation spawnPoint, bool us

SetNoAi(oldNoAi);

ForcedSendChunks(() =>
{
//ForcedSendChunks(() =>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for not doing this anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chunks are often sent before the client can process them, because of this they are lost.
The most correct solution is to send them only after teleportation. After that, they will not go, since MINET thinks that the player has already received them.

@@ -1659,7 +1787,8 @@ public virtual void SpawnLevel(Level toLevel, PlayerLocation spawnPoint, bool us

CleanCache();

ForcedSendChunk(SpawnPosition);
//ForcedSendChunk(SpawnPosition);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for not doing this anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this particular case can be returned, but I'm afraid to cache it, since the player may lose it again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -2236,6 +2294,23 @@ public void HandleMcpeSubChunkRequestPacket(McpeSubChunkRequestPacket message)
SendPacket(response);*/
}

public virtual void HandleMcpeRequestAbility(McpeRequestAbility message)
{
if (message.ability == 18) // flying??
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have doubts this is correct

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it important to fix this as part of this PR?

@@ -32,26 +32,46 @@

namespace MiNET.Utils.IO
{
//TODO - rework on NONE and ZLib instances
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is it you want to rework exactly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split into two implementations: without compression and with ZLib compression.
Since now before sending McpeNetworkSettings we should not use compression. And it's not the same as ZLib "NoCompression"

@@ -673,7 +676,7 @@ internal async Task UpdateAsync(RakSession session)

long elapsedTime = datagram.Timer.ElapsedMilliseconds;
long datagramTimeout = rto * (datagram.TransmissionCount + session.ResendCount + 1);
datagramTimeout = Math.Min(datagramTimeout, 3000);
//datagramTimeout = Math.Min(datagramTimeout, 3000);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, i still feel like it'd be good to atleast have A timeout to avoid filling memory with crap. Maybe make it configurable using the config.

@@ -84,7 +84,7 @@ internal void HandleOfflineRakMessage(ReadOnlyMemory<byte> receiveBytes, IPEndPo
// Shortcut to reply fast, and no parsing
if (messageType == DefaultMessageIdTypes.ID_OPEN_CONNECTION_REQUEST_1)
{
if (!_greyListManager.AcceptConnection(senderEndpoint.Address))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd still like to see this be put back as it was.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still waiting for an explanation why this shouldn't be, since the old implementation doesn't allow whitelist clients by Endpoint and not Ip but at least for me, this feature is critically important. It doesn't affect performance or anything else in any way.

@@ -68,7 +68,7 @@ public class HighPrecisionTimer : IDisposable
public long Avarage = 0;


public HighPrecisionTimer(int interval, Action<object> action, bool useSignaling = false, bool skipTicks = true)
public HighPrecisionTimer(int interval, Action<object> action, bool useSignaling = false, bool skipTicks = true, bool highPrecision = false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highprecision should default to true

Copy link
Contributor Author

@DarkLexFirst DarkLexFirst Oct 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think you're right

but then the question is whether we need high precision in SkyLightCalculations.Calculate
https://github.com/NiclasOlofsson/MiNET/blob/df0d4ffb8c008654271e0c94187cada0abf6a30b/src/MiNET/MiNET/Worlds/SkyLightCalculations.cs#L182C4-L182C4

and may I set the highPrecision parameter from Config in the same way as it is done in Level for RakConnection SendTick timer? or does it need a different configuration name?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still like to see this reverted back.

@kennyvv
Copy link
Collaborator

kennyvv commented Oct 29, 2023

Overall looking good at this point, just a few more things. Mainly the greylistmanager change from "ipaddress" to "ipendpoint" that one makes no sense to me. Could you answer my remaining questions?

@theaddonn
Copy link

Is this still the 1.19 update?
We're on 1.21 already XD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants