mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Added slab handling for 1.20/.1
Added Farm bot crops handling for 1.20/.1 Added utilities for Containers/Inventories Added bot movement lock to prevent multiple bots that use movements from running at the same time. General code improvements.
This commit is contained in:
parent
497a1174de
commit
272900d52e
11 changed files with 941 additions and 797 deletions
|
|
@ -8,7 +8,6 @@ namespace MinecraftClient.ChatBots
|
|||
/// <summary>
|
||||
/// This bot sends a command every 60 seconds in order to stay non-afk.
|
||||
/// </summary>
|
||||
|
||||
public class AntiAFK : ChatBot
|
||||
{
|
||||
public static Configs Config = new();
|
||||
|
|
@ -16,8 +15,7 @@ namespace MinecraftClient.ChatBots
|
|||
[TomlDoNotInlineObject]
|
||||
public class Configs
|
||||
{
|
||||
[NonSerialized]
|
||||
private const string BotName = "AntiAFK";
|
||||
[NonSerialized] private const string BotName = "AntiAFK";
|
||||
|
||||
public bool Enabled = false;
|
||||
|
||||
|
|
@ -99,6 +97,13 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
LogToConsole(Translations.bot_antiafk_not_using_terrain_handling);
|
||||
}
|
||||
else
|
||||
{
|
||||
var movementLock = BotMovementLock.Instance;
|
||||
if (movementLock is { IsLocked: true })
|
||||
LogToConsole(
|
||||
$"§§6§1§0{string.Format(Translations.bot_antiafk_may_not_move, movementLock.LockedBy)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -106,25 +111,22 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
count++;
|
||||
|
||||
if (count >= nextrun)
|
||||
{
|
||||
DoAntiAfkStuff();
|
||||
count = 0;
|
||||
nextrun = random.Next(Settings.DoubleToTick(Config.Delay.min), Settings.DoubleToTick(Config.Delay.max));
|
||||
}
|
||||
|
||||
if (count < nextrun) return;
|
||||
DoAntiAfkStuff();
|
||||
count = 0;
|
||||
nextrun = random.Next(Settings.DoubleToTick(Config.Delay.min), Settings.DoubleToTick(Config.Delay.max));
|
||||
}
|
||||
|
||||
private void DoAntiAfkStuff()
|
||||
{
|
||||
if (Config.Use_Terrain_Handling && GetTerrainEnabled())
|
||||
var isMovementLocked = BotMovementLock.Instance;
|
||||
if (Config.Use_Terrain_Handling && GetTerrainEnabled() && isMovementLocked is {IsLocked: false})
|
||||
{
|
||||
Location currentLocation = GetCurrentLocation();
|
||||
Location goal;
|
||||
var currentLocation = GetCurrentLocation();
|
||||
|
||||
bool moved = false;
|
||||
bool useAlternativeMethod = false;
|
||||
int triesCounter = 0;
|
||||
var moved = false;
|
||||
var useAlternativeMethod = false;
|
||||
var triesCounter = 0;
|
||||
|
||||
while (!moved)
|
||||
{
|
||||
|
|
@ -134,10 +136,11 @@ namespace MinecraftClient.ChatBots
|
|||
break;
|
||||
}
|
||||
|
||||
goal = GetRandomLocationWithinRangeXZ(currentLocation, Config.Walk_Range);
|
||||
var goal = GetRandomLocationWithinRangeXZ(currentLocation, Config.Walk_Range);
|
||||
|
||||
// Prevent getting the same location
|
||||
while ((currentLocation.X == goal.X) && (currentLocation.Y == goal.Y) && (currentLocation.Z == goal.Z))
|
||||
while ((currentLocation.X == goal.X) && (currentLocation.Y == goal.Y) &&
|
||||
(currentLocation.Z == goal.Z))
|
||||
{
|
||||
LogToConsole("Same location!, generating new one");
|
||||
goal = GetRandomLocationWithinRangeXZ(currentLocation, Config.Walk_Range);
|
||||
|
|
@ -148,10 +151,8 @@ namespace MinecraftClient.ChatBots
|
|||
useAlternativeMethod = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
moved = MoveToLocation(goal, allowUnsafe: false, allowDirectTeleport: false);
|
||||
}
|
||||
|
||||
moved = MoveToLocation(goal, allowUnsafe: false, allowDirectTeleport: false);
|
||||
}
|
||||
|
||||
if (!useAlternativeMethod && Config.Use_Sneak)
|
||||
|
|
@ -169,12 +170,14 @@ namespace MinecraftClient.ChatBots
|
|||
Sneak(previousSneakState);
|
||||
previousSneakState = !previousSneakState;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
}
|
||||
|
||||
private Location GetRandomLocationWithinRangeXZ(Location currentLocation, int range)
|
||||
{
|
||||
return new Location(currentLocation.X + random.Next(range * -1, range), currentLocation.Y, currentLocation.Z + random.Next(range * -1, range));
|
||||
return new Location(currentLocation.X + random.Next(range * -1, range), currentLocation.Y,
|
||||
currentLocation.Z + random.Next(range * -1, range));
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -19,8 +19,7 @@ namespace MinecraftClient.ChatBots
|
|||
[TomlDoNotInlineObject]
|
||||
public class Configs
|
||||
{
|
||||
[NonSerialized]
|
||||
private const string BotName = "FollowPlayer";
|
||||
[NonSerialized] private const string BotName = "FollowPlayer";
|
||||
|
||||
public bool Enabled = false;
|
||||
|
||||
|
|
@ -73,7 +72,8 @@ namespace MinecraftClient.ChatBots
|
|||
.Then(l => l.Argument("PlayerName", MccArguments.PlayerName())
|
||||
.Executes(r => OnCommandStart(r.Source, Arguments.GetString(r, "PlayerName"), takeRisk: false))
|
||||
.Then(l => l.Literal("-f")
|
||||
.Executes(r => OnCommandStart(r.Source, Arguments.GetString(r, "PlayerName"), takeRisk: true)))))
|
||||
.Executes(r =>
|
||||
OnCommandStart(r.Source, Arguments.GetString(r, "PlayerName"), takeRisk: true)))))
|
||||
.Then(l => l.Literal("stop")
|
||||
.Executes(r => OnCommandStop(r.Source)))
|
||||
.Then(l => l.Literal("_help")
|
||||
|
|
@ -84,6 +84,7 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public override void OnUnload()
|
||||
{
|
||||
BotMovementLock.Instance?.UnLock("Follow Player");
|
||||
McClient.dispatcher.Unregister(CommandName);
|
||||
McClient.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
|
@ -104,7 +105,7 @@ namespace MinecraftClient.ChatBots
|
|||
if (!IsValidName(name))
|
||||
return r.SetAndReturn(CmdResult.Status.Fail, Translations.cmd_follow_invalid_name);
|
||||
|
||||
Entity? player = GetEntities().Values.ToList().Find(entity =>
|
||||
var player = GetEntities().Values.ToList().Find(entity =>
|
||||
entity.Type == EntityType.Player
|
||||
&& !string.IsNullOrEmpty(entity.Name)
|
||||
&& entity.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
|
||||
|
|
@ -116,22 +117,37 @@ namespace MinecraftClient.ChatBots
|
|||
return r.SetAndReturn(CmdResult.Status.Fail, Translations.cmd_follow_cant_reach_player);
|
||||
|
||||
if (_playerToFollow != null && _playerToFollow.Equals(name, StringComparison.OrdinalIgnoreCase))
|
||||
return r.SetAndReturn(CmdResult.Status.Fail, string.Format(Translations.cmd_follow_already_following, _playerToFollow));
|
||||
return r.SetAndReturn(CmdResult.Status.Fail,
|
||||
string.Format(Translations.cmd_follow_already_following, _playerToFollow));
|
||||
|
||||
string result;
|
||||
if (_playerToFollow != null)
|
||||
result = string.Format(Translations.cmd_follow_switched, player.Name!);
|
||||
else
|
||||
result = string.Format(Translations.cmd_follow_started, player.Name!);
|
||||
var movementLock = BotMovementLock.Instance;
|
||||
if (movementLock is { IsLocked: true })
|
||||
return r.SetAndReturn(CmdResult.Status.Fail,
|
||||
string.Format(Translations.bot_common_movement_lock_held, "Follow Player", movementLock.LockedBy));
|
||||
|
||||
var result =
|
||||
string.Format(
|
||||
_playerToFollow != null ? Translations.cmd_follow_switched : Translations.cmd_follow_started,
|
||||
player.Name!);
|
||||
_playerToFollow = name.ToLower();
|
||||
|
||||
if (takeRisk)
|
||||
switch (movementLock)
|
||||
{
|
||||
_unsafeEnabled = true;
|
||||
return r.SetAndReturn(CmdResult.Status.Done, Translations.cmd_follow_note + '\n' + Translations.cmd_follow_unsafe_enabled);
|
||||
case { IsLocked: false }:
|
||||
if (!movementLock.Lock("Follow Player"))
|
||||
{
|
||||
LogToConsole($"§§6§1§0Follow Player bot failed to obtain the movement lock for some reason!");
|
||||
LogToConsole($"§§6§1§0Disable other bots who have movement mechanics, and try again!");
|
||||
return r.SetAndReturn(CmdResult.Status.Fail);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
return r.SetAndReturn(CmdResult.Status.Done, Translations.cmd_follow_note);
|
||||
|
||||
if (!takeRisk) return r.SetAndReturn(CmdResult.Status.Done, Translations.cmd_follow_note);
|
||||
_unsafeEnabled = true;
|
||||
return r.SetAndReturn(CmdResult.Status.Done,
|
||||
Translations.cmd_follow_note + '\n' + Translations.cmd_follow_unsafe_enabled);
|
||||
}
|
||||
|
||||
private int OnCommandStop(CmdResult r)
|
||||
|
|
@ -139,6 +155,8 @@ namespace MinecraftClient.ChatBots
|
|||
if (_playerToFollow == null)
|
||||
return r.SetAndReturn(CmdResult.Status.Fail, Translations.cmd_follow_already_stopped);
|
||||
|
||||
var movementLock = BotMovementLock.Instance;
|
||||
movementLock?.UnLock("Follow Player");
|
||||
_playerToFollow = null;
|
||||
|
||||
return r.SetAndReturn(CmdResult.Status.Done, Translations.cmd_follow_stopping);
|
||||
|
|
@ -168,8 +186,8 @@ namespace MinecraftClient.ChatBots
|
|||
if (!CanMoveThere(entity.Location))
|
||||
return;
|
||||
|
||||
// Stop at specified distance from plater (prevents pushing player around)
|
||||
double distance = entity.Location.Distance(GetCurrentLocation());
|
||||
// Stop at specified distance from player (prevents pushing player around)
|
||||
var distance = entity.Location.Distance(GetCurrentLocation());
|
||||
|
||||
if (distance < Config.Stop_At_Distance)
|
||||
return;
|
||||
|
|
@ -182,7 +200,8 @@ namespace MinecraftClient.ChatBots
|
|||
if (entity.Type != EntityType.Player)
|
||||
return;
|
||||
|
||||
if (_playerToFollow != null && !string.IsNullOrEmpty(entity.Name) && _playerToFollow.Equals(entity.Name, StringComparison.OrdinalIgnoreCase))
|
||||
if (_playerToFollow != null && !string.IsNullOrEmpty(entity.Name) &&
|
||||
_playerToFollow.Equals(entity.Name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
LogToConsole(string.Format(Translations.cmd_follow_player_came_to_the_range, _playerToFollow));
|
||||
LogToConsole(Translations.cmd_follow_resuming);
|
||||
|
|
@ -194,7 +213,8 @@ namespace MinecraftClient.ChatBots
|
|||
if (entity.Type != EntityType.Player)
|
||||
return;
|
||||
|
||||
if (_playerToFollow != null && !string.IsNullOrEmpty(entity.Name) && _playerToFollow.Equals(entity.Name, StringComparison.OrdinalIgnoreCase))
|
||||
if (_playerToFollow != null && !string.IsNullOrEmpty(entity.Name) &&
|
||||
_playerToFollow.Equals(entity.Name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
LogToConsole(string.Format(Translations.cmd_follow_player_left_the_range, _playerToFollow));
|
||||
LogToConsole(Translations.cmd_follow_pausing);
|
||||
|
|
@ -203,7 +223,8 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public override void OnPlayerLeave(Guid uuid, string? name)
|
||||
{
|
||||
if (_playerToFollow != null && !string.IsNullOrEmpty(name) && _playerToFollow.Equals(name, StringComparison.OrdinalIgnoreCase))
|
||||
if (_playerToFollow != null && !string.IsNullOrEmpty(name) &&
|
||||
_playerToFollow.Equals(name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
LogToConsole(string.Format(Translations.cmd_follow_player_left, _playerToFollow));
|
||||
LogToConsole(Translations.cmd_follow_stopping);
|
||||
|
|
@ -213,12 +234,8 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
private bool CanMoveThere(Location location)
|
||||
{
|
||||
ChunkColumn? chunkColumn = GetWorld().GetChunkColumn(location);
|
||||
|
||||
if (chunkColumn == null || chunkColumn.FullyLoaded == false)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
var chunkColumn = GetWorld().GetChunkColumn(location);
|
||||
return chunkColumn != null && chunkColumn.FullyLoaded != false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -89,6 +89,7 @@ public class ItemsCollector : ChatBot
|
|||
|
||||
public override void OnUnload()
|
||||
{
|
||||
StopTheMainProcess();
|
||||
McClient.dispatcher.Unregister(CommandName);
|
||||
McClient.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
|
@ -109,6 +110,18 @@ public class ItemsCollector : ChatBot
|
|||
if (running)
|
||||
return r.SetAndReturn(CmdResult.Status.Fail, Translations.cmd_items_collector_already_collecting);
|
||||
|
||||
var movementLock = BotMovementLock.Instance;
|
||||
if (movementLock is { IsLocked: true })
|
||||
return r.SetAndReturn(CmdResult.Status.Fail,
|
||||
string.Format(Translations.bot_common_movement_lock_held, "Items Collector", movementLock.LockedBy));
|
||||
|
||||
if (!movementLock!.Lock("Items Collector"))
|
||||
{
|
||||
LogToConsole($"§§6§1§0Items Collector bot failed to obtain the movement lock for some reason!");
|
||||
LogToConsole($"§§6§1§0Disable other bots who have movement mechanics, and try again!");
|
||||
return r.SetAndReturn(CmdResult.Status.Fail);
|
||||
}
|
||||
|
||||
StartTheMainProcess();
|
||||
return r.SetAndReturn(CmdResult.Status.Done, Translations.cmd_items_collector_started);
|
||||
}
|
||||
|
|
@ -132,6 +145,7 @@ public class ItemsCollector : ChatBot
|
|||
private void StopTheMainProcess()
|
||||
{
|
||||
running = false;
|
||||
BotMovementLock.Instance?.UnLock("Items Collector");
|
||||
}
|
||||
|
||||
private void MainProcess()
|
||||
|
|
@ -163,13 +177,8 @@ public class ItemsCollector : ChatBot
|
|||
|
||||
if (items.Any())
|
||||
{
|
||||
foreach (var entity in items)
|
||||
{
|
||||
if (!running)
|
||||
break;
|
||||
|
||||
foreach (var entity in items.TakeWhile(entity => running))
|
||||
WaitForMoveToLocation(entity.Location);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ public class WebSocketBot : ChatBot
|
|||
public int Port = 8043;
|
||||
|
||||
[TomlInlineComment("$ChatBot.WebSocketBot.Password$")]
|
||||
public string? Password = "wspass12345";
|
||||
public string? Password = Guid.NewGuid().ToString().Replace("-", "").Trim().ToLower();
|
||||
|
||||
[TomlInlineComment("$ChatBot.WebSocketBot.DebugMode$")]
|
||||
public bool DebugMode = false;
|
||||
|
|
|
|||
58
MinecraftClient/Inventory/ContainerExtensions.cs
Normal file
58
MinecraftClient/Inventory/ContainerExtensions.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
|
||||
namespace MinecraftClient.Inventory;
|
||||
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
public enum ComparisonType
|
||||
{
|
||||
Equals,
|
||||
NotEquals,
|
||||
Less,
|
||||
LessOrEqual,
|
||||
Greater,
|
||||
GreaterOrEqual
|
||||
}
|
||||
|
||||
public static class ContainerExtensions
|
||||
{
|
||||
public static bool IsFull(this Container container) =>
|
||||
container.Items.Values.All(item => item.Count >= item.Type.StackCount());
|
||||
|
||||
public static int FirstEmptySlot(this Container container) =>
|
||||
container.Items.FirstOrDefault(slot => slot.Value.IsEmpty).Key;
|
||||
|
||||
public static int FirstSlotWithItem(this Container container, ItemType type, int? count = null,
|
||||
ComparisonType comparison = ComparisonType.Equals) =>
|
||||
container.Items.FirstOrDefault(slot =>
|
||||
slot.Value.Type == type &&
|
||||
(!count.HasValue || CompareCounts(slot.Value.Count, count.Value, comparison))).Key;
|
||||
|
||||
public static int LastSlotWithItem(this Container container, ItemType type, int? count = null,
|
||||
ComparisonType comparison = ComparisonType.Equals) =>
|
||||
container.Items.LastOrDefault(slot =>
|
||||
slot.Value.Type == type &&
|
||||
(!count.HasValue || CompareCounts(slot.Value.Count, count.Value, comparison)))
|
||||
.Key;
|
||||
|
||||
// We could have used "Expression<Func<int, int, bool>> comparison = null" instead of "ComparisonType comparison", but it would look ugly to use
|
||||
private static bool CompareCounts(int value1, int value2, ComparisonType comparison)
|
||||
{
|
||||
var left = Expression.Constant(value1);
|
||||
var right = Expression.Constant(value2);
|
||||
|
||||
Expression binaryExpression = comparison switch
|
||||
{
|
||||
ComparisonType.Less => Expression.LessThan(left, right),
|
||||
ComparisonType.LessOrEqual => Expression.LessThanOrEqual(left, right),
|
||||
ComparisonType.Greater => Expression.GreaterThan(left, right),
|
||||
ComparisonType.GreaterOrEqual => Expression.GreaterThanOrEqual(left, right),
|
||||
ComparisonType.Equals => Expression.Equal(left, right),
|
||||
ComparisonType.NotEquals => Expression.NotEqual(left, right),
|
||||
_ => Expression.Equal(left, right)
|
||||
};
|
||||
|
||||
return Expression.Lambda<Func<bool>>(binaryExpression).Compile().Invoke();
|
||||
}
|
||||
}
|
||||
|
|
@ -6,375 +6,437 @@ public static class BlockExtension
|
|||
{
|
||||
public static bool IsTopSlab(this Block block, int protocolVersion)
|
||||
{
|
||||
if (protocolVersion >= Protocol18Handler.MC_1_19_4_Version)
|
||||
switch (protocolVersion)
|
||||
{
|
||||
switch (block.BlockId)
|
||||
{
|
||||
case 11018: // OakSlab
|
||||
case 11024: // SpruceSlab
|
||||
case 11030: // BirchSlab
|
||||
case 11036: // JungleSlab
|
||||
case 11042: // AcaciaSlab
|
||||
case 11054: // DarkOakSlab
|
||||
case 11060: // MangroveSlab
|
||||
case 18510: // CrimsonSlab
|
||||
case 18516: // WarpedSlab
|
||||
case 11078: // StoneSlab
|
||||
case 11108: // CobblestoneSlab
|
||||
case 13948: // MossyCobblestoneSlab
|
||||
case 11084: // SmoothStoneSlab
|
||||
case 11120: // StoneBrickSlab
|
||||
case 13936: // MossyStoneBrickSlab
|
||||
case 13972: // GraniteSlab
|
||||
case 13924: // PolishedGraniteSlab
|
||||
case 13996: // DioriteSlab
|
||||
case 13942: // PolishedDioriteSlab
|
||||
case 13978: // AndesiteSlab
|
||||
case 13990: // PolishedAndesiteSlab
|
||||
case 22132: // CobbledDeepslateSlab
|
||||
case 22543: // PolishedDeepslateSlab
|
||||
case 23365: // DeepslateBrickSlab
|
||||
case 22954: // DeepslateTileSlab
|
||||
case 11114: // BrickSlab
|
||||
case 11126: // MudBrickSlab
|
||||
case 11090: // SandstoneSlab
|
||||
case 13960: // SmoothSandstoneSlab
|
||||
case 11096: // CutSandstoneSlab
|
||||
case 11144: // RedSandstoneSlab
|
||||
case 13930: // SmoothRedSandstoneSlab
|
||||
case 11150: // CutRedSandstoneSlab
|
||||
case 10562: // PrismarineSlab
|
||||
case 10568: // PrismarineBrickSlab
|
||||
case 10574: // DarkPrismarineSlab
|
||||
case 11132: // NetherBrickSlab
|
||||
case 13984: // RedNetherBrickSlab
|
||||
case 19707: // BlackstoneSlab
|
||||
case 20208: // PolishedBlackstoneSlab
|
||||
case 19717: // PolishedBlackstoneBrickSlab
|
||||
case 13954: // EndStoneBrickSlab
|
||||
case 11156: // PurpurSlab
|
||||
case 11138: // QuartzSlab
|
||||
case 13966: // SmoothQuartzSlab
|
||||
case 21510: // CutCopperSlab
|
||||
case 21504: // ExposedCutCopperSlab
|
||||
case 21498: // WeatheredCutCopperSlab
|
||||
case 21492: // OxidizedCutCopperSlab
|
||||
case 21862: // WaxedCutCopperSlab
|
||||
case 21856: // WaxedExposedCutCopperSlab
|
||||
case 21850: // WaxedWeatheredCutCopperSlab
|
||||
case 21844: // WaxedOxidizedCutCopperSlab
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (protocolVersion == Protocol18Handler.MC_1_19_3_Version)
|
||||
{
|
||||
switch (block.BlockId)
|
||||
{
|
||||
case 10686: // OakSlab
|
||||
case 10692: // SpruceSlab
|
||||
case 10698: // BirchSlab
|
||||
case 10704: // JungleSlab
|
||||
case 10710: // AcaciaSlab
|
||||
case 10716: // DarkOakSlab
|
||||
case 10722: // MangroveSlab
|
||||
case 18041: // CrimsonSlab
|
||||
case 18047: // WarpedSlab
|
||||
case 10740: // StoneSlab
|
||||
case 10770: // CobblestoneSlab
|
||||
case 13479: // MossyCobblestoneSlab
|
||||
case 10746: // SmoothStoneSlab
|
||||
case 10782: // StoneBrickSlab
|
||||
case 13467: // MossyStoneBrickSlab
|
||||
case 13503: // GraniteSlab
|
||||
case 13455: // PolishedGraniteSlab
|
||||
case 13527: // DioriteSlab
|
||||
case 13473: // PolishedDioriteSlab
|
||||
case 13509: // AndesiteSlab
|
||||
case 13521: // PolishedAndesiteSlab
|
||||
case 21647: // CobbledDeepslateSlab
|
||||
case 22058: // PolishedDeepslateSlab
|
||||
case 22880: // DeepslateBrickSlab
|
||||
case 22469: // DeepslateTileSlab
|
||||
case 10776: // BrickSlab
|
||||
case 10788: // MudBrickSlab
|
||||
case 10752: // SandstoneSlab
|
||||
case 13491: // SmoothSandstoneSlab
|
||||
case 10758: // CutSandstoneSlab
|
||||
case 10806: // RedSandstoneSlab
|
||||
case 13461: // SmoothRedSandstoneSlab
|
||||
case 10812: // CutRedSandstoneSlab
|
||||
case 10230: // PrismarineSlab
|
||||
case 10236: // PrismarineBrickSlab
|
||||
case 10242: // DarkPrismarineSlab
|
||||
case 10794: // NetherBrickSlab
|
||||
case 13515: // RedNetherBrickSlab
|
||||
case 19238: // BlackstoneSlab
|
||||
case 19739: // PolishedBlackstoneSlab
|
||||
case 19248: // PolishedBlackstoneBrickSlab
|
||||
case 13485: // EndStoneBrickSlab
|
||||
case 10818: // PurpurSlab
|
||||
case 10800: // QuartzSlab
|
||||
case 13497: // SmoothQuartzSlab
|
||||
case 21041: // CutCopperSlab
|
||||
case 21035: // ExposedCutCopperSlab
|
||||
case 21029: // WeatheredCutCopperSlab
|
||||
case 21023: // OxidizedCutCopperSlab
|
||||
case 21393: // WaxedCutCopperSlab
|
||||
case 21387: // WaxedExposedCutCopperSlab
|
||||
case 21381: // WaxedWeatheredCutCopperSlab
|
||||
case 21375: // WaxedOxidizedCutCopperSlab
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (protocolVersion >= Protocol18Handler.MC_1_19_Version)
|
||||
{
|
||||
switch (block.BlockId)
|
||||
{
|
||||
case 19257: // CutCopperSlab
|
||||
case 19251: // ExposedCutCopperSlab
|
||||
case 19245: // WeatheredCutCopperSlab
|
||||
case 19239: // OxidizedCutCopperSlab
|
||||
case 19609: // WaxedCutCopperSlab
|
||||
case 19603: // WaxedExposedCutCopperSlab
|
||||
case 19597: // WaxedWeatheredCutCopperSlab
|
||||
case 19591: // WaxedOxidizedCutCopperSlab
|
||||
case 9042: // OakSlab
|
||||
case 9048: // SpruceSlab
|
||||
case 9054: // BirchSlab
|
||||
case 9060: // JungleSlab
|
||||
case 9066: // AcaciaSlab
|
||||
case 9072: // DarkOakSlab
|
||||
case 9078: // MangroveSlab
|
||||
case 16257: // CrimsonSlab
|
||||
case 16263: // WarpedSlab
|
||||
case 9084: // StoneSlab
|
||||
case 9090: // SmoothStoneSlab
|
||||
case 9096: // SandstoneSlab
|
||||
case 9102: // CutSandstoneSlab
|
||||
case 9108: // PetrifiedOakSlab
|
||||
case 9114: // CobblestoneSlab
|
||||
case 9120: // BrickSlab
|
||||
case 9126: // StoneBrickSlab
|
||||
case 9132: // MudBrickSlab
|
||||
case 9138: // NetherBrickSlab
|
||||
case 9144: // QuartzSlab
|
||||
case 9150: // RedSandstoneSlab
|
||||
case 9156: // CutRedSandstoneSlab
|
||||
case 9162: // PurpurSlab
|
||||
case 8586: // PrismarineSlab
|
||||
case 8592: // PrismarineBrickSlab
|
||||
case 8598: // DarkPrismarineSlab
|
||||
case 11671: // PolishedGraniteSlab
|
||||
case 11677: // SmoothRedSandstoneSlab
|
||||
case 11683: // MossyStoneBrickSlab
|
||||
case 11689: // PolishedDioriteSlab
|
||||
case 11695: // MossyCobblestoneSlab
|
||||
case 11701: // EndStoneBrickSlab
|
||||
case 11707: // SmoothSandstoneSlab
|
||||
case 11713: // SmoothQuartzSlab
|
||||
case 11719: // GraniteSlab
|
||||
case 11725: // AndesiteSlab
|
||||
case 11731: // RedNetherBrickSlab
|
||||
case 11737: // PolishedAndesiteSlab
|
||||
case 11743: // DioriteSlab
|
||||
case 19863: // CobbledDeepslateSlab
|
||||
case 20274: // PolishedDeepslateSlab
|
||||
case 21096: // DeepslateBrickSlab
|
||||
case 20685: // DeepslateTileSlab
|
||||
case 17454: // BlackstoneSlab
|
||||
case 17955: // PolishedBlackstoneSlab
|
||||
case 17464: // PolishedBlackstoneBrickSlab
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (protocolVersion >= Protocol18Handler.MC_1_17_Version)
|
||||
{
|
||||
switch (block.BlockId)
|
||||
{
|
||||
case 18163: // CutCopperSlab
|
||||
case 18157: // ExposedCutCopperSlab
|
||||
case 18151: // WeatheredCutCopperSlab
|
||||
case 18145: // OxidizedCutCopperSlab
|
||||
case 18515: // WaxedCutCopperSlab
|
||||
case 18509: // WaxedExposedCutCopperSlab
|
||||
case 18503: // WaxedWeatheredCutCopperSlab
|
||||
case 18497: // WaxedOxidizedCutCopperSlab
|
||||
case 8551: // OakSlab
|
||||
case 8557: // SpruceSlab
|
||||
case 8563: // BirchSlab
|
||||
case 8569: // JungleSlab
|
||||
case 8575: // AcaciaSlab
|
||||
case 8581: // DarkOakSlab
|
||||
case 15302: // CrimsonSlab
|
||||
case 15308: // WarpedSlab
|
||||
case 8587: // StoneSlab
|
||||
case 8593: // SmoothStoneSlab
|
||||
case 8599: // SandstoneSlab
|
||||
case 8605: // CutSandstoneSlab
|
||||
case 8611: // PetrifiedOakSlab
|
||||
case 8617: // CobblestoneSlab
|
||||
case 8623: // BrickSlab
|
||||
case 8629: // StoneBrickSlab
|
||||
case 8635: // NetherBrickSlab
|
||||
case 8641: // QuartzSlab
|
||||
case 8647: // RedSandstoneSlab
|
||||
case 8653: // CutRedSandstoneSlab
|
||||
case 8659: // PurpurSlab
|
||||
case 8095: // PrismarineSlab
|
||||
case 8101: // PrismarineBrickSlab
|
||||
case 8107: // DarkPrismarineSlab
|
||||
case 11040: // PolishedGraniteSlab
|
||||
case 11046: // SmoothRedSandstoneSlab
|
||||
case 11052: // MossyStoneBrickSlab
|
||||
case 11058: // PolishedDioriteSlab
|
||||
case 11064: // MossyCobblestoneSlab
|
||||
case 11070: // EndStoneBrickSlab
|
||||
case 11076: // SmoothSandstoneSlab
|
||||
case 11082: // SmoothQuartzSlab
|
||||
case 11088: // GraniteSlab
|
||||
case 11094: // AndesiteSlab
|
||||
case 11100: // RedNetherBrickSlab
|
||||
case 11106: // PolishedAndesiteSlab
|
||||
case 11112: // DioriteSlab
|
||||
case 18768: // CobbledDeepslateSlab
|
||||
case 19179: // PolishedDeepslateSlab
|
||||
case 20001: // DeepslateBrickSlab
|
||||
case 19590: // DeepslateTileSlab
|
||||
case 16499: // BlackstoneSlab
|
||||
case 17000: // PolishedBlackstoneSlab
|
||||
case 16509: // PolishedBlackstoneBrickSlab
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (protocolVersion >= Protocol18Handler.MC_1_16_Version)
|
||||
{
|
||||
switch (block.BlockId)
|
||||
{
|
||||
case 8305: // OakSlab
|
||||
case 8311: // SpruceSlab
|
||||
case 8317: // BirchSlab
|
||||
case 8323: // JungleSlab
|
||||
case 8329: // AcaciaSlab
|
||||
case 8335: // DarkOakSlab
|
||||
case 15056: // CrimsonSlab
|
||||
case 15062: // WarpedSlab
|
||||
case 8341: // StoneSlab
|
||||
case 8347: // SmoothStoneSlab
|
||||
case 8353: // SandstoneSlab
|
||||
case 8359: // CutSandstoneSlab
|
||||
case 8365: // PetrifiedOakSlab
|
||||
case 8371: // CobblestoneSlab
|
||||
case 8377: // BrickSlab
|
||||
case 8383: // StoneBrickSlab
|
||||
case 8389: // NetherBrickSlab
|
||||
case 8395: // QuartzSlab
|
||||
case 8401: // RedSandstoneSlab
|
||||
case 8407: // CutRedSandstoneSlab
|
||||
case 8413: // PurpurSlab
|
||||
case 7849: // PrismarineSlab
|
||||
case 7855: // PrismarineBrickSlab
|
||||
case 7861: // DarkPrismarineSlab
|
||||
case 10794: // PolishedGraniteSlab
|
||||
case 10800: // SmoothRedSandstoneSlab
|
||||
case 10806: // MossyStoneBrickSlab
|
||||
case 10812: // PolishedDioriteSlab
|
||||
case 10818: // MossyCobblestoneSlab
|
||||
case 10824: // EndStoneBrickSlab
|
||||
case 10830: // SmoothSandstoneSlab
|
||||
case 10836: // SmoothQuartzSlab
|
||||
case 10842: // GraniteSlab
|
||||
case 10848: // AndesiteSlab
|
||||
case 10854: // RedNetherBrickSlab
|
||||
case 10860: // PolishedAndesiteSlab
|
||||
case 10866: // DioriteSlab
|
||||
case 16253: // BlackstoneSlab
|
||||
case 16754: // PolishedBlackstoneSlab
|
||||
case 16263: // PolishedBlackstoneBrickSlab
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (protocolVersion >= Protocol18Handler.MC_1_15_Version)
|
||||
{
|
||||
switch (block.BlockId)
|
||||
{
|
||||
case 7765: // OakSlab
|
||||
case 7771: // SpruceSlab
|
||||
case 7777: // BirchSlab
|
||||
case 7783: // JungleSlab
|
||||
case 7789: // AcaciaSlab
|
||||
case 7795: // DarkOakSlab
|
||||
case 7801: // StoneSlab
|
||||
case 7807: // SmoothStoneSlab
|
||||
case 7813: // SandstoneSlab
|
||||
case 7819: // CutSandstoneSlab
|
||||
case 7825: // PetrifiedOakSlab
|
||||
case 7831: // CobblestoneSlab
|
||||
case 7837: // BrickSlab
|
||||
case 7843: // StoneBrickSlab
|
||||
case 7849: // NetherBrickSlab
|
||||
case 7855: // QuartzSlab
|
||||
case 7861: // RedSandstoneSlab
|
||||
case 7867: // CutRedSandstoneSlab
|
||||
case 7873: // PurpurSlab
|
||||
case 7309: // PrismarineSlab
|
||||
case 7321: // DarkPrismarineSlab
|
||||
case 10254: // PolishedGraniteSlab
|
||||
case 10260: // SmoothRedSandstoneSlab
|
||||
case 10266: // MossyStoneBrickSlab
|
||||
case 10272: // PolishedDioriteSlab
|
||||
case 10278: // MossyCobblestoneSlab
|
||||
case 10284: // EndStoneBrickSlab
|
||||
case 10290: // SmoothSandstoneSlab
|
||||
case 10296: // SmoothQuartzSlab
|
||||
case 10302: // GraniteSlab
|
||||
case 10308: // AndesiteSlab
|
||||
case 10314: // RedNetherBrickSlab
|
||||
case 10320: // PolishedAndesiteSlab
|
||||
case 10326: // DioriteSlab
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (protocolVersion >= Protocol18Handler.MC_1_14_Version)
|
||||
{
|
||||
switch (block.BlockId)
|
||||
{
|
||||
case 7765: // OakSlab
|
||||
case 7771: // SpruceSlab
|
||||
case 7777: // BirchSlab
|
||||
case 7783: // JungleSlab
|
||||
case 7789: // AcaciaSlab
|
||||
case 7795: // DarkOakSlab
|
||||
case 7801: // StoneSlab
|
||||
case 7807: // SmoothStoneSlab
|
||||
case 7813: // SandstoneSlab
|
||||
case 7819: // CutSandstoneSlab
|
||||
case 7825: // PetrifiedOakSlab
|
||||
case 7831: // CobblestoneSlab
|
||||
case 7837: // BrickSlab
|
||||
case 7843: // StoneBrickSlab
|
||||
case 7849: // NetherBrickSlab
|
||||
case 7855: // QuartzSlab
|
||||
case 7861: // RedSandstoneSlab
|
||||
case 7867: // CutRedSandstoneSlab
|
||||
case 7873: // PurpurSlab
|
||||
case 7309: // PrismarineSlab
|
||||
case 7315: // PrismarineBrickSlab
|
||||
case 7321: // DarkPrismarineSlab
|
||||
case 10254: // PolishedGraniteSlab
|
||||
case 10260: // SmoothRedSandstoneSlab
|
||||
case 10266: // MossyStoneBrickSlab
|
||||
case 10272: // PolishedDioriteSlab
|
||||
case 10278: // MossyCobblestoneSlab
|
||||
case 10284: // EndStoneBrickSlab
|
||||
case 10290: // SmoothSandstoneSlab
|
||||
case 10296: // SmoothQuartzSlab
|
||||
case 10302: // GraniteSlab
|
||||
case 10308: // AndesiteSlab
|
||||
case 10314: // RedNetherBrickSlab
|
||||
case 10320: // PolishedAndesiteSlab
|
||||
case 10326: // DioriteSlab
|
||||
return true;
|
||||
}
|
||||
case >= Protocol18Handler.MC_1_20_Version:
|
||||
switch (block.BlockId)
|
||||
{
|
||||
case 11022: //OakSlab
|
||||
case 11028: //SpruceSlab
|
||||
case 11034: //BirchSlab
|
||||
case 11040: //JungleSlab
|
||||
case 11046: //AcaciaSlab
|
||||
case 11058: //DarkOakSlab
|
||||
case 11064: //MangroveSlab
|
||||
case 18528: //CrimsonSlab
|
||||
case 18534: //WarpedSlab
|
||||
case 11082: //StoneSlab
|
||||
case 11112: //CobblestoneSlab
|
||||
case 13966: //MossyCobblestoneSlab
|
||||
case 11088: //SmoothStoneSlab
|
||||
case 11124: //StoneBrickSlab
|
||||
case 13954: //MossyStoneBrickSlab
|
||||
case 13990: //GraniteSlab
|
||||
case 13942: //PolishedGraniteSlab
|
||||
case 14014: //DioriteSlab
|
||||
case 13960: //PolishedDioriteSlab
|
||||
case 13996: //AndesiteSlab
|
||||
case 14008: //PolishedAndesiteSlab
|
||||
case 22534: //CobbledDeepslateSlab
|
||||
case 22945: //PolishedDeepslateSlab
|
||||
case 23767: //DeepslateBrickSlab
|
||||
case 23356: //DeepslateTileSlab
|
||||
case 11118: //BrickSlab
|
||||
case 11130: //MudBrickSlab
|
||||
case 11094: //SandstoneSlab
|
||||
case 13978: //SmoothSandstoneSlab
|
||||
case 11100: //CutSandstoneSlab
|
||||
case 11148: //RedSandstoneSlab
|
||||
case 13948: //SmoothRedSandstoneSlab
|
||||
case 11154: //CutRedSandstoneSlab
|
||||
case 10566: //PrismarineSlab
|
||||
case 10572: //PrismarineBrickSlab
|
||||
case 10578: //DarkPrismarineSlab
|
||||
case 11136: //NetherBrickSlab
|
||||
case 14002: //RedNetherBrickSlab
|
||||
case 19725: //BlackstoneSlab
|
||||
case 20226: //PolishedBlackstoneSlab
|
||||
case 19735: //PolishedBlackstoneBrickSlab
|
||||
case 13972: //EndStoneBrickSlab
|
||||
case 11160: //PurpurSlab
|
||||
case 11142: //QuartzSlab
|
||||
case 13984: //SmoothQuartzSlab
|
||||
case 21912: //CutCopperSlab
|
||||
case 21906: //ExposedCutCopperSlab
|
||||
case 21900: //WeatheredCutCopperSlab
|
||||
case 21894: //OxidizedCutCopperSlab
|
||||
case 22264: //WaxedCutCopperSlab
|
||||
case 22258: //WaxedExposedCutCopperSlab
|
||||
case 22252: //WaxedWeatheredCutCopperSlab
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case Protocol18Handler.MC_1_19_4_Version:
|
||||
switch (block.BlockId)
|
||||
{
|
||||
case 11018: // OakSlab
|
||||
case 11024: // SpruceSlab
|
||||
case 11030: // BirchSlab
|
||||
case 11036: // JungleSlab
|
||||
case 11042: // AcaciaSlab
|
||||
case 11054: // DarkOakSlab
|
||||
case 11060: // MangroveSlab
|
||||
case 18510: // CrimsonSlab
|
||||
case 18516: // WarpedSlab
|
||||
case 11078: // StoneSlab
|
||||
case 11108: // CobblestoneSlab
|
||||
case 13948: // MossyCobblestoneSlab
|
||||
case 11084: // SmoothStoneSlab
|
||||
case 11120: // StoneBrickSlab
|
||||
case 13936: // MossyStoneBrickSlab
|
||||
case 13972: // GraniteSlab
|
||||
case 13924: // PolishedGraniteSlab
|
||||
case 13996: // DioriteSlab
|
||||
case 13942: // PolishedDioriteSlab
|
||||
case 13978: // AndesiteSlab
|
||||
case 13990: // PolishedAndesiteSlab
|
||||
case 22132: // CobbledDeepslateSlab
|
||||
case 22543: // PolishedDeepslateSlab
|
||||
case 23365: // DeepslateBrickSlab
|
||||
case 22954: // DeepslateTileSlab
|
||||
case 11114: // BrickSlab
|
||||
case 11126: // MudBrickSlab
|
||||
case 11090: // SandstoneSlab
|
||||
case 13960: // SmoothSandstoneSlab
|
||||
case 11096: // CutSandstoneSlab
|
||||
case 11144: // RedSandstoneSlab
|
||||
case 13930: // SmoothRedSandstoneSlab
|
||||
case 11150: // CutRedSandstoneSlab
|
||||
case 10562: // PrismarineSlab
|
||||
case 10568: // PrismarineBrickSlab
|
||||
case 10574: // DarkPrismarineSlab
|
||||
case 11132: // NetherBrickSlab
|
||||
case 13984: // RedNetherBrickSlab
|
||||
case 19707: // BlackstoneSlab
|
||||
case 20208: // PolishedBlackstoneSlab
|
||||
case 19717: // PolishedBlackstoneBrickSlab
|
||||
case 13954: // EndStoneBrickSlab
|
||||
case 11156: // PurpurSlab
|
||||
case 11138: // QuartzSlab
|
||||
case 13966: // SmoothQuartzSlab
|
||||
case 21510: // CutCopperSlab
|
||||
case 21504: // ExposedCutCopperSlab
|
||||
case 21498: // WeatheredCutCopperSlab
|
||||
case 21492: // OxidizedCutCopperSlab
|
||||
case 21862: // WaxedCutCopperSlab
|
||||
case 21856: // WaxedExposedCutCopperSlab
|
||||
case 21850: // WaxedWeatheredCutCopperSlab
|
||||
case 21844: // WaxedOxidizedCutCopperSlab
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case Protocol18Handler.MC_1_19_3_Version:
|
||||
switch (block.BlockId)
|
||||
{
|
||||
case 10686: // OakSlab
|
||||
case 10692: // SpruceSlab
|
||||
case 10698: // BirchSlab
|
||||
case 10704: // JungleSlab
|
||||
case 10710: // AcaciaSlab
|
||||
case 10716: // DarkOakSlab
|
||||
case 10722: // MangroveSlab
|
||||
case 18041: // CrimsonSlab
|
||||
case 18047: // WarpedSlab
|
||||
case 10740: // StoneSlab
|
||||
case 10770: // CobblestoneSlab
|
||||
case 13479: // MossyCobblestoneSlab
|
||||
case 10746: // SmoothStoneSlab
|
||||
case 10782: // StoneBrickSlab
|
||||
case 13467: // MossyStoneBrickSlab
|
||||
case 13503: // GraniteSlab
|
||||
case 13455: // PolishedGraniteSlab
|
||||
case 13527: // DioriteSlab
|
||||
case 13473: // PolishedDioriteSlab
|
||||
case 13509: // AndesiteSlab
|
||||
case 13521: // PolishedAndesiteSlab
|
||||
case 21647: // CobbledDeepslateSlab
|
||||
case 22058: // PolishedDeepslateSlab
|
||||
case 22880: // DeepslateBrickSlab
|
||||
case 22469: // DeepslateTileSlab
|
||||
case 10776: // BrickSlab
|
||||
case 10788: // MudBrickSlab
|
||||
case 10752: // SandstoneSlab
|
||||
case 13491: // SmoothSandstoneSlab
|
||||
case 10758: // CutSandstoneSlab
|
||||
case 10806: // RedSandstoneSlab
|
||||
case 13461: // SmoothRedSandstoneSlab
|
||||
case 10812: // CutRedSandstoneSlab
|
||||
case 10230: // PrismarineSlab
|
||||
case 10236: // PrismarineBrickSlab
|
||||
case 10242: // DarkPrismarineSlab
|
||||
case 10794: // NetherBrickSlab
|
||||
case 13515: // RedNetherBrickSlab
|
||||
case 19238: // BlackstoneSlab
|
||||
case 19739: // PolishedBlackstoneSlab
|
||||
case 19248: // PolishedBlackstoneBrickSlab
|
||||
case 13485: // EndStoneBrickSlab
|
||||
case 10818: // PurpurSlab
|
||||
case 10800: // QuartzSlab
|
||||
case 13497: // SmoothQuartzSlab
|
||||
case 21041: // CutCopperSlab
|
||||
case 21035: // ExposedCutCopperSlab
|
||||
case 21029: // WeatheredCutCopperSlab
|
||||
case 21023: // OxidizedCutCopperSlab
|
||||
case 21393: // WaxedCutCopperSlab
|
||||
case 21387: // WaxedExposedCutCopperSlab
|
||||
case 21381: // WaxedWeatheredCutCopperSlab
|
||||
case 21375: // WaxedOxidizedCutCopperSlab
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case >= Protocol18Handler.MC_1_19_Version:
|
||||
switch (block.BlockId)
|
||||
{
|
||||
case 19257: // CutCopperSlab
|
||||
case 19251: // ExposedCutCopperSlab
|
||||
case 19245: // WeatheredCutCopperSlab
|
||||
case 19239: // OxidizedCutCopperSlab
|
||||
case 19609: // WaxedCutCopperSlab
|
||||
case 19603: // WaxedExposedCutCopperSlab
|
||||
case 19597: // WaxedWeatheredCutCopperSlab
|
||||
case 19591: // WaxedOxidizedCutCopperSlab
|
||||
case 9042: // OakSlab
|
||||
case 9048: // SpruceSlab
|
||||
case 9054: // BirchSlab
|
||||
case 9060: // JungleSlab
|
||||
case 9066: // AcaciaSlab
|
||||
case 9072: // DarkOakSlab
|
||||
case 9078: // MangroveSlab
|
||||
case 16257: // CrimsonSlab
|
||||
case 16263: // WarpedSlab
|
||||
case 9084: // StoneSlab
|
||||
case 9090: // SmoothStoneSlab
|
||||
case 9096: // SandstoneSlab
|
||||
case 9102: // CutSandstoneSlab
|
||||
case 9108: // PetrifiedOakSlab
|
||||
case 9114: // CobblestoneSlab
|
||||
case 9120: // BrickSlab
|
||||
case 9126: // StoneBrickSlab
|
||||
case 9132: // MudBrickSlab
|
||||
case 9138: // NetherBrickSlab
|
||||
case 9144: // QuartzSlab
|
||||
case 9150: // RedSandstoneSlab
|
||||
case 9156: // CutRedSandstoneSlab
|
||||
case 9162: // PurpurSlab
|
||||
case 8586: // PrismarineSlab
|
||||
case 8592: // PrismarineBrickSlab
|
||||
case 8598: // DarkPrismarineSlab
|
||||
case 11671: // PolishedGraniteSlab
|
||||
case 11677: // SmoothRedSandstoneSlab
|
||||
case 11683: // MossyStoneBrickSlab
|
||||
case 11689: // PolishedDioriteSlab
|
||||
case 11695: // MossyCobblestoneSlab
|
||||
case 11701: // EndStoneBrickSlab
|
||||
case 11707: // SmoothSandstoneSlab
|
||||
case 11713: // SmoothQuartzSlab
|
||||
case 11719: // GraniteSlab
|
||||
case 11725: // AndesiteSlab
|
||||
case 11731: // RedNetherBrickSlab
|
||||
case 11737: // PolishedAndesiteSlab
|
||||
case 11743: // DioriteSlab
|
||||
case 19863: // CobbledDeepslateSlab
|
||||
case 20274: // PolishedDeepslateSlab
|
||||
case 21096: // DeepslateBrickSlab
|
||||
case 20685: // DeepslateTileSlab
|
||||
case 17454: // BlackstoneSlab
|
||||
case 17955: // PolishedBlackstoneSlab
|
||||
case 17464: // PolishedBlackstoneBrickSlab
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case >= Protocol18Handler.MC_1_17_Version:
|
||||
switch (block.BlockId)
|
||||
{
|
||||
case 18163: // CutCopperSlab
|
||||
case 18157: // ExposedCutCopperSlab
|
||||
case 18151: // WeatheredCutCopperSlab
|
||||
case 18145: // OxidizedCutCopperSlab
|
||||
case 18515: // WaxedCutCopperSlab
|
||||
case 18509: // WaxedExposedCutCopperSlab
|
||||
case 18503: // WaxedWeatheredCutCopperSlab
|
||||
case 18497: // WaxedOxidizedCutCopperSlab
|
||||
case 8551: // OakSlab
|
||||
case 8557: // SpruceSlab
|
||||
case 8563: // BirchSlab
|
||||
case 8569: // JungleSlab
|
||||
case 8575: // AcaciaSlab
|
||||
case 8581: // DarkOakSlab
|
||||
case 15302: // CrimsonSlab
|
||||
case 15308: // WarpedSlab
|
||||
case 8587: // StoneSlab
|
||||
case 8593: // SmoothStoneSlab
|
||||
case 8599: // SandstoneSlab
|
||||
case 8605: // CutSandstoneSlab
|
||||
case 8611: // PetrifiedOakSlab
|
||||
case 8617: // CobblestoneSlab
|
||||
case 8623: // BrickSlab
|
||||
case 8629: // StoneBrickSlab
|
||||
case 8635: // NetherBrickSlab
|
||||
case 8641: // QuartzSlab
|
||||
case 8647: // RedSandstoneSlab
|
||||
case 8653: // CutRedSandstoneSlab
|
||||
case 8659: // PurpurSlab
|
||||
case 8095: // PrismarineSlab
|
||||
case 8101: // PrismarineBrickSlab
|
||||
case 8107: // DarkPrismarineSlab
|
||||
case 11040: // PolishedGraniteSlab
|
||||
case 11046: // SmoothRedSandstoneSlab
|
||||
case 11052: // MossyStoneBrickSlab
|
||||
case 11058: // PolishedDioriteSlab
|
||||
case 11064: // MossyCobblestoneSlab
|
||||
case 11070: // EndStoneBrickSlab
|
||||
case 11076: // SmoothSandstoneSlab
|
||||
case 11082: // SmoothQuartzSlab
|
||||
case 11088: // GraniteSlab
|
||||
case 11094: // AndesiteSlab
|
||||
case 11100: // RedNetherBrickSlab
|
||||
case 11106: // PolishedAndesiteSlab
|
||||
case 11112: // DioriteSlab
|
||||
case 18768: // CobbledDeepslateSlab
|
||||
case 19179: // PolishedDeepslateSlab
|
||||
case 20001: // DeepslateBrickSlab
|
||||
case 19590: // DeepslateTileSlab
|
||||
case 16499: // BlackstoneSlab
|
||||
case 17000: // PolishedBlackstoneSlab
|
||||
case 16509: // PolishedBlackstoneBrickSlab
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case >= Protocol18Handler.MC_1_16_Version:
|
||||
switch (block.BlockId)
|
||||
{
|
||||
case 8305: // OakSlab
|
||||
case 8311: // SpruceSlab
|
||||
case 8317: // BirchSlab
|
||||
case 8323: // JungleSlab
|
||||
case 8329: // AcaciaSlab
|
||||
case 8335: // DarkOakSlab
|
||||
case 15056: // CrimsonSlab
|
||||
case 15062: // WarpedSlab
|
||||
case 8341: // StoneSlab
|
||||
case 8347: // SmoothStoneSlab
|
||||
case 8353: // SandstoneSlab
|
||||
case 8359: // CutSandstoneSlab
|
||||
case 8365: // PetrifiedOakSlab
|
||||
case 8371: // CobblestoneSlab
|
||||
case 8377: // BrickSlab
|
||||
case 8383: // StoneBrickSlab
|
||||
case 8389: // NetherBrickSlab
|
||||
case 8395: // QuartzSlab
|
||||
case 8401: // RedSandstoneSlab
|
||||
case 8407: // CutRedSandstoneSlab
|
||||
case 8413: // PurpurSlab
|
||||
case 7849: // PrismarineSlab
|
||||
case 7855: // PrismarineBrickSlab
|
||||
case 7861: // DarkPrismarineSlab
|
||||
case 10794: // PolishedGraniteSlab
|
||||
case 10800: // SmoothRedSandstoneSlab
|
||||
case 10806: // MossyStoneBrickSlab
|
||||
case 10812: // PolishedDioriteSlab
|
||||
case 10818: // MossyCobblestoneSlab
|
||||
case 10824: // EndStoneBrickSlab
|
||||
case 10830: // SmoothSandstoneSlab
|
||||
case 10836: // SmoothQuartzSlab
|
||||
case 10842: // GraniteSlab
|
||||
case 10848: // AndesiteSlab
|
||||
case 10854: // RedNetherBrickSlab
|
||||
case 10860: // PolishedAndesiteSlab
|
||||
case 10866: // DioriteSlab
|
||||
case 16253: // BlackstoneSlab
|
||||
case 16754: // PolishedBlackstoneSlab
|
||||
case 16263: // PolishedBlackstoneBrickSlab
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case >= Protocol18Handler.MC_1_15_Version:
|
||||
switch (block.BlockId)
|
||||
{
|
||||
case 7765: // OakSlab
|
||||
case 7771: // SpruceSlab
|
||||
case 7777: // BirchSlab
|
||||
case 7783: // JungleSlab
|
||||
case 7789: // AcaciaSlab
|
||||
case 7795: // DarkOakSlab
|
||||
case 7801: // StoneSlab
|
||||
case 7807: // SmoothStoneSlab
|
||||
case 7813: // SandstoneSlab
|
||||
case 7819: // CutSandstoneSlab
|
||||
case 7825: // PetrifiedOakSlab
|
||||
case 7831: // CobblestoneSlab
|
||||
case 7837: // BrickSlab
|
||||
case 7843: // StoneBrickSlab
|
||||
case 7849: // NetherBrickSlab
|
||||
case 7855: // QuartzSlab
|
||||
case 7861: // RedSandstoneSlab
|
||||
case 7867: // CutRedSandstoneSlab
|
||||
case 7873: // PurpurSlab
|
||||
case 7309: // PrismarineSlab
|
||||
case 7321: // DarkPrismarineSlab
|
||||
case 10254: // PolishedGraniteSlab
|
||||
case 10260: // SmoothRedSandstoneSlab
|
||||
case 10266: // MossyStoneBrickSlab
|
||||
case 10272: // PolishedDioriteSlab
|
||||
case 10278: // MossyCobblestoneSlab
|
||||
case 10284: // EndStoneBrickSlab
|
||||
case 10290: // SmoothSandstoneSlab
|
||||
case 10296: // SmoothQuartzSlab
|
||||
case 10302: // GraniteSlab
|
||||
case 10308: // AndesiteSlab
|
||||
case 10314: // RedNetherBrickSlab
|
||||
case 10320: // PolishedAndesiteSlab
|
||||
case 10326: // DioriteSlab
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case >= Protocol18Handler.MC_1_14_Version:
|
||||
switch (block.BlockId)
|
||||
{
|
||||
case 7765: // OakSlab
|
||||
case 7771: // SpruceSlab
|
||||
case 7777: // BirchSlab
|
||||
case 7783: // JungleSlab
|
||||
case 7789: // AcaciaSlab
|
||||
case 7795: // DarkOakSlab
|
||||
case 7801: // StoneSlab
|
||||
case 7807: // SmoothStoneSlab
|
||||
case 7813: // SandstoneSlab
|
||||
case 7819: // CutSandstoneSlab
|
||||
case 7825: // PetrifiedOakSlab
|
||||
case 7831: // CobblestoneSlab
|
||||
case 7837: // BrickSlab
|
||||
case 7843: // StoneBrickSlab
|
||||
case 7849: // NetherBrickSlab
|
||||
case 7855: // QuartzSlab
|
||||
case 7861: // RedSandstoneSlab
|
||||
case 7867: // CutRedSandstoneSlab
|
||||
case 7873: // PurpurSlab
|
||||
case 7309: // PrismarineSlab
|
||||
case 7315: // PrismarineBrickSlab
|
||||
case 7321: // DarkPrismarineSlab
|
||||
case 10254: // PolishedGraniteSlab
|
||||
case 10260: // SmoothRedSandstoneSlab
|
||||
case 10266: // MossyStoneBrickSlab
|
||||
case 10272: // PolishedDioriteSlab
|
||||
case 10278: // MossyCobblestoneSlab
|
||||
case 10284: // EndStoneBrickSlab
|
||||
case 10290: // SmoothSandstoneSlab
|
||||
case 10296: // SmoothQuartzSlab
|
||||
case 10302: // GraniteSlab
|
||||
case 10308: // AndesiteSlab
|
||||
case 10314: // RedNetherBrickSlab
|
||||
case 10320: // PolishedAndesiteSlab
|
||||
case 10326: // DioriteSlab
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ using MinecraftClient.Protocol.ProfileKey;
|
|||
using MinecraftClient.Protocol.Session;
|
||||
using MinecraftClient.Proxy;
|
||||
using MinecraftClient.Scripting;
|
||||
using Newtonsoft.Json;
|
||||
using static MinecraftClient.Settings;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers
|
||||
|
|
@ -2348,6 +2349,17 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
// TODO: Use
|
||||
break;
|
||||
|
||||
// Temporarily disabled until I find a fix
|
||||
/*case PacketTypesIn.BlockEntityData:
|
||||
var location_ = dataTypes.ReadNextLocation(packetData);
|
||||
var type_ = dataTypes.ReadNextInt(packetData);
|
||||
var nbt = dataTypes.ReadNextNbt(packetData);
|
||||
var nbtJson = JsonConvert.SerializeObject(nbt["messages"]);
|
||||
|
||||
//log.Info($"BLOCK ENTITY DATA -> {location_.ToString()} [{type_}] -> NBT: {nbtJson}");
|
||||
|
||||
break;*/
|
||||
|
||||
default:
|
||||
return false; //Ignored packet
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
|
|
@ -3956,5 +3956,17 @@ namespace MinecraftClient {
|
|||
return ResourceManager.GetString("cmd.nameitem.desc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
internal static string bot_antiafk_may_not_move {
|
||||
get {
|
||||
return ResourceManager.GetString("bot.antiafk.may.not.move", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
internal static string bot_common_movement_lock_held {
|
||||
get {
|
||||
return ResourceManager.GetString("bot.common.movement.lock.held", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2109,4 +2109,10 @@ Logging in...</value>
|
|||
<data name="cmd.nameitem.desc" xml:space="preserve">
|
||||
<value>Set an item name when an Anvil inventory is active and the item is in the first slot.</value>
|
||||
</data>
|
||||
<data name="bot.antiafk.may.not.move" xml:space="preserve">
|
||||
<value>Bot movement lock is held by bot {0}, so the Anti AFK bot might not move!</value>
|
||||
</data>
|
||||
<data name="bot.common.movement.lock.held" xml:space="preserve">
|
||||
<value>You can not start/run/use the '{0}' bot because it requires movement, the movement is currently utilized by the '{1}' bot, stop it if you want to use this one.</value>
|
||||
</data>
|
||||
</root>
|
||||
35
MinecraftClient/Scripting/BotMovementLock.cs
Normal file
35
MinecraftClient/Scripting/BotMovementLock.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
namespace MinecraftClient.Scripting;
|
||||
|
||||
public class BotMovementLock
|
||||
{
|
||||
private static BotMovementLock? InstancePrivate;
|
||||
private string _heldBy = string.Empty;
|
||||
|
||||
private BotMovementLock()
|
||||
{
|
||||
InstancePrivate = this;
|
||||
}
|
||||
|
||||
public static BotMovementLock? Instance => InstancePrivate ??= new BotMovementLock();
|
||||
|
||||
public bool Lock(string owner)
|
||||
{
|
||||
if (owner.Trim().Length == 0 || _heldBy.Length > 0)
|
||||
return false;
|
||||
|
||||
_heldBy = owner.Trim();
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool UnLock(string owner)
|
||||
{
|
||||
if (owner.Trim().Length == 0 || _heldBy.Length == 0 || !_heldBy.ToLower().Equals(owner.ToLower().Trim()))
|
||||
return false;
|
||||
|
||||
_heldBy = string.Empty;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool IsLocked => _heldBy.Length > 0;
|
||||
public string LockedBy => _heldBy;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue