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
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
55e57dc
Start updating to 1.19.10
kennyvv Jul 22, 2022
6fec3cf
Update packets
kennyvv Jul 23, 2022
e219c3e
Add support for SByte reading/writing
kennyvv Jul 23, 2022
9d6ea5e
Update Ability handling
kennyvv Jul 23, 2022
4881e1a
Fix build
kennyvv Jul 23, 2022
ab60d3f
Changes 1.19.20 without blockdata
TheFirewall Jun 11, 2023
8057ec6
Changes 1.19.30
TheFirewall Jun 16, 2023
0592f40
Changes 1.19.40
TheFirewall Jun 17, 2023
8a02476
Changes 1.19.50
TheFirewall Jun 17, 2023
292e764
Changes 1.19.60 and 1.19.62
TheFirewall Jun 25, 2023
aa0ef88
fix
TheFirewall Jun 25, 2023
79db8ff
Fix
TheFirewall Jun 25, 2023
938256b
1.19.70
TheFirewall Jul 2, 2023
0ff7f07
1.19.80
TheFirewall Aug 6, 2023
712ae20
Anvil world 1.19-1.20 support.
DarkLexFirst Sep 21, 2023
67c38e1
Blocks update par1 and items update started.
DarkLexFirst Sep 24, 2023
6e96ee7
Items update part 1.
DarkLexFirst Sep 24, 2023
10e0a0a
Items update part 2 + inventory transaction fix.
DarkLexFirst Sep 26, 2023
3397ac0
Items update part 3 and some fixes.
DarkLexFirst Sep 26, 2023
e1f4920
Creative inventory update.
DarkLexFirst Sep 26, 2023
ff35525
Crafting and Inventory transaction update.
DarkLexFirst Sep 28, 2023
b3a1098
Items update pre final.
DarkLexFirst Sep 28, 2023
4c600ac
Smelting recipes added.
DarkLexFirst Sep 28, 2023
82c0718
Partial blocks generator update.
DarkLexFirst Sep 29, 2023
3a8a9e7
Factories update.
DarkLexFirst Sep 30, 2023
ac5017b
1.19 pre final update.
DarkLexFirst Sep 30, 2023
de3ae46
Biomes calculation from amvil noise.
DarkLexFirst Oct 3, 2023
de39535
Commands extension.
DarkLexFirst May 28, 2021
56d838e
Disconnect message fix.
DarkLexFirst Oct 5, 2023
ecd28cf
Some fixes and optimizations.
DarkLexFirst Oct 6, 2023
2ff47be
Review and rework part of PlayerInventory with armor.
DarkLexFirst Apr 11, 2021
c89162f
Damage item update.
DarkLexFirst May 28, 2021
0f7ae6e
Armor damage update fix.
DarkLexFirst Oct 6, 2023
f35baae
Armor durability calculation.
DarkLexFirst Oct 6, 2023
c238e60
Case unhandled player actions.
DarkLexFirst Oct 6, 2023
66dcbae
Ordered sequence critical bug fix.
dgrinevaz Apr 6, 2022
783ade7
Zero health death screen fix.
DarkLexFirst Mar 29, 2023
163fafa
Updated GreyListManager.
DarkLexFirst Mar 29, 2023
040796c
McpePlayerSound packet fix.
DarkLexFirst Oct 6, 2023
272ca53
Protocol generation fix.
DarkLexFirst Oct 6, 2023
e41c418
Merge pull request #2 from CRPE-Team/1.19-update
DarkLexFirst Oct 6, 2023
cfd80d7
Nuget publish test.
DarkLexFirst Oct 6, 2023
f8cb750
Package id update. (github build fix).
DarkLexFirst Oct 6, 2023
57433de
init and world read fix.
DarkLexFirst Oct 7, 2023
8bce64f
Anvil mapping update and protocol fixes.
DarkLexFirst Oct 9, 2023
abe6673
Command parameters fix.
DarkLexFirst Oct 9, 2023
23a4e58
Anvil palette updated, chunks reading and sending optimized.
DarkLexFirst Oct 12, 2023
5324c89
Block destroy particle update.
DarkLexFirst Oct 12, 2023
11cc3d4
Bow using times for shoot reduced.
DarkLexFirst Oct 12, 2023
76de481
Forms fixed.
DarkLexFirst Oct 12, 2023
7a00697
Chunks loading little optimization.
DarkLexFirst Oct 13, 2023
daa44f4
Chunks on teleportation rendering fix.
DarkLexFirst Oct 19, 2023
dd8cfff
Anvil mapping update.
DarkLexFirst Oct 19, 2023
da7a399
Tests fix.
DarkLexFirst Oct 20, 2023
672d59c
Chunks network serialization fix.
DarkLexFirst Oct 21, 2023
01d8e20
Anvil map and palette update.
DarkLexFirst Oct 21, 2023
23d4bb4
Minor chunks and PlayerLocation fixes.
DarkLexFirst Oct 21, 2023
f5b7ed1
Players move broadcast fix.
DarkLexFirst Oct 21, 2023
a080fdb
Fix for fundamental packets order indexing.
DarkLexFirst Oct 23, 2023
07ade84
Merge pull request #3 from CRPE-Team/1.19-update-fixes
DarkLexFirst Oct 23, 2023
f081655
Merge pull request #4 from CRPE-Team/master
DarkLexFirst Oct 23, 2023
32c9c02
Review fixes.
DarkLexFirst Oct 25, 2023
5f87c16
Revert "Nuget publish test."
DarkLexFirst Oct 25, 2023
e2c9cfc
GreyListManager update.
DarkLexFirst Oct 25, 2023
0c7426f
Revert log levels.
DarkLexFirst Oct 25, 2023
a2f6cd8
EnableHighPrecision and DatagramSendTimeout configurations. 1.19 todo…
DarkLexFirst Nov 5, 2023
47cca18
Chunk sending for new location revert.
DarkLexFirst Nov 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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


jobs:
nuget:
Expand Down
6 changes: 3 additions & 3 deletions src/MiNET/MiNET.BuilderBase.Tests/Patterns/PatternTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,10 @@ public void Pattern_parse_multiple_all_with_blockstate_to_blocks_ok()
Assert.AreEqual("old_log_type", pattern.BlockList[2].BlockStates.First().Name);
Assert.AreEqual("pillar_axis", pattern.BlockList[2].BlockStates.Last().Name);

Log block = pattern.Next(BlockCoordinates.North) as Log;
LogBase block = pattern.Next(BlockCoordinates.North) as LogBase;
Assert.IsNotNull(block);
Assert.IsInstanceOfType(block, typeof(Log));
Assert.AreEqual("spruce", block.OldLogType);
Assert.IsInstanceOfType(block, typeof(LogBase));
//Assert.AreEqual("spruce", block.OldLogType);
}

[TestMethod]
Expand Down
4 changes: 2 additions & 2 deletions src/MiNET/MiNET.BuilderBase/BuilderBaseItemFactory.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using fNbt;
using fNbt;
using MiNET.BuilderBase.Tools;
using MiNET.Items;

namespace MiNET.BuilderBase
{
public class BuilderBaseItemFactory : ICustomItemFactory
{
public Item GetItem(short id, short metadata, int count)
public Item GetItem(string id, short metadata, int count)
{
if (id == new BrushTool().Id)
{
Expand Down
6 changes: 3 additions & 3 deletions src/MiNET/MiNET.BuilderBase/Commands/ClipboardCommands.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Numerics;
using System.Threading.Tasks;
using log4net;
Expand Down Expand Up @@ -30,7 +30,7 @@ public void Copy(Player player)
}

[Command(Description = "Cut the selection to the clipboard")]
public void Cut(Player player, int leaveId = 0, int leaveData = 0)
public void Cut(Player player, string leaveId = "", int leaveData = 0)
{
RegionSelector selector = RegionSelector.GetSelector(player);

Expand All @@ -40,7 +40,7 @@ public void Cut(Player player, int leaveId = 0, int leaveData = 0)
clipboard.SourceMask = new AnyBlockMask();
clipboard.SourceFuncion = coordinates =>
{
var block = BlockFactory.GetBlockById((byte) leaveId);
var block = BlockFactory.GetBlockById(leaveId);
block.Metadata = (byte) leaveData;
block.Coordinates = coordinates;
EditSession.SetBlock(block);
Expand Down
4 changes: 2 additions & 2 deletions src/MiNET/MiNET.BuilderBase/Commands/MiscCommands.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using log4net;
using MiNET.Blocks;
using MiNET.BuilderBase.Masks;
Expand Down Expand Up @@ -27,7 +27,7 @@ public void Fill(Player player, Pattern pattern, int radius, int depth = -1)
public void Drain(Player player, int radius)
{
EditSession.Fill((BlockCoordinates) player.KnownPosition,
new Pattern(0, 0),
new Pattern(BlockFactory.GetIdByType<Air>(), 0),
new Mask(player.Level, new List<Block> {new FlowingWater(), new Water(), new Lava(), new FlowingLava()}, true),
radius,
-1, true);
Expand Down
14 changes: 6 additions & 8 deletions src/MiNET/MiNET.BuilderBase/Commands/RegionCommands.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region LICENSE
#region LICENSE

// The contents of this file are subject to the Common Public Attribution
// License Version 1.0. (the "License"); you may not use this file except in
Expand Down Expand Up @@ -42,12 +42,11 @@ public class RegionCommands : UndoableCommand
[Command(Description = "Set all blocks within selection")]
public void SetBlock(Player player, BlockTypeEnum tileName, int tileData = 0)
{
var id = BlockFactory.GetBlockIdByName(tileName.Value);
Set(player, id, tileData);
Set(player, tileName.Value, tileData);
}

[Command(Description = "Set all blocks within selection")]
public void Set(Player player, int tileId, int tileData = 0)
public void Set(Player player, string tileId, int tileData = 0)
{
var pattern = new Pattern(tileId, tileData);
EditSession.SetBlocks(Selector, pattern);
Expand All @@ -62,12 +61,11 @@ public void Set(Player player, Pattern pattern)
[Command(Description = "Draws a line segment between cuboid selection corners")]
public void Line(Player player, BlockTypeEnum tileName, int tileData = 0, int thickness = 1, bool shell = false)
{
var id = BlockFactory.GetBlockIdByName(tileName.Value);
Line(player, id, tileData, thickness, shell);
Line(player, tileName.Value, tileData, thickness, shell);
}

[Command(Description = "Draws a line segment between cuboid selection corners")]
public void Line(Player player, int tileId, int tileData = 0, int thickness = 0, bool shell = false)
public void Line(Player player, string tileId, int tileData = 0, int thickness = 0, bool shell = false)
{
var pattern = new Pattern(tileId, tileData);
EditSession.DrawLine(Selector, pattern, Selector.Position1, Selector.Position2, thickness, !shell);
Expand All @@ -80,7 +78,7 @@ public void Replace(Player player, Mask mask, Pattern pattern)
}

[Command(Description = "Set the center block(s)")]
public void Center(Player player, int tileId = 1, int tileData = 0)
public void Center(Player player, string tileId = "stone", int tileData = 0)
{
var pattern = new Pattern(tileId, tileData);

Expand Down
71 changes: 36 additions & 35 deletions src/MiNET/MiNET.BuilderBase/Commands/SchematicsCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,41 +75,42 @@ public string Load(Player player, string schematicFile)
{
for (int z = 0; z < length; ++z)
{
int index = y*width*length + z*width + x;
BlockCoordinates coord = new BlockCoordinates(x, y, z);

if (blocks[index] == 0) continue;

int blockId = blocks[index];
byte data = blockData[index];

Func<int, byte, byte> dataConverter = (i, b) => b; // Default no-op converter
if (AnvilWorldProvider.Convert.ContainsKey(blockId))
{
dataConverter = AnvilWorldProvider.Convert[blockId].Item2;
blockId = AnvilWorldProvider.Convert[blockId].Item1;
}
else
{
if (BlockFactory.GetBlockById((byte) blockId).GetType() == typeof (Block))
{
Log.Warn($"No block implemented for block ID={blockId}, Meta={data}");
//blockId = 57;
}
}

if (blockId > 255)
{
Log.Warn($"Failed mapping for block ID={blockId}, Meta={data}");
blockId = 41;
}

var metadata = dataConverter(blockId, data);

Block block = BlockFactory.GetBlockById((byte) blockId);
block.Coordinates = coord;
block.Metadata = metadata;
buffer.Add(block);
// TODO - 1.19 - update
//int index = y*width*length + z*width + x;
//BlockCoordinates coord = new BlockCoordinates(x, y, z);

//if (blocks[index] == 0) continue;

//int blockId = blocks[index];
//byte data = blockData[index];

//Func<int, byte, byte> dataConverter = (i, b) => b; // Default no-op converter
//if (AnvilWorldProvider.Convert.ContainsKey(blockId))
//{
// dataConverter = AnvilWorldProvider.Convert[blockId].Item2;
// blockId = AnvilWorldProvider.Convert[blockId].Item1;
//}
//else
//{
// if (BlockFactory.GetBlockById((byte) blockId).GetType() == typeof (Block))
// {
// Log.Warn($"No block implemented for block ID={blockId}, Meta={data}");
// //blockId = 57;
// }
//}

//if (blockId > 255)
//{
// Log.Warn($"Failed mapping for block ID={blockId}, Meta={data}");
// blockId = 41;
//}

//var metadata = dataConverter(blockId, data);

//Block block = BlockFactory.GetBlockById((byte) blockId);
//block.Coordinates = coord;
//block.Metadata = metadata;
//buffer.Add(block);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/MiNET/MiNET.BuilderBase/Commands/SelectionCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ public void Size(Player player)
}

[Command(Description = "Counts the number of a certain type of block")]
public void Count(Player player, int tileId, int tileData = 0, bool separateByData = false)
public void Count(Player player, string tileId, int tileData = 0, bool separateByData = false)
{
var selector = RegionSelector.GetSelector(player);

Expand All @@ -435,10 +435,10 @@ public void Distribution(Player player, bool separateByData = false)
var selector = RegionSelector.GetSelector(player);

var selection = selector.GetSelectedBlocks().Select(coord => player.Level.GetBlock(coord)).ToArray();
Dictionary<Tuple<int, int>, int> dist = new Dictionary<Tuple<int, int>, int>();
Dictionary<Tuple<string, int>, int> dist = new Dictionary<Tuple<string, int>, int>();
foreach (var block in selection)
{
Tuple<int, int> tuple = Tuple.Create(block.Id, separateByData ? block.Metadata : 0);
Tuple<string, int> tuple = Tuple.Create(block.Id, separateByData ? block.Metadata : 0);
if (dist.ContainsKey(tuple)) dist[tuple] = dist[tuple] + 1;
else dist.Add(tuple, 1);
}
Expand Down
12 changes: 2 additions & 10 deletions src/MiNET/MiNET.BuilderBase/Masks/Mask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class Mask : IParameterSerializer

private class BlockDataEntry
{
public int Id { get; set; }
public string Id { get; set; }
public byte Metadata { get; set; }
public bool IgnoreMetadata { get; set; } = true;
}
Expand Down Expand Up @@ -159,15 +159,7 @@ public virtual void Deserialize(Player player, string input)

var dataEntry = new BlockDataEntry();

int id;

string binfo = blockInfos[0];
if (!int.TryParse(binfo, out id))
{
id = BlockFactory.GetBlockIdByName(binfo);
}

dataEntry.Id = id;
dataEntry.Id = blockInfos[0];

if (blockInfos.Length == 2)
{
Expand Down
10 changes: 5 additions & 5 deletions src/MiNET/MiNET.BuilderBase/Patterns/Pattern.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public BlockDataEntry()
{
}

public int Id { get; set; }
public string Id { get; set; }
public byte Metadata { get; set; }
public bool HasMetadata { get; set; }
public int Weight { get; set; } = 100;
Expand All @@ -73,11 +73,11 @@ public Pattern()
_random = new Random();
}

public Pattern(int blockId, int metadata)
public Pattern(string blockId, int metadata)
{
BlockList.Add(new BlockDataEntry()
{
Id = (byte) blockId,
Id = blockId,
Metadata = (byte) metadata,
HasMetadata = true
});
Expand Down Expand Up @@ -182,12 +182,12 @@ public virtual void Deserialize(Player player, string currentPattern)
else if (matchGroup.Name == "blockName" && matchGroup.Success)
{
Log.Debug($"Matched blockName group {matchGroup.Value}");
blockDataEntry.Id = BlockFactory.GetBlockIdByName(matchGroup.Value.Trim());
blockDataEntry.Id = matchGroup.Value.Trim();
}
if (matchGroup.Name == "blockId" && matchGroup.Success)
{
Log.Debug($"Matched blockId group {matchGroup.Value}");
if (int.TryParse(matchGroup.Value.Trim(), out int id)) blockDataEntry.Id = id;
throw new InvalidOperationException("blockId now is string id. Replace blockName to blockId needed.");
}
else if (matchGroup.Name == "meta" && matchGroup.Success)
{
Expand Down
11 changes: 6 additions & 5 deletions src/MiNET/MiNET.BuilderBase/Tools/BrushTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class BrushTool : ItemIronShovel
public int Height { get; set; } = 1;
public int Range { get; set; } = 300;
[JsonIgnore]
public Pattern Pattern { get; set; } = new Pattern(1, 0);
public Pattern Pattern { get; set; } = new Pattern("minecraft:stone", 0);
[JsonIgnore]
public Mask Mask { get; set; } = new AnyBlockMask();
public bool Filled { get; set; } = true;
Expand Down Expand Up @@ -110,9 +110,10 @@ public void UpdateDisplay(Player player)
player.Inventory.SendSetSlot(player.Inventory.InHandSlot);
}

public override void PlaceBlock(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
public override bool PlaceBlock(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
{
player.Inventory.SendSetSlot(player.Inventory.InHandSlot);
return true;
}

public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates)
Expand Down Expand Up @@ -297,7 +298,7 @@ private void FillIteration(int inbrushSize, int fillFaces, BlockBuffer current,
{
double brushSizeSquared = inbrushSize*inbrushSize;
int brushSize = inbrushSize + 1;
Dictionary<int, int> frequency = new Dictionary<int, int>();
Dictionary<string, int> frequency = new Dictionary<string, int>();

for (int x = -brushSize; x <= brushSize; x++)
{
Expand Down Expand Up @@ -364,7 +365,7 @@ private void ErosionIteration(int inbrushSize, int erodeFaces, BlockBuffer curre
{
double brushSizeSquared = inbrushSize*inbrushSize;
int brushSize = inbrushSize + 1;
Dictionary<int, int> frequency = new Dictionary<int, int>();
Dictionary<string, int> frequency = new Dictionary<string, int>();

for (int x = -brushSize; x <= brushSize; x++)
{
Expand All @@ -386,7 +387,7 @@ private void ErosionIteration(int inbrushSize, int erodeFaces, BlockBuffer curre
}
int total = 0;
int highest = 1;
int highestState = state.Id;
var highestState = state.Id;
frequency.Clear();
foreach (var offs in FACES_TO_CHECK)
{
Expand Down
3 changes: 2 additions & 1 deletion src/MiNET/MiNET.BuilderBase/Tools/DistanceWand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ private void UpdateExtraData(Player player = null)
}


public override void PlaceBlock(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
public override bool PlaceBlock(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
{
SetPosition2(player, blockCoordinates);
return true;
}

public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates)
Expand Down
3 changes: 2 additions & 1 deletion src/MiNET/MiNET.BuilderBase/Tools/TeleportTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ private void UpdateExtraData()
};
}

public override void PlaceBlock(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
public override bool PlaceBlock(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
{
Teleport(player, true);
return true;
}

public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates)
Expand Down
Loading