Implement Terrain and Movements for MC 1.13

Special thanks to @TheSnoozer and @vkorn for their help!

 - Implement global block Palette mechanism
 - Add class generation tool from blocks.json
 - Regenerate Material.cs and redefine solid blocks
 - Migrate previous Material.cs into Palette112
 - Generate Palette113 from MC 1.13.2 blocks.json
 - Improve Block class to handle up to 65535 block states
 - Adjust terrain parsing, small fixes in packets
 - Remove unused snapshot-related protocol cases

Solves #599
This commit is contained in:
ORelio 2019-04-25 22:09:33 +02:00
parent b57630a5e4
commit c04b17cabc
12 changed files with 10147 additions and 573 deletions

View file

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using MinecraftClient.Mapping.BlockPalettes;
namespace MinecraftClient.Mapping namespace MinecraftClient.Mapping
{ {
@ -11,39 +12,70 @@ namespace MinecraftClient.Mapping
public struct Block public struct Block
{ {
/// <summary> /// <summary>
/// Storage for block ID and metadata /// Get or set global block ID to Material mapping
/// The global Palette is a concept introduced with Minecraft 1.13
/// </summary>
public static PaletteMapping Palette { get; set; }
/// <summary>
/// Storage for block ID and metadata, as ushort for compatibility, performance and lower memory footprint
/// For Minecraft 1.12 and lower, first 12 bits contain block ID (0-4095), last 4 bits contain metadata (0-15)
/// For Minecraft 1.13 and greater, all 16 bits are used to store block state ID (0-65535)
/// </summary> /// </summary>
private ushort blockIdAndMeta; private ushort blockIdAndMeta;
/// <summary> /// <summary>
/// Id of the block /// Id of the block
/// </summary> /// </summary>
public short BlockId public int BlockId
{ {
get get
{ {
return (short)(blockIdAndMeta >> 4); if (Palette.IdHasMetadata)
{
return blockIdAndMeta >> 4;
}
return blockIdAndMeta;
} }
set set
{ {
if (Palette.IdHasMetadata)
{
if (value > (ushort.MaxValue >> 4) || value < 0)
throw new ArgumentOutOfRangeException("value", "Invalid block ID. Accepted range: 0-4095");
blockIdAndMeta = (ushort)(value << 4 | BlockMeta); blockIdAndMeta = (ushort)(value << 4 | BlockMeta);
} }
else
{
if (value > ushort.MaxValue || value < 0)
throw new ArgumentOutOfRangeException("value", "Invalid block ID. Accepted range: 0-65535");
blockIdAndMeta = (ushort)value;
}
}
} }
/// <summary> /// <summary>
/// Metadata of the block /// Metadata of the block.
/// This field has no effect starting with Minecraft 1.13.
/// </summary> /// </summary>
public byte BlockMeta public byte BlockMeta
{ {
get get
{
if (Palette.IdHasMetadata)
{ {
return (byte)(blockIdAndMeta & 0x0F); return (byte)(blockIdAndMeta & 0x0F);
} }
return 0;
}
set set
{
if (Palette.IdHasMetadata)
{ {
blockIdAndMeta = (ushort)((blockIdAndMeta & ~0x0F) | (value & 0x0F)); blockIdAndMeta = (ushort)((blockIdAndMeta & ~0x0F) | (value & 0x0F));
} }
} }
}
/// <summary> /// <summary>
/// Material of the block /// Material of the block
@ -52,7 +84,7 @@ namespace MinecraftClient.Mapping
{ {
get get
{ {
return (Material)BlockId; return Palette.FromId(BlockId);
} }
} }
@ -63,27 +95,22 @@ namespace MinecraftClient.Mapping
/// <param name="metadata">Block metadata</param> /// <param name="metadata">Block metadata</param>
public Block(short type, byte metadata = 0) public Block(short type, byte metadata = 0)
{ {
if (!Palette.IdHasMetadata)
throw new InvalidOperationException("Current global Palette does not support block Metadata");
this.blockIdAndMeta = 0; this.blockIdAndMeta = 0;
this.BlockId = type; this.BlockId = type;
this.BlockMeta = metadata; this.BlockMeta = metadata;
} }
/// <summary> /// <summary>
/// Get a block of the specified type and metadata /// Get a block of the specified type and metadata OR block state
/// </summary> /// </summary>
/// <param name="typeAndMeta">Type and metadata packed in the same value</param> /// <param name="typeAndMeta">Type and metadata packed in the same value OR block state</param>
public Block(ushort typeAndMeta) public Block(ushort typeAndMeta)
{ {
this.blockIdAndMeta = typeAndMeta; this.blockIdAndMeta = typeAndMeta;
} }
/// <summary>
/// Get a block of the specified type and metadata
/// </summary>
/// <param name="type">Block type</param>
public Block(Material type, byte metadata = 0)
: this((short)type, metadata) { }
/// <summary> /// <summary>
/// String representation of the block /// String representation of the block
/// </summary> /// </summary>

View file

@ -0,0 +1,202 @@
using System;
using System.Collections.Generic;
namespace MinecraftClient.Mapping.BlockPalettes
{
/// <summary>
/// Defines mappings for pre-1.13 block IDs to post-1.13 Materials
/// Some block Ids could map to different blocks depending on BlockMeta, here we assumed BlockMeta = 0
/// Some blocks previously had different IDs depending on state, they have been merged here
/// Comments correspond to changed material names since previous MCC versions
/// </summary>
public class Palette112 : PaletteMapping
{
private static Dictionary<int, Material> materials = new Dictionary<int, Material>()
{
{ 0, Material.Air },
{ 1, Material.Stone },
{ 2, Material.GrassBlock }, // Grass
{ 3, Material.Dirt },
{ 4, Material.Cobblestone },
{ 5, Material.OakPlanks }, // Wood:0
{ 6, Material.OakSapling }, // Sapling:0
{ 7, Material.Bedrock },
{ 8, Material.Water }, // FlowingWater
{ 9, Material.Water }, // StationaryWater
{ 10, Material.Lava }, // FlowingLava
{ 11, Material.Lava }, // StationaryLava
{ 12, Material.Sand },
{ 13, Material.Gravel },
{ 14, Material.GoldOre },
{ 15, Material.IronOre },
{ 16, Material.CoalOre },
{ 17, Material.OakLog }, // Log:0
{ 18, Material.OakLeaves }, // Leaves:0
{ 19, Material.Sponge },
{ 20, Material.Glass },
{ 21, Material.LapisOre },
{ 22, Material.LapisBlock },
{ 23, Material.Dispenser },
{ 24, Material.Sandstone },
{ 25, Material.NoteBlock },
{ 26, Material.RedBed }, // Bed:0
{ 27, Material.PoweredRail },
{ 28, Material.DetectorRail },
{ 29, Material.StickyPiston }, // PistonStickyBase
{ 30, Material.Cobweb }, // Web
{ 31, Material.Grass }, // LongGrass
{ 32, Material.DeadBush },
{ 33, Material.Piston }, // PistonBase
{ 34, Material.PistonHead }, // PistonExtension
{ 35, Material.WhiteWool }, // Wool:0
{ 36, Material.MovingPiston }, // PistonMovingPiece
{ 37, Material.Dandelion }, // YellowFlower
{ 38, Material.Poppy }, // RedRose
{ 39, Material.BrownMushroom },
{ 40, Material.RedMushroom },
{ 41, Material.GoldBlock },
{ 42, Material.IronBlock },
{ 43, Material.StoneSlab }, // DoubleStep
{ 44, Material.StoneSlab }, // Step
{ 45, Material.Bricks }, // Brick
{ 46, Material.Tnt },
{ 47, Material.Bookshelf },
{ 48, Material.MossyCobblestone },
{ 49, Material.Obsidian },
{ 50, Material.Torch },
{ 51, Material.Fire },
{ 52, Material.Spawner }, // MobSpawner
{ 53, Material.OakStairs }, // WoodStairs:0
{ 54, Material.Chest },
{ 55, Material.RedstoneWire },
{ 56, Material.DiamondOre },
{ 57, Material.DiamondBlock },
{ 58, Material.CraftingTable }, // Workbench
{ 59, Material.Wheat }, // Crops
{ 60, Material.Farmland }, // Soil
{ 61, Material.Furnace }, // Furnace
{ 62, Material.Furnace }, // BurningFurnace
{ 63, Material.WallSign }, // SignPost
{ 64, Material.OakDoor }, // WoodenDoor:0
{ 65, Material.Ladder },
{ 66, Material.Rail }, // Rails
{ 67, Material.CobblestoneStairs },
{ 68, Material.WallSign },
{ 69, Material.Lever },
{ 70, Material.StonePressurePlate }, // StonePlate
{ 71, Material.IronDoor }, // IronDoorBlock
{ 72, Material.OakPressurePlate }, // WoodPlate:0
{ 73, Material.RedstoneOre }, // RedstoneOre
{ 74, Material.RedstoneOre }, // GlowingRedstoneOre
{ 75, Material.RedstoneTorch }, // RedstoneTorchOff
{ 76, Material.RedstoneTorch }, // RedstoneTorchOn
{ 77, Material.StoneButton },
{ 78, Material.Snow },
{ 79, Material.Ice },
{ 80, Material.SnowBlock },
{ 81, Material.Cactus },
{ 82, Material.Clay },
{ 83, Material.SugarCane }, // SugarCaneBlock
{ 84, Material.Jukebox },
{ 85, Material.OakFence }, // Fence:0
{ 86, Material.Pumpkin },
{ 87, Material.Netherrack },
{ 88, Material.SoulSand },
{ 89, Material.Glowstone },
{ 90, Material.NetherPortal }, // Portal
{ 91, Material.JackOLantern },
{ 92, Material.Cake }, // CakeBlock
{ 93, Material.Repeater }, // DiodeBlockOff
{ 94, Material.Repeater }, // DiodeBlockOn
{ 95, Material.WhiteStainedGlass }, // StainedGlass:0
{ 96, Material.OakTrapdoor }, // TrapDoor
{ 97, Material.InfestedStone }, // MonsterEggs:0
{ 98, Material.StoneBricks }, // SmoothBrick
{ 99, Material.BrownMushroomBlock }, // HugeMushroom1
{ 100, Material.BrownMushroomBlock }, // HugeMushroom2
{ 101, Material.IronBars }, // IronFence
{ 102, Material.GlassPane }, // ThinGlass
{ 103, Material.Melon }, // MelonBlock
{ 104, Material.PumpkinStem },
{ 105, Material.MelonStem },
{ 106, Material.Vine },
{ 107, Material.OakFenceGate }, // FenceGate:0
{ 108, Material.BrickStairs },
{ 109, Material.StoneBrickStairs }, // SmoothStairs
{ 110, Material.Mycelium }, // Mycel
{ 111, Material.LilyPad }, // WaterLily
{ 112, Material.NetherBricks}, // NetherBrick
{ 113, Material.NetherBrickFence }, // NetherFence
{ 114, Material.NetherBrickStairs },
{ 115, Material.NetherWart }, // NetherWarts
{ 116, Material.EnchantingTable }, // EnchantmentTable
{ 117, Material.BrewingStand },
{ 118, Material.Cauldron },
{ 119, Material.EndPortal }, // EnderPortal
{ 120, Material.EndPortalFrame }, // EnderPortalFrame
{ 121, Material.EndStone }, // EnderStone
{ 122, Material.DragonEgg },
{ 123, Material.RedstoneLamp }, // RedstoneLampOff
{ 124, Material.RedstoneLamp }, // RedstoneLampOn
{ 125, Material.OakSlab }, // WoodDoubleStep:0
{ 126, Material.OakSlab }, // WoodStep
{ 127, Material.Cocoa },
{ 128, Material.SandstoneStairs },
{ 129, Material.EmeraldOre },
{ 130, Material.EnderChest },
{ 131, Material.TripwireHook },
{ 132, Material.Tripwire },
{ 133, Material.EmeraldBlock },
{ 134, Material.SpruceStairs }, // SpruceWoodStairs
{ 135, Material.BirchStairs }, // BirchWoodStairs
{ 136, Material.JungleStairs }, // JungleWoodStairs
{ 137, Material.CommandBlock }, // Command
{ 138, Material.Beacon },
{ 139, Material.CobblestoneWall }, // CobbleWall
{ 140, Material.FlowerPot },
{ 141, Material.Carrots }, // Carrot
{ 142, Material.Potatoes }, // Potato
{ 143, Material.OakButton }, // WoodButton
{ 144, Material.SkeletonSkull }, // Skull:0
{ 145, Material.Anvil },
{ 146, Material.TrappedChest },
{ 147, Material.LightWeightedPressurePlate }, // GoldPlate
{ 148, Material.HeavyWeightedPressurePlate }, // IronPlate
{ 149, Material.Comparator }, // RedstoneComparatorOff
{ 150, Material.Comparator }, // RedstoneComparatorOn
{ 151, Material.DaylightDetector },
{ 152, Material.RedstoneBlock },
{ 153, Material.QuartzBlock }, // QuartzOre
{ 154, Material.Hopper },
{ 155, Material.QuartzBlock },
{ 156, Material.QuartzStairs },
{ 157, Material.ActivatorRail },
{ 158, Material.Dropper },
{ 159, Material.WhiteConcrete }, // StainedClay:0
{ 160, Material.WhiteStainedGlassPane }, // StainedGlassPane:0
{ 161, Material.OakLeaves }, // Leaves2:0
{ 162, Material.OakLog }, // Log2:0
{ 163, Material.AcaciaStairs },
{ 164, Material.DarkOakStairs },
{ 170, Material.HayBlock },
{ 171, Material.WhiteCarpet }, // Carpet:0
{ 172, Material.WhiteConcrete }, // HardClay
{ 173, Material.CoalBlock },
{ 174, Material.PackedIce },
{ 175, Material.TallGrass }, // DoublePlant
};
protected override Dictionary<int, Material> GetDict()
{
return materials;
}
public override bool IdHasMetadata
{
get
{
return true;
}
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace MinecraftClient.Mapping.BlockPalettes
{
/// <summary>
/// Generator for MCC Palette mappings
/// </summary>
public static class PaletteGenerator
{
/// <summary>
/// Generate mapping from Minecraft blocks.jsom
/// </summary>
/// <param name="blocksJsonFile">path to blocks.json</param>
/// <param name="outputClass">output path for blocks.cs</param>
/// <param name="outputEnum">output path for material.cs</param>
/// <remarks>java -cp minecraft_server.jar net.minecraft.data.Main --reports</remarks>
/// <returns>state => block name mappings</returns>
public static void JsonToClass(string blocksJsonFile, string outputClass, string outputEnum = null)
{
Dictionary<int, string> blocks = new Dictionary<int, string>();
Json.JSONData palette = Json.ParseJson(File.ReadAllText(blocksJsonFile));
foreach (KeyValuePair<string, Json.JSONData> item in palette.Properties)
{
string blockType = item.Key;
foreach (Json.JSONData state in item.Value.Properties["states"].DataArray)
{
int id = int.Parse(state.Properties["id"].StringValue);
blocks[id] = blockType;
}
}
HashSet<string> materials = new HashSet<string>();
List<string> outFile = new List<string>();
outFile.AddRange(new[] {
"using System;",
"using System.Collections.Generic;",
"",
"namespace MinecraftClient.Mapping.BlockPalettes",
"{",
" public class PaletteXXX : PaletteMapping",
" {",
" private static Dictionary<int, Material> materials = new Dictionary<int, Material>()",
" {",
});
foreach (KeyValuePair<int, string> item in blocks)
{
//minecraft:item_name => ItemName
string name = String.Concat(
item.Value.Replace("minecraft:", "")
.Split('_')
.Select(word => char.ToUpper(word[0]) + word.Substring(1))
);
outFile.Add(" { " + item.Key + ", Material." + name + " },");
materials.Add(name);
}
outFile.AddRange(new[] {
" };",
"",
" protected override Dictionary<int, Material> GetDict()",
" {",
" return materials;",
" }",
" }",
"}"
});
File.WriteAllLines(outputClass, outFile);
if (outputEnum != null)
{
outFile = new List<string>();
outFile.Add(" public enum Material");
outFile.Add(" {");
foreach (string material in materials)
outFile.Add(" " + material + ",");
outFile.Add(" }");
File.WriteAllLines(outputEnum, outFile);
}
}
}
}

View file

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MinecraftClient.Mapping.BlockPalettes
{
public abstract class PaletteMapping
{
/// <summary>
/// Get mapping dictionary. Must be overriden with proper implementation.
/// </summary>
/// <returns>Palette dictionary</returns>
protected abstract Dictionary<int, Material> GetDict();
/// <summary>
/// Get material from block ID or block state ID
/// </summary>
/// <param name="id">Block ID (up to MC 1.12) or block state (MC 1.13+)</param>
/// <returns>Material corresponding to the specified ID</returns>
public Material FromId(int id)
{
Dictionary<int, Material> materials = GetDict();
if (materials.ContainsKey(id))
return materials[id];
return Material.Air;
}
/// <summary>
/// Returns TRUE if block ID uses old metadata encoding with ID and Meta inside one ushort
/// Only Palette112 should override this.
/// </summary>
public virtual bool IdHasMetadata
{
get
{
return false;
}
}
}
}

View file

@ -4,362 +4,607 @@
/// Represents Minecraft Materials /// Represents Minecraft Materials
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Mostly ported from CraftBukkit's Material class /// Generated from blocks.json using PaletteGenerator.cs
/// </remarks> /// </remarks>
/// <see href="https://github.com/Bukkit/Bukkit/blob/master/src/main/java/org/bukkit/Material.java"/>
public enum Material public enum Material
{ {
Air = 0, Air,
Stone = 1, Stone,
Grass = 2, Granite,
Dirt = 3, PolishedGranite,
Cobblestone = 4, Diorite,
Wood = 5, PolishedDiorite,
Sapling = 6, Andesite,
Bedrock = 7, PolishedAndesite,
Water = 8, GrassBlock,
StationaryWater = 9, Dirt,
Lava = 10, CoarseDirt,
StationaryLava = 11, Podzol,
Sand = 12, Cobblestone,
Gravel = 13, OakPlanks,
GoldOre = 14, SprucePlanks,
IronOre = 15, BirchPlanks,
CoalOre = 16, JunglePlanks,
Log = 17, AcaciaPlanks,
Leaves = 18, DarkOakPlanks,
Sponge = 19, OakSapling,
Glass = 20, SpruceSapling,
LapisOre = 21, BirchSapling,
LapisBlock = 22, JungleSapling,
Dispenser = 23, AcaciaSapling,
Sandstone = 24, DarkOakSapling,
NoteBlock = 25, Bedrock,
BedBlock = 26, Water,
PoweredRail = 27, Lava,
DetectorRail = 28, Sand,
PistonStickyBase = 29, RedSand,
Web = 30, Gravel,
LongGrass = 31, GoldOre,
DeadBush = 32, IronOre,
PistonBase = 33, CoalOre,
PistonExtension = 34, OakLog,
Wool = 35, SpruceLog,
PistonMovingPiece = 36, BirchLog,
YellowFlower = 37, JungleLog,
RedRose = 38, AcaciaLog,
BrownMushroom = 39, DarkOakLog,
RedMushroom = 40, StrippedSpruceLog,
GoldBlock = 41, StrippedBirchLog,
IronBlock = 42, StrippedJungleLog,
DoubleStep = 43, StrippedAcaciaLog,
Step = 44, StrippedDarkOakLog,
Brick = 45, StrippedOakLog,
Tnt = 46, OakWood,
Bookshelf = 47, SpruceWood,
MossyCobblestone = 48, BirchWood,
Obsidian = 49, JungleWood,
Torch = 50, AcaciaWood,
Fire = 51, DarkOakWood,
MobSpawner = 52, StrippedOakWood,
WoodStairs = 53, StrippedSpruceWood,
Chest = 54, StrippedBirchWood,
RedstoneWire = 55, StrippedJungleWood,
DiamondOre = 56, StrippedAcaciaWood,
DiamondBlock = 57, StrippedDarkOakWood,
Workbench = 58, OakLeaves,
Crops = 59, SpruceLeaves,
Soil = 60, BirchLeaves,
Furnace = 61, JungleLeaves,
BurningFurnace = 62, AcaciaLeaves,
SignPost = 63, DarkOakLeaves,
WoodenDoor = 64, Sponge,
Ladder = 65, WetSponge,
Rails = 66, Glass,
CobblestoneStairs = 67, LapisOre,
WallSign = 68, LapisBlock,
Lever = 69, Dispenser,
StonePlate = 70, Sandstone,
IronDoorBlock = 71, ChiseledSandstone,
WoodPlate = 72, CutSandstone,
RedstoneOre = 73, NoteBlock,
GlowingRedstoneOre = 74, WhiteBed,
RedstoneTorchOff = 75, OrangeBed,
RedstoneTorchOn = 76, MagentaBed,
StoneButton = 77, LightBlueBed,
Snow = 78, YellowBed,
Ice = 79, LimeBed,
SnowBlock = 80, PinkBed,
Cactus = 81, GrayBed,
Clay = 82, LightGrayBed,
SugarCaneBlock = 83, CyanBed,
Jukebox = 84, PurpleBed,
Fence = 85, BlueBed,
Pumpkin = 86, BrownBed,
Netherrack = 87, GreenBed,
SoulSand = 88, RedBed,
Glowstone = 89, BlackBed,
Portal = 90, PoweredRail,
JackOLantern = 91, DetectorRail,
CakeBlock = 92, StickyPiston,
DiodeBlockOff = 93, Cobweb,
DiodeBlockOn = 94, Grass,
StainedGlass = 95, Fern,
TrapDoor = 96, DeadBush,
MonsterEggs = 97, Seagrass,
SmoothBrick = 98, TallSeagrass,
HugeMushroom1 = 99, Piston,
HugeMushroom2 = 100, PistonHead,
IronFence = 101, WhiteWool,
ThinGlass = 102, OrangeWool,
MelonBlock = 103, MagentaWool,
PumpkinStem = 104, LightBlueWool,
MelonStem = 105, YellowWool,
Vine = 106, LimeWool,
FenceGate = 107, PinkWool,
BrickStairs = 108, GrayWool,
SmoothStairs = 109, LightGrayWool,
Mycel = 110, CyanWool,
WaterLily = 111, PurpleWool,
NetherBrick = 112, BlueWool,
NetherFence = 113, BrownWool,
NetherBrickStairs = 114, GreenWool,
NetherWarts = 115, RedWool,
EnchantmentTable = 116, BlackWool,
BrewingStand = 117, MovingPiston,
Cauldron = 118, Dandelion,
EnderPortal = 119, Poppy,
EnderPortalFrame = 120, BlueOrchid,
EnderStone = 121, Allium,
DragonEgg = 122, AzureBluet,
RedstoneLampOff = 123, RedTulip,
RedstoneLampOn = 124, OrangeTulip,
WoodDoubleStep = 125, WhiteTulip,
WoodStep = 126, PinkTulip,
Cocoa = 127, OxeyeDaisy,
SandstoneStairs = 128, BrownMushroom,
EmeraldOre = 129, RedMushroom,
EnderChest = 130, GoldBlock,
TripwireHook = 131, IronBlock,
Tripwire = 132, Bricks,
EmeraldBlock = 133, Tnt,
SpruceWoodStairs = 134, Bookshelf,
BirchWoodStairs = 135, MossyCobblestone,
JungleWoodStairs = 136, Obsidian,
Command = 137, Torch,
Beacon = 138, WallTorch,
CobbleWall = 139, Fire,
FlowerPot = 140, Spawner,
Carrot = 141, OakStairs,
Potato = 142, Chest,
WoodButton = 143, RedstoneWire,
Skull = 144, DiamondOre,
Anvil = 145, DiamondBlock,
TrappedChest = 146, CraftingTable,
GoldPlate = 147, Wheat,
IronPlate = 148, Farmland,
RedstoneComparatorOff = 149, Furnace,
RedstoneComparatorOn = 150, Sign,
DaylightDetector = 151, OakDoor,
RedstoneBlock = 152, Ladder,
QuartzOre = 153, Rail,
Hopper = 154, CobblestoneStairs,
QuartzBlock = 155, WallSign,
QuartzStairs = 156, Lever,
ActivatorRail = 157, StonePressurePlate,
Dropper = 158, IronDoor,
StainedClay = 159, OakPressurePlate,
StainedGlassPane = 160, SprucePressurePlate,
Leaves2 = 161, BirchPressurePlate,
Log2 = 162, JunglePressurePlate,
AcaciaStairs = 163, AcaciaPressurePlate,
DarkOakStairs = 164, DarkOakPressurePlate,
HayBlock = 170, RedstoneOre,
Carpet = 171, RedstoneTorch,
HardClay = 172, RedstoneWallTorch,
CoalBlock = 173, StoneButton,
PackedIce = 174, Snow,
DoublePlant = 175 Ice,
} SnowBlock,
Cactus,
/// <summary> Clay,
/// Defines extension methods for the Material enumeration SugarCane,
/// </summary> Jukebox,
public static class MaterialExtensions OakFence,
{ Pumpkin,
/// <summary> Netherrack,
/// Check if the player cannot pass through the specified material SoulSand,
/// </summary> Glowstone,
/// <param name="m">Material to test</param> NetherPortal,
/// <returns>True if the material is harmful</returns> CarvedPumpkin,
public static bool IsSolid(this Material m) JackOLantern,
{ Cake,
switch (m) Repeater,
{ WhiteStainedGlass,
case Material.Stone: OrangeStainedGlass,
case Material.Grass: MagentaStainedGlass,
case Material.Dirt: LightBlueStainedGlass,
case Material.Cobblestone: YellowStainedGlass,
case Material.Wood: LimeStainedGlass,
case Material.Bedrock: PinkStainedGlass,
case Material.Sand: GrayStainedGlass,
case Material.Gravel: LightGrayStainedGlass,
case Material.GoldOre: CyanStainedGlass,
case Material.IronOre: PurpleStainedGlass,
case Material.CoalOre: BlueStainedGlass,
case Material.Log: BrownStainedGlass,
case Material.Leaves: GreenStainedGlass,
case Material.Sponge: RedStainedGlass,
case Material.Glass: BlackStainedGlass,
case Material.LapisOre: OakTrapdoor,
case Material.LapisBlock: SpruceTrapdoor,
case Material.Dispenser: BirchTrapdoor,
case Material.Sandstone: JungleTrapdoor,
case Material.NoteBlock: AcaciaTrapdoor,
case Material.BedBlock: DarkOakTrapdoor,
case Material.PistonStickyBase: InfestedStone,
case Material.PistonBase: InfestedCobblestone,
case Material.PistonExtension: InfestedStoneBricks,
case Material.Wool: InfestedMossyStoneBricks,
case Material.PistonMovingPiece: InfestedCrackedStoneBricks,
case Material.GoldBlock: InfestedChiseledStoneBricks,
case Material.IronBlock: StoneBricks,
case Material.DoubleStep: MossyStoneBricks,
case Material.Step: CrackedStoneBricks,
case Material.Brick: ChiseledStoneBricks,
case Material.Tnt: BrownMushroomBlock,
case Material.Bookshelf: RedMushroomBlock,
case Material.MossyCobblestone: MushroomStem,
case Material.Obsidian: IronBars,
case Material.MobSpawner: GlassPane,
case Material.WoodStairs: Melon,
case Material.Chest: AttachedPumpkinStem,
case Material.DiamondOre: AttachedMelonStem,
case Material.DiamondBlock: PumpkinStem,
case Material.Workbench: MelonStem,
case Material.Soil: Vine,
case Material.Furnace: OakFenceGate,
case Material.BurningFurnace: BrickStairs,
case Material.SignPost: StoneBrickStairs,
case Material.WoodenDoor: Mycelium,
case Material.CobblestoneStairs: LilyPad,
case Material.WallSign: NetherBricks,
case Material.StonePlate: NetherBrickFence,
case Material.IronDoorBlock: NetherBrickStairs,
case Material.WoodPlate: NetherWart,
case Material.RedstoneOre: EnchantingTable,
case Material.GlowingRedstoneOre: BrewingStand,
case Material.Ice: Cauldron,
case Material.SnowBlock: EndPortal,
case Material.Cactus: EndPortalFrame,
case Material.Clay: EndStone,
case Material.Jukebox: DragonEgg,
case Material.Fence: RedstoneLamp,
case Material.Pumpkin: Cocoa,
case Material.Netherrack: SandstoneStairs,
case Material.SoulSand: EmeraldOre,
case Material.Glowstone: EnderChest,
case Material.JackOLantern: TripwireHook,
case Material.CakeBlock: Tripwire,
case Material.StainedGlass: EmeraldBlock,
case Material.TrapDoor: SpruceStairs,
case Material.MonsterEggs: BirchStairs,
case Material.SmoothBrick: JungleStairs,
case Material.HugeMushroom1: CommandBlock,
case Material.HugeMushroom2: Beacon,
case Material.IronFence: CobblestoneWall,
case Material.ThinGlass: MossyCobblestoneWall,
case Material.MelonBlock: FlowerPot,
case Material.FenceGate: PottedOakSapling,
case Material.BrickStairs: PottedSpruceSapling,
case Material.SmoothStairs: PottedBirchSapling,
case Material.Mycel: PottedJungleSapling,
case Material.NetherBrick: PottedAcaciaSapling,
case Material.NetherFence: PottedDarkOakSapling,
case Material.NetherBrickStairs: PottedFern,
case Material.EnchantmentTable: PottedDandelion,
case Material.BrewingStand: PottedPoppy,
case Material.Cauldron: PottedBlueOrchid,
case Material.EnderPortalFrame: PottedAllium,
case Material.EnderStone: PottedAzureBluet,
case Material.DragonEgg: PottedRedTulip,
case Material.RedstoneLampOff: PottedOrangeTulip,
case Material.RedstoneLampOn: PottedWhiteTulip,
case Material.WoodDoubleStep: PottedPinkTulip,
case Material.WoodStep: PottedOxeyeDaisy,
case Material.SandstoneStairs: PottedRedMushroom,
case Material.EmeraldOre: PottedBrownMushroom,
case Material.EnderChest: PottedDeadBush,
case Material.EmeraldBlock: PottedCactus,
case Material.SpruceWoodStairs: Carrots,
case Material.BirchWoodStairs: Potatoes,
case Material.JungleWoodStairs: OakButton,
case Material.Command: SpruceButton,
case Material.Beacon: BirchButton,
case Material.CobbleWall: JungleButton,
case Material.Anvil: AcaciaButton,
case Material.TrappedChest: DarkOakButton,
case Material.GoldPlate: SkeletonWallSkull,
case Material.IronPlate: SkeletonSkull,
case Material.DaylightDetector: WitherSkeletonWallSkull,
case Material.RedstoneBlock: WitherSkeletonSkull,
case Material.QuartzOre: ZombieWallHead,
case Material.Hopper: ZombieHead,
case Material.QuartzBlock: PlayerWallHead,
case Material.QuartzStairs: PlayerHead,
case Material.Dropper: CreeperWallHead,
case Material.StainedClay: CreeperHead,
case Material.HayBlock: DragonWallHead,
case Material.HardClay: DragonHead,
case Material.CoalBlock: Anvil,
case Material.StainedGlassPane: ChippedAnvil,
case Material.Leaves2: DamagedAnvil,
case Material.Log2: TrappedChest,
case Material.AcaciaStairs: LightWeightedPressurePlate,
case Material.DarkOakStairs: HeavyWeightedPressurePlate,
case Material.PackedIce: Comparator,
return true; DaylightDetector,
default: RedstoneBlock,
return false; NetherQuartzOre,
} Hopper,
} QuartzBlock,
ChiseledQuartzBlock,
/// <summary> QuartzPillar,
/// Check if contact with the provided material can harm players QuartzStairs,
/// </summary> ActivatorRail,
/// <param name="m">Material to test</param> Dropper,
/// <returns>True if the material is harmful</returns> WhiteTerracotta,
public static bool CanHarmPlayers(this Material m) OrangeTerracotta,
{ MagentaTerracotta,
switch (m) LightBlueTerracotta,
{ YellowTerracotta,
case Material.Fire: LimeTerracotta,
case Material.Cactus: PinkTerracotta,
case Material.Lava: GrayTerracotta,
case Material.StationaryLava: LightGrayTerracotta,
return true; CyanTerracotta,
default: PurpleTerracotta,
return false; BlueTerracotta,
} BrownTerracotta,
} GreenTerracotta,
RedTerracotta,
/// <summary> BlackTerracotta,
/// Check if the provided material is a liquid a player can swim into WhiteStainedGlassPane,
/// </summary> OrangeStainedGlassPane,
/// <param name="m">Material to test</param> MagentaStainedGlassPane,
/// <returns>True if the material is a liquid</returns> LightBlueStainedGlassPane,
public static bool IsLiquid(this Material m) YellowStainedGlassPane,
{ LimeStainedGlassPane,
switch (m) PinkStainedGlassPane,
{ GrayStainedGlassPane,
case Material.Water: LightGrayStainedGlassPane,
case Material.StationaryWater: CyanStainedGlassPane,
case Material.Lava: PurpleStainedGlassPane,
case Material.StationaryLava: BlueStainedGlassPane,
return true; BrownStainedGlassPane,
default: GreenStainedGlassPane,
return false; RedStainedGlassPane,
} BlackStainedGlassPane,
} AcaciaStairs,
DarkOakStairs,
SlimeBlock,
Barrier,
IronTrapdoor,
Prismarine,
PrismarineBricks,
DarkPrismarine,
PrismarineStairs,
PrismarineBrickStairs,
DarkPrismarineStairs,
PrismarineSlab,
PrismarineBrickSlab,
DarkPrismarineSlab,
SeaLantern,
HayBlock,
WhiteCarpet,
OrangeCarpet,
MagentaCarpet,
LightBlueCarpet,
YellowCarpet,
LimeCarpet,
PinkCarpet,
GrayCarpet,
LightGrayCarpet,
CyanCarpet,
PurpleCarpet,
BlueCarpet,
BrownCarpet,
GreenCarpet,
RedCarpet,
BlackCarpet,
Terracotta,
CoalBlock,
PackedIce,
Sunflower,
Lilac,
RoseBush,
Peony,
TallGrass,
LargeFern,
WhiteBanner,
OrangeBanner,
MagentaBanner,
LightBlueBanner,
YellowBanner,
LimeBanner,
PinkBanner,
GrayBanner,
LightGrayBanner,
CyanBanner,
PurpleBanner,
BlueBanner,
BrownBanner,
GreenBanner,
RedBanner,
BlackBanner,
WhiteWallBanner,
OrangeWallBanner,
MagentaWallBanner,
LightBlueWallBanner,
YellowWallBanner,
LimeWallBanner,
PinkWallBanner,
GrayWallBanner,
LightGrayWallBanner,
CyanWallBanner,
PurpleWallBanner,
BlueWallBanner,
BrownWallBanner,
GreenWallBanner,
RedWallBanner,
BlackWallBanner,
RedSandstone,
ChiseledRedSandstone,
CutRedSandstone,
RedSandstoneStairs,
OakSlab,
SpruceSlab,
BirchSlab,
JungleSlab,
AcaciaSlab,
DarkOakSlab,
StoneSlab,
SandstoneSlab,
PetrifiedOakSlab,
CobblestoneSlab,
BrickSlab,
StoneBrickSlab,
NetherBrickSlab,
QuartzSlab,
RedSandstoneSlab,
PurpurSlab,
SmoothStone,
SmoothSandstone,
SmoothQuartz,
SmoothRedSandstone,
SpruceFenceGate,
BirchFenceGate,
JungleFenceGate,
AcaciaFenceGate,
DarkOakFenceGate,
SpruceFence,
BirchFence,
JungleFence,
AcaciaFence,
DarkOakFence,
SpruceDoor,
BirchDoor,
JungleDoor,
AcaciaDoor,
DarkOakDoor,
EndRod,
ChorusPlant,
ChorusFlower,
PurpurBlock,
PurpurPillar,
PurpurStairs,
EndStoneBricks,
Beetroots,
GrassPath,
EndGateway,
RepeatingCommandBlock,
ChainCommandBlock,
FrostedIce,
MagmaBlock,
NetherWartBlock,
RedNetherBricks,
BoneBlock,
StructureVoid,
Observer,
ShulkerBox,
WhiteShulkerBox,
OrangeShulkerBox,
MagentaShulkerBox,
LightBlueShulkerBox,
YellowShulkerBox,
LimeShulkerBox,
PinkShulkerBox,
GrayShulkerBox,
LightGrayShulkerBox,
CyanShulkerBox,
PurpleShulkerBox,
BlueShulkerBox,
BrownShulkerBox,
GreenShulkerBox,
RedShulkerBox,
BlackShulkerBox,
WhiteGlazedTerracotta,
OrangeGlazedTerracotta,
MagentaGlazedTerracotta,
LightBlueGlazedTerracotta,
YellowGlazedTerracotta,
LimeGlazedTerracotta,
PinkGlazedTerracotta,
GrayGlazedTerracotta,
LightGrayGlazedTerracotta,
CyanGlazedTerracotta,
PurpleGlazedTerracotta,
BlueGlazedTerracotta,
BrownGlazedTerracotta,
GreenGlazedTerracotta,
RedGlazedTerracotta,
BlackGlazedTerracotta,
WhiteConcrete,
OrangeConcrete,
MagentaConcrete,
LightBlueConcrete,
YellowConcrete,
LimeConcrete,
PinkConcrete,
GrayConcrete,
LightGrayConcrete,
CyanConcrete,
PurpleConcrete,
BlueConcrete,
BrownConcrete,
GreenConcrete,
RedConcrete,
BlackConcrete,
WhiteConcretePowder,
OrangeConcretePowder,
MagentaConcretePowder,
LightBlueConcretePowder,
YellowConcretePowder,
LimeConcretePowder,
PinkConcretePowder,
GrayConcretePowder,
LightGrayConcretePowder,
CyanConcretePowder,
PurpleConcretePowder,
BlueConcretePowder,
BrownConcretePowder,
GreenConcretePowder,
RedConcretePowder,
BlackConcretePowder,
Kelp,
KelpPlant,
DriedKelpBlock,
TurtleEgg,
DeadTubeCoralBlock,
DeadBrainCoralBlock,
DeadBubbleCoralBlock,
DeadFireCoralBlock,
DeadHornCoralBlock,
TubeCoralBlock,
BrainCoralBlock,
BubbleCoralBlock,
FireCoralBlock,
HornCoralBlock,
DeadTubeCoral,
DeadBrainCoral,
DeadBubbleCoral,
DeadFireCoral,
DeadHornCoral,
TubeCoral,
BrainCoral,
BubbleCoral,
FireCoral,
HornCoral,
DeadTubeCoralWallFan,
DeadBrainCoralWallFan,
DeadBubbleCoralWallFan,
DeadFireCoralWallFan,
DeadHornCoralWallFan,
TubeCoralWallFan,
BrainCoralWallFan,
BubbleCoralWallFan,
FireCoralWallFan,
HornCoralWallFan,
DeadTubeCoralFan,
DeadBrainCoralFan,
DeadBubbleCoralFan,
DeadFireCoralFan,
DeadHornCoralFan,
TubeCoralFan,
BrainCoralFan,
BubbleCoralFan,
FireCoralFan,
HornCoralFan,
SeaPickle,
BlueIce,
Conduit,
VoidAir,
CaveAir,
BubbleColumn,
StructureBlock,
} }
} }

View file

@ -0,0 +1,498 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MinecraftClient.Mapping
{
/// <summary>
/// Defines extension methods for the Material enumeration
/// </summary>
public static class MaterialExtensions
{
/// <summary>
/// Check if the player cannot pass through the specified material
/// </summary>
/// <param name="m">Material to test</param>
/// <returns>True if the material is harmful</returns>
public static bool IsSolid(this Material m)
{
switch (m)
{
case Material.Stone:
case Material.Granite:
case Material.PolishedGranite:
case Material.Diorite:
case Material.PolishedDiorite:
case Material.Andesite:
case Material.PolishedAndesite:
case Material.GrassBlock:
case Material.Dirt:
case Material.CoarseDirt:
case Material.Podzol:
case Material.Cobblestone:
case Material.OakPlanks:
case Material.SprucePlanks:
case Material.BirchPlanks:
case Material.JunglePlanks:
case Material.AcaciaPlanks:
case Material.DarkOakPlanks:
case Material.Bedrock:
case Material.Sand:
case Material.RedSand:
case Material.Gravel:
case Material.GoldOre:
case Material.IronOre:
case Material.CoalOre:
case Material.OakLog:
case Material.SpruceLog:
case Material.BirchLog:
case Material.JungleLog:
case Material.AcaciaLog:
case Material.DarkOakLog:
case Material.StrippedSpruceLog:
case Material.StrippedBirchLog:
case Material.StrippedJungleLog:
case Material.StrippedAcaciaLog:
case Material.StrippedDarkOakLog:
case Material.StrippedOakLog:
case Material.OakWood:
case Material.SpruceWood:
case Material.BirchWood:
case Material.JungleWood:
case Material.AcaciaWood:
case Material.DarkOakWood:
case Material.StrippedOakWood:
case Material.StrippedSpruceWood:
case Material.StrippedBirchWood:
case Material.StrippedJungleWood:
case Material.StrippedAcaciaWood:
case Material.StrippedDarkOakWood:
case Material.OakLeaves:
case Material.SpruceLeaves:
case Material.BirchLeaves:
case Material.JungleLeaves:
case Material.AcaciaLeaves:
case Material.DarkOakLeaves:
case Material.Sponge:
case Material.WetSponge:
case Material.Glass:
case Material.LapisOre:
case Material.LapisBlock:
case Material.Dispenser:
case Material.Sandstone:
case Material.ChiseledSandstone:
case Material.CutSandstone:
case Material.NoteBlock:
case Material.WhiteBed:
case Material.OrangeBed:
case Material.MagentaBed:
case Material.LightBlueBed:
case Material.YellowBed:
case Material.LimeBed:
case Material.PinkBed:
case Material.GrayBed:
case Material.LightGrayBed:
case Material.CyanBed:
case Material.PurpleBed:
case Material.BlueBed:
case Material.BrownBed:
case Material.GreenBed:
case Material.RedBed:
case Material.BlackBed:
case Material.StickyPiston:
case Material.Piston:
case Material.PistonHead:
case Material.WhiteWool:
case Material.OrangeWool:
case Material.MagentaWool:
case Material.LightBlueWool:
case Material.YellowWool:
case Material.LimeWool:
case Material.PinkWool:
case Material.GrayWool:
case Material.LightGrayWool:
case Material.CyanWool:
case Material.PurpleWool:
case Material.BlueWool:
case Material.BrownWool:
case Material.GreenWool:
case Material.RedWool:
case Material.BlackWool:
case Material.MovingPiston:
case Material.GoldBlock:
case Material.IronBlock:
case Material.Bricks:
case Material.Tnt:
case Material.Bookshelf:
case Material.MossyCobblestone:
case Material.Obsidian:
case Material.Spawner:
case Material.OakStairs:
case Material.Chest:
case Material.DiamondOre:
case Material.DiamondBlock:
case Material.CraftingTable:
case Material.Farmland:
case Material.Furnace:
case Material.Sign:
case Material.OakDoor:
case Material.Ladder:
case Material.CobblestoneStairs:
case Material.IronDoor:
case Material.RedstoneOre:
case Material.Ice:
case Material.SnowBlock:
case Material.Cactus:
case Material.Clay:
case Material.Jukebox:
case Material.OakFence:
case Material.Pumpkin:
case Material.Netherrack:
case Material.SoulSand:
case Material.Glowstone:
case Material.CarvedPumpkin:
case Material.JackOLantern:
case Material.Cake:
case Material.WhiteStainedGlass:
case Material.OrangeStainedGlass:
case Material.MagentaStainedGlass:
case Material.LightBlueStainedGlass:
case Material.YellowStainedGlass:
case Material.LimeStainedGlass:
case Material.PinkStainedGlass:
case Material.GrayStainedGlass:
case Material.LightGrayStainedGlass:
case Material.CyanStainedGlass:
case Material.PurpleStainedGlass:
case Material.BlueStainedGlass:
case Material.BrownStainedGlass:
case Material.GreenStainedGlass:
case Material.RedStainedGlass:
case Material.BlackStainedGlass:
case Material.OakTrapdoor:
case Material.SpruceTrapdoor:
case Material.BirchTrapdoor:
case Material.JungleTrapdoor:
case Material.AcaciaTrapdoor:
case Material.DarkOakTrapdoor:
case Material.InfestedStone:
case Material.InfestedCobblestone:
case Material.InfestedStoneBricks:
case Material.InfestedMossyStoneBricks:
case Material.InfestedCrackedStoneBricks:
case Material.InfestedChiseledStoneBricks:
case Material.StoneBricks:
case Material.MossyStoneBricks:
case Material.CrackedStoneBricks:
case Material.ChiseledStoneBricks:
case Material.BrownMushroomBlock:
case Material.RedMushroomBlock:
case Material.MushroomStem:
case Material.IronBars:
case Material.GlassPane:
case Material.Melon:
case Material.OakFenceGate:
case Material.BrickStairs:
case Material.StoneBrickStairs:
case Material.Mycelium:
case Material.LilyPad:
case Material.NetherBricks:
case Material.NetherBrickFence:
case Material.NetherBrickStairs:
case Material.EnchantingTable:
case Material.BrewingStand:
case Material.Cauldron:
case Material.EndPortalFrame:
case Material.EndStone:
case Material.DragonEgg:
case Material.RedstoneLamp:
case Material.SandstoneStairs:
case Material.EmeraldOre:
case Material.EnderChest:
case Material.EmeraldBlock:
case Material.SpruceStairs:
case Material.BirchStairs:
case Material.JungleStairs:
case Material.CommandBlock:
case Material.Beacon:
case Material.CobblestoneWall:
case Material.MossyCobblestoneWall:
case Material.FlowerPot:
case Material.PottedOakSapling:
case Material.PottedSpruceSapling:
case Material.PottedBirchSapling:
case Material.PottedJungleSapling:
case Material.PottedAcaciaSapling:
case Material.PottedDarkOakSapling:
case Material.PottedFern:
case Material.PottedDandelion:
case Material.PottedPoppy:
case Material.PottedBlueOrchid:
case Material.PottedAllium:
case Material.PottedAzureBluet:
case Material.PottedRedTulip:
case Material.PottedOrangeTulip:
case Material.PottedWhiteTulip:
case Material.PottedPinkTulip:
case Material.PottedOxeyeDaisy:
case Material.PottedRedMushroom:
case Material.PottedBrownMushroom:
case Material.PottedDeadBush:
case Material.PottedCactus:
case Material.SkeletonWallSkull:
case Material.SkeletonSkull:
case Material.WitherSkeletonWallSkull:
case Material.WitherSkeletonSkull:
case Material.ZombieWallHead:
case Material.ZombieHead:
case Material.PlayerWallHead:
case Material.PlayerHead:
case Material.CreeperWallHead:
case Material.CreeperHead:
case Material.DragonWallHead:
case Material.DragonHead:
case Material.Anvil:
case Material.ChippedAnvil:
case Material.DamagedAnvil:
case Material.TrappedChest:
case Material.DaylightDetector:
case Material.RedstoneBlock:
case Material.NetherQuartzOre:
case Material.Hopper:
case Material.QuartzBlock:
case Material.ChiseledQuartzBlock:
case Material.QuartzPillar:
case Material.QuartzStairs:
case Material.Dropper:
case Material.WhiteTerracotta:
case Material.OrangeTerracotta:
case Material.MagentaTerracotta:
case Material.LightBlueTerracotta:
case Material.YellowTerracotta:
case Material.LimeTerracotta:
case Material.PinkTerracotta:
case Material.GrayTerracotta:
case Material.LightGrayTerracotta:
case Material.CyanTerracotta:
case Material.PurpleTerracotta:
case Material.BlueTerracotta:
case Material.BrownTerracotta:
case Material.GreenTerracotta:
case Material.RedTerracotta:
case Material.BlackTerracotta:
case Material.WhiteStainedGlassPane:
case Material.OrangeStainedGlassPane:
case Material.MagentaStainedGlassPane:
case Material.LightBlueStainedGlassPane:
case Material.YellowStainedGlassPane:
case Material.LimeStainedGlassPane:
case Material.PinkStainedGlassPane:
case Material.GrayStainedGlassPane:
case Material.LightGrayStainedGlassPane:
case Material.CyanStainedGlassPane:
case Material.PurpleStainedGlassPane:
case Material.BlueStainedGlassPane:
case Material.BrownStainedGlassPane:
case Material.GreenStainedGlassPane:
case Material.RedStainedGlassPane:
case Material.BlackStainedGlassPane:
case Material.AcaciaStairs:
case Material.DarkOakStairs:
case Material.SlimeBlock:
case Material.Barrier:
case Material.IronTrapdoor:
case Material.Prismarine:
case Material.PrismarineBricks:
case Material.DarkPrismarine:
case Material.PrismarineStairs:
case Material.PrismarineBrickStairs:
case Material.DarkPrismarineStairs:
case Material.PrismarineSlab:
case Material.PrismarineBrickSlab:
case Material.DarkPrismarineSlab:
case Material.SeaLantern:
case Material.HayBlock:
case Material.Terracotta:
case Material.CoalBlock:
case Material.PackedIce:
case Material.RedSandstone:
case Material.ChiseledRedSandstone:
case Material.CutRedSandstone:
case Material.RedSandstoneStairs:
case Material.OakSlab:
case Material.SpruceSlab:
case Material.BirchSlab:
case Material.JungleSlab:
case Material.AcaciaSlab:
case Material.DarkOakSlab:
case Material.StoneSlab:
case Material.SandstoneSlab:
case Material.PetrifiedOakSlab:
case Material.CobblestoneSlab:
case Material.BrickSlab:
case Material.StoneBrickSlab:
case Material.NetherBrickSlab:
case Material.QuartzSlab:
case Material.RedSandstoneSlab:
case Material.PurpurSlab:
case Material.SmoothStone:
case Material.SmoothSandstone:
case Material.SmoothQuartz:
case Material.SmoothRedSandstone:
case Material.SpruceFenceGate:
case Material.BirchFenceGate:
case Material.JungleFenceGate:
case Material.AcaciaFenceGate:
case Material.DarkOakFenceGate:
case Material.SpruceFence:
case Material.BirchFence:
case Material.JungleFence:
case Material.AcaciaFence:
case Material.DarkOakFence:
case Material.SpruceDoor:
case Material.BirchDoor:
case Material.JungleDoor:
case Material.AcaciaDoor:
case Material.DarkOakDoor:
case Material.EndRod:
case Material.ChorusPlant:
case Material.ChorusFlower:
case Material.PurpurBlock:
case Material.PurpurPillar:
case Material.PurpurStairs:
case Material.EndStoneBricks:
case Material.GrassPath:
case Material.RepeatingCommandBlock:
case Material.ChainCommandBlock:
case Material.FrostedIce:
case Material.MagmaBlock:
case Material.NetherWartBlock:
case Material.RedNetherBricks:
case Material.BoneBlock:
case Material.Observer:
case Material.ShulkerBox:
case Material.WhiteShulkerBox:
case Material.OrangeShulkerBox:
case Material.MagentaShulkerBox:
case Material.LightBlueShulkerBox:
case Material.YellowShulkerBox:
case Material.LimeShulkerBox:
case Material.PinkShulkerBox:
case Material.GrayShulkerBox:
case Material.LightGrayShulkerBox:
case Material.CyanShulkerBox:
case Material.PurpleShulkerBox:
case Material.BlueShulkerBox:
case Material.BrownShulkerBox:
case Material.GreenShulkerBox:
case Material.RedShulkerBox:
case Material.BlackShulkerBox:
case Material.WhiteGlazedTerracotta:
case Material.OrangeGlazedTerracotta:
case Material.MagentaGlazedTerracotta:
case Material.LightBlueGlazedTerracotta:
case Material.YellowGlazedTerracotta:
case Material.LimeGlazedTerracotta:
case Material.PinkGlazedTerracotta:
case Material.GrayGlazedTerracotta:
case Material.LightGrayGlazedTerracotta:
case Material.CyanGlazedTerracotta:
case Material.PurpleGlazedTerracotta:
case Material.BlueGlazedTerracotta:
case Material.BrownGlazedTerracotta:
case Material.GreenGlazedTerracotta:
case Material.RedGlazedTerracotta:
case Material.BlackGlazedTerracotta:
case Material.WhiteConcrete:
case Material.OrangeConcrete:
case Material.MagentaConcrete:
case Material.LightBlueConcrete:
case Material.YellowConcrete:
case Material.LimeConcrete:
case Material.PinkConcrete:
case Material.GrayConcrete:
case Material.LightGrayConcrete:
case Material.CyanConcrete:
case Material.PurpleConcrete:
case Material.BlueConcrete:
case Material.BrownConcrete:
case Material.GreenConcrete:
case Material.RedConcrete:
case Material.BlackConcrete:
case Material.WhiteConcretePowder:
case Material.OrangeConcretePowder:
case Material.MagentaConcretePowder:
case Material.LightBlueConcretePowder:
case Material.YellowConcretePowder:
case Material.LimeConcretePowder:
case Material.PinkConcretePowder:
case Material.GrayConcretePowder:
case Material.LightGrayConcretePowder:
case Material.CyanConcretePowder:
case Material.PurpleConcretePowder:
case Material.BlueConcretePowder:
case Material.BrownConcretePowder:
case Material.GreenConcretePowder:
case Material.RedConcretePowder:
case Material.BlackConcretePowder:
case Material.DriedKelpBlock:
case Material.TurtleEgg:
case Material.DeadTubeCoralBlock:
case Material.DeadBrainCoralBlock:
case Material.DeadBubbleCoralBlock:
case Material.DeadFireCoralBlock:
case Material.DeadHornCoralBlock:
case Material.TubeCoralBlock:
case Material.BrainCoralBlock:
case Material.BubbleCoralBlock:
case Material.FireCoralBlock:
case Material.HornCoralBlock:
case Material.SeaPickle:
case Material.BlueIce:
case Material.Conduit:
case Material.BubbleColumn:
case Material.StructureBlock:
return true;
default:
return false;
}
}
/// <summary>
/// Check if contact with the provided material can harm players
/// </summary>
/// <param name="m">Material to test</param>
/// <returns>True if the material is harmful</returns>
public static bool CanHarmPlayers(this Material m)
{
switch (m)
{
case Material.Fire:
case Material.Cactus:
case Material.Lava:
case Material.MagmaBlock:
return true;
default:
return false;
}
}
/// <summary>
/// Check if the provided material is a liquid a player can swim into
/// </summary>
/// <param name="m">Material to test</param>
/// <returns>True if the material is a liquid</returns>
public static bool IsLiquid(this Material m)
{
switch (m)
{
case Material.Water:
case Material.Lava:
return true;
default:
return false;
}
}
}
}

View file

@ -80,7 +80,7 @@ namespace MinecraftClient.Mapping
if (chunk != null) if (chunk != null)
return chunk.GetBlock(location); return chunk.GetBlock(location);
} }
return new Block(Material.Air); return new Block(0); //Air
} }
/// <summary> /// <summary>

View file

@ -97,6 +97,11 @@
<Compile Include="Commands\Script.cs" /> <Compile Include="Commands\Script.cs" />
<Compile Include="Commands\Send.cs" /> <Compile Include="Commands\Send.cs" />
<Compile Include="Commands\Set.cs" /> <Compile Include="Commands\Set.cs" />
<Compile Include="Mapping\BlockPalettes\Palette112.cs" />
<Compile Include="Mapping\BlockPalettes\Palette113.cs" />
<Compile Include="Mapping\BlockPalettes\PaletteGenerator.cs" />
<Compile Include="Mapping\BlockPalettes\PaletteMapping.cs" />
<Compile Include="Mapping\MaterialExtensions.cs" />
<Compile Include="Protocol\Session\SessionFileMonitor.cs" /> <Compile Include="Protocol\Session\SessionFileMonitor.cs" />
<Compile Include="WinAPI\ConsoleIcon.cs" /> <Compile Include="WinAPI\ConsoleIcon.cs" />
<Compile Include="ConsoleIO.cs" /> <Compile Include="ConsoleIO.cs" />

View file

@ -12,7 +12,7 @@ using MinecraftClient.WinAPI;
namespace MinecraftClient namespace MinecraftClient
{ {
/// <summary> /// <summary>
/// Minecraft Console Client by ORelio and Contributors (c) 2012-2018. /// Minecraft Console Client by ORelio and Contributors (c) 2012-2019.
/// Allows to connect to any Minecraft server, send and receive text, automated scripts. /// Allows to connect to any Minecraft server, send and receive text, automated scripts.
/// This source code is released under the CDDL 1.0 License. /// This source code is released under the CDDL 1.0 License.
/// </summary> /// </summary>

View file

@ -9,6 +9,7 @@ using MinecraftClient.Proxy;
using System.Security.Cryptography; using System.Security.Cryptography;
using MinecraftClient.Protocol.Handlers.Forge; using MinecraftClient.Protocol.Handlers.Forge;
using MinecraftClient.Mapping; using MinecraftClient.Mapping;
using MinecraftClient.Mapping.BlockPalettes;
namespace MinecraftClient.Protocol.Handlers namespace MinecraftClient.Protocol.Handlers
{ {
@ -22,16 +23,9 @@ namespace MinecraftClient.Protocol.Handlers
private const int MC191Version = 108; private const int MC191Version = 108;
private const int MC110Version = 210; private const int MC110Version = 210;
private const int MC111Version = 315; private const int MC111Version = 315;
private const int MC17w13aVersion = 318; private const int MC112Version = 335;
private const int MC112pre5Version = 332; private const int MC1121Version = 338;
private const int MC17w31aVersion = 336; private const int MC1122Version = 340;
private const int MC17w45aVersion = 343;
private const int MC17w46aVersion = 345;
private const int MC17w47aVersion = 346;
private const int MC18w01aVersion = 352;
private const int MC18w06aVersion = 357;
private const int MC113pre4Version = 386;
private const int MC113pre7Version = 389;
private const int MC113Version = 393; private const int MC113Version = 393;
private int compression_treshold = 0; private int compression_treshold = 0;
@ -61,6 +55,9 @@ namespace MinecraftClient.Protocol.Handlers
this.protocolversion = ProtocolVersion; this.protocolversion = ProtocolVersion;
this.handler = Handler; this.handler = Handler;
this.forgeInfo = ForgeInfo; this.forgeInfo = ForgeInfo;
if (protocolversion >= MC113Version)
Block.Palette = new Palette113();
else Block.Palette = new Palette112();
} }
private Protocol18Handler(TcpClient Client) private Protocol18Handler(TcpClient Client)
@ -171,7 +168,7 @@ namespace MinecraftClient.Protocol.Handlers
/// <returns>Abstract numbering</returns> /// <returns>Abstract numbering</returns>
private PacketIncomingType getPacketIncomingType(int packetID, int protocol) private PacketIncomingType getPacketIncomingType(int packetID, int protocol)
{ {
if (protocol < MC19Version) if (protocol <= MC18Version) // MC 1.7 and 1.8
{ {
switch (packetID) switch (packetID)
{ {
@ -194,7 +191,7 @@ namespace MinecraftClient.Protocol.Handlers
default: return PacketIncomingType.UnknownPacket; default: return PacketIncomingType.UnknownPacket;
} }
} }
else if (protocol < MC17w13aVersion) else if (protocol <= MC111Version) // MC 1.9, 1.10 and 1.11
{ {
switch (packetID) switch (packetID)
{ {
@ -217,30 +214,7 @@ namespace MinecraftClient.Protocol.Handlers
default: return PacketIncomingType.UnknownPacket; default: return PacketIncomingType.UnknownPacket;
} }
} }
else if (protocolversion < MC112pre5Version) else if (protocol <= MC112Version) // MC 1.12.0
{
switch (packetID)
{
case 0x20: return PacketIncomingType.KeepAlive;
case 0x24: return PacketIncomingType.JoinGame;
case 0x10: return PacketIncomingType.ChatMessage;
case 0x35: return PacketIncomingType.Respawn;
case 0x2F: return PacketIncomingType.PlayerPositionAndLook;
case 0x21: return PacketIncomingType.ChunkData;
case 0x11: return PacketIncomingType.MultiBlockChange;
case 0x0C: return PacketIncomingType.BlockChange;
//MapChunkBulk removed in 1.9
case 0x1E: return PacketIncomingType.UnloadChunk;
case 0x2E: return PacketIncomingType.PlayerListUpdate;
case 0x0F: return PacketIncomingType.TabCompleteResult;
case 0x19: return PacketIncomingType.PluginMessage;
case 0x1B: return PacketIncomingType.KickPacket;
//NetworkCompressionTreshold removed in 1.9
case 0x34: return PacketIncomingType.ResourcePackSend;
default: return PacketIncomingType.UnknownPacket;
}
}
else if (protocol < MC17w31aVersion)
{ {
switch (packetID) switch (packetID)
{ {
@ -263,7 +237,7 @@ namespace MinecraftClient.Protocol.Handlers
default: return PacketIncomingType.UnknownPacket; default: return PacketIncomingType.UnknownPacket;
} }
} }
else if (protocol < MC17w45aVersion) else if (protocol <= MC1122Version) // MC 1.12.2
{ {
switch (packetID) switch (packetID)
{ {
@ -286,76 +260,7 @@ namespace MinecraftClient.Protocol.Handlers
default: return PacketIncomingType.UnknownPacket; default: return PacketIncomingType.UnknownPacket;
} }
} }
else if (protocol < MC17w46aVersion) else // MC 1.13+
{
switch (packetID)
{
case 0x1F: return PacketIncomingType.KeepAlive;
case 0x23: return PacketIncomingType.JoinGame;
case 0x0E: return PacketIncomingType.ChatMessage;
case 0x35: return PacketIncomingType.Respawn;
case 0x2F: return PacketIncomingType.PlayerPositionAndLook;
case 0x21: return PacketIncomingType.ChunkData;
case 0x0F: return PacketIncomingType.MultiBlockChange;
case 0x0B: return PacketIncomingType.BlockChange;
//MapChunkBulk removed in 1.9
case 0x1D: return PacketIncomingType.UnloadChunk;
case 0x2E: return PacketIncomingType.PlayerListUpdate;
//TabCompleteResult accidentely removed
case 0x18: return PacketIncomingType.PluginMessage;
case 0x1A: return PacketIncomingType.KickPacket;
//NetworkCompressionTreshold removed in 1.9
case 0x34: return PacketIncomingType.ResourcePackSend;
default: return PacketIncomingType.UnknownPacket;
}
}
else if (protocol < MC18w01aVersion)
{
switch (packetID)
{
case 0x20: return PacketIncomingType.KeepAlive;
case 0x24: return PacketIncomingType.JoinGame;
case 0x0E: return PacketIncomingType.ChatMessage;
case 0x36: return PacketIncomingType.Respawn;
case 0x30: return PacketIncomingType.PlayerPositionAndLook;
case 0x21: return PacketIncomingType.ChunkData;
case 0x0F: return PacketIncomingType.MultiBlockChange;
case 0x0B: return PacketIncomingType.BlockChange;
//MapChunkBulk removed in 1.9
case 0x1E: return PacketIncomingType.UnloadChunk;
case 0x2F: return PacketIncomingType.PlayerListUpdate;
case 0x10: return PacketIncomingType.TabCompleteResult;
case 0x19: return PacketIncomingType.PluginMessage;
case 0x1B: return PacketIncomingType.KickPacket;
//NetworkCompressionTreshold removed in 1.9
case 0x35: return PacketIncomingType.ResourcePackSend;
default: return PacketIncomingType.UnknownPacket;
}
}
else if (protocol < MC113pre7Version)
{
switch (packetID)
{
case 0x20: return PacketIncomingType.KeepAlive;
case 0x24: return PacketIncomingType.JoinGame;
case 0x0E: return PacketIncomingType.ChatMessage;
case 0x37: return PacketIncomingType.Respawn;
case 0x31: return PacketIncomingType.PlayerPositionAndLook;
case 0x21: return PacketIncomingType.ChunkData;
case 0x0F: return PacketIncomingType.MultiBlockChange;
case 0x0B: return PacketIncomingType.BlockChange;
//MapChunkBulk removed in 1.9
case 0x1E: return PacketIncomingType.UnloadChunk;
case 0x2F: return PacketIncomingType.PlayerListUpdate;
case 0x10: return PacketIncomingType.TabCompleteResult;
case 0x19: return PacketIncomingType.PluginMessage;
case 0x1B: return PacketIncomingType.KickPacket;
//NetworkCompressionTreshold removed in 1.9
case 0x36: return PacketIncomingType.ResourcePackSend;
default: return PacketIncomingType.UnknownPacket;
}
}
else
{ {
switch (packetID) switch (packetID)
{ {
@ -405,7 +310,7 @@ namespace MinecraftClient.Protocol.Handlers
/// <returns>Packet ID</returns> /// <returns>Packet ID</returns>
private int getPacketOutgoingID(PacketOutgoingType packet, int protocol) private int getPacketOutgoingID(PacketOutgoingType packet, int protocol)
{ {
if (protocol < MC19Version) if (protocol <= MC18Version) // MC 1.7 and 1.8
{ {
switch (packet) switch (packet)
{ {
@ -421,7 +326,7 @@ namespace MinecraftClient.Protocol.Handlers
case PacketOutgoingType.TeleportConfirm: throw new InvalidOperationException("Teleport confirm is not supported in protocol " + protocol); case PacketOutgoingType.TeleportConfirm: throw new InvalidOperationException("Teleport confirm is not supported in protocol " + protocol);
} }
} }
else if (protocol < MC17w13aVersion) else if (protocol <= MC111Version) // MC 1.9, 1,10 and 1.11
{ {
switch (packet) switch (packet)
{ {
@ -437,23 +342,7 @@ namespace MinecraftClient.Protocol.Handlers
case PacketOutgoingType.TeleportConfirm: return 0x00; case PacketOutgoingType.TeleportConfirm: return 0x00;
} }
} }
else if (protocolversion < MC112pre5Version) else if (protocol <= MC112Version) // MC 1.12
{
switch (packet)
{
case PacketOutgoingType.KeepAlive: return 0x0C;
case PacketOutgoingType.ResourcePackStatus: return 0x18;
case PacketOutgoingType.ChatMessage: return 0x03;
case PacketOutgoingType.ClientStatus: return 0x04;
case PacketOutgoingType.ClientSettings: return 0x05;
case PacketOutgoingType.PluginMessage: return 0x0A;
case PacketOutgoingType.TabComplete: return 0x02;
case PacketOutgoingType.PlayerPosition: return 0x0D;
case PacketOutgoingType.PlayerPositionAndLook: return 0x0E;
case PacketOutgoingType.TeleportConfirm: return 0x00;
}
}
else if (protocol < MC17w31aVersion)
{ {
switch (packet) switch (packet)
{ {
@ -469,7 +358,7 @@ namespace MinecraftClient.Protocol.Handlers
case PacketOutgoingType.TeleportConfirm: return 0x00; case PacketOutgoingType.TeleportConfirm: return 0x00;
} }
} }
else if (protocol < MC17w45aVersion) else if (protocol <= MC1122Version) // 1.12.2
{ {
switch (packet) switch (packet)
{ {
@ -485,55 +374,7 @@ namespace MinecraftClient.Protocol.Handlers
case PacketOutgoingType.TeleportConfirm: return 0x00; case PacketOutgoingType.TeleportConfirm: return 0x00;
} }
} }
else if (protocol < MC17w46aVersion) else // MC 1.13+
{
switch (packet)
{
case PacketOutgoingType.KeepAlive: return 0x0A;
case PacketOutgoingType.ResourcePackStatus: return 0x17;
case PacketOutgoingType.ChatMessage: return 0x01;
case PacketOutgoingType.ClientStatus: return 0x02;
case PacketOutgoingType.ClientSettings: return 0x03;
case PacketOutgoingType.PluginMessage: return 0x08;
case PacketOutgoingType.TabComplete: throw new InvalidOperationException("TabComplete was accidentely removed in protocol " + protocol + ". Please use a more recent version.");
case PacketOutgoingType.PlayerPosition: return 0x0C;
case PacketOutgoingType.PlayerPositionAndLook: return 0x0D;
case PacketOutgoingType.TeleportConfirm: return 0x00;
}
}
else if (protocol < MC113pre4Version)
{
switch (packet)
{
case PacketOutgoingType.KeepAlive: return 0x0B;
case PacketOutgoingType.ResourcePackStatus: return 0x18;
case PacketOutgoingType.ChatMessage: return 0x01;
case PacketOutgoingType.ClientStatus: return 0x02;
case PacketOutgoingType.ClientSettings: return 0x03;
case PacketOutgoingType.PluginMessage: return 0x09;
case PacketOutgoingType.TabComplete: return 0x04;
case PacketOutgoingType.PlayerPosition: return 0x0D;
case PacketOutgoingType.PlayerPositionAndLook: return 0x0E;
case PacketOutgoingType.TeleportConfirm: return 0x00;
}
}
else if (protocol < MC113pre7Version)
{
switch (packet)
{
case PacketOutgoingType.KeepAlive: return 0x0C;
case PacketOutgoingType.ResourcePackStatus: return 0x1B;
case PacketOutgoingType.ChatMessage: return 0x01;
case PacketOutgoingType.ClientStatus: return 0x02;
case PacketOutgoingType.ClientSettings: return 0x03;
case PacketOutgoingType.PluginMessage: return 0x09;
case PacketOutgoingType.TabComplete: return 0x04;
case PacketOutgoingType.PlayerPosition: return 0x0E;
case PacketOutgoingType.PlayerPositionAndLook: return 0x0F;
case PacketOutgoingType.TeleportConfirm: return 0x00;
}
}
else
{ {
switch (packet) switch (packet)
{ {
@ -701,6 +542,7 @@ namespace MinecraftClient.Protocol.Handlers
break; break;
case PacketIncomingType.BlockChange: case PacketIncomingType.BlockChange:
if (Settings.TerrainAndMovements) if (Settings.TerrainAndMovements)
{
if (protocolversion < MC18Version) if (protocolversion < MC18Version)
{ {
int blockX = readNextInt(packetData); int blockX = readNextInt(packetData);
@ -711,6 +553,7 @@ namespace MinecraftClient.Protocol.Handlers
handler.GetWorld().SetBlock(new Location(blockX, blockY, blockZ), new Block(blockId, blockMeta)); handler.GetWorld().SetBlock(new Location(blockX, blockY, blockZ), new Block(blockId, blockMeta));
} }
else handler.GetWorld().SetBlock(Location.FromLong(readNextULong(packetData)), new Block((ushort)readNextVarInt(packetData))); else handler.GetWorld().SetBlock(Location.FromLong(readNextULong(packetData)), new Block((ushort)readNextVarInt(packetData)));
}
break; break;
case PacketIncomingType.MapChunkBulk: case PacketIncomingType.MapChunkBulk:
if (protocolversion < MC19Version && Settings.TerrainAndMovements) if (protocolversion < MC19Version && Settings.TerrainAndMovements)
@ -818,31 +661,28 @@ namespace MinecraftClient.Protocol.Handlers
} }
break; break;
case PacketIncomingType.TabCompleteResult: case PacketIncomingType.TabCompleteResult:
if (protocolversion >= MC17w46aVersion) if (protocolversion >= MC113Version)
{ {
autocomplete_transaction_id = readNextVarInt(packetData); autocomplete_transaction_id = readNextVarInt(packetData);
} readNextVarInt(packetData); // Start of text to replace
readNextVarInt(packetData); // Length of text to replace
if (protocolversion >= MC17w47aVersion)
{
// Start of the text to replace - currently unused
readNextVarInt(packetData);
}
if (protocolversion >= MC18w06aVersion)
{
// Length of the text to replace - currently unused
readNextVarInt(packetData);
} }
int autocomplete_count = readNextVarInt(packetData); int autocomplete_count = readNextVarInt(packetData);
autocomplete_result.Clear(); autocomplete_result.Clear();
for (int i = 0; i < autocomplete_count; i++)
autocomplete_result.Add(readNextString(packetData));
autocomplete_received = true;
// In protocolversion >= MC18w06aVersion there is additional data if the match is a tooltip for (int i = 0; i < autocomplete_count; i++)
// Don't worry about skipping remaining data since there is no useful for us (yet) {
autocomplete_result.Add(readNextString(packetData));
if (protocolversion >= MC113Version)
{
// Skip optional tooltip for each tab-complete result
if (readNextBool(packetData))
readNextString(packetData);
}
}
autocomplete_received = true;
break; break;
case PacketIncomingType.PluginMessage: case PacketIncomingType.PluginMessage:
String channel = readNextString(packetData); String channel = readNextString(packetData);
@ -1038,7 +878,16 @@ namespace MinecraftClient.Protocol.Handlers
byte bitsPerBlock = readNextByte(cache); byte bitsPerBlock = readNextByte(cache);
bool usePalette = (bitsPerBlock <= 8); bool usePalette = (bitsPerBlock <= 8);
int paletteLength = readNextVarInt(cache); // Vanilla Minecraft will use at least 4 bits per block
if (bitsPerBlock < 4)
bitsPerBlock = 4;
// MC 1.9 to 1.12 will set palette length field to 0 when palette
// is not used, MC 1.13+ does not send the field at all in this case
int paletteLength = 0; // Assume zero when length is absent
if (usePalette || protocolversion < MC113Version)
paletteLength = readNextVarInt(cache);
int[] palette = new int[paletteLength]; int[] palette = new int[paletteLength];
for (int i = 0; i < paletteLength; i++) for (int i = 0; i < paletteLength; i++)
{ {
@ -1068,7 +917,7 @@ namespace MinecraftClient.Protocol.Handlers
int endLong = ((blockNumber + 1) * bitsPerBlock - 1) / 64; int endLong = ((blockNumber + 1) * bitsPerBlock - 1) / 64;
// TODO: In the future a single ushort may not store the entire block id; // TODO: In the future a single ushort may not store the entire block id;
// the Block code may need to change. // the Block code may need to change if block state IDs go beyond 65535
ushort blockId; ushort blockId;
if (startLong == endLong) if (startLong == endLong)
{ {
@ -2040,7 +1889,7 @@ namespace MinecraftClient.Protocol.Handlers
if (protocolversion >= MC18Version) if (protocolversion >= MC18Version)
{ {
if (protocolversion >= MC17w46aVersion) if (protocolversion >= MC113Version)
{ {
tabcomplete_packet = concatBytes(tabcomplete_packet, transaction_id); tabcomplete_packet = concatBytes(tabcomplete_packet, transaction_id);
tabcomplete_packet = concatBytes(tabcomplete_packet, getString(BehindCursor)); tabcomplete_packet = concatBytes(tabcomplete_packet, getString(BehindCursor));

View file

@ -1,5 +1,5 @@
================================================================================== ==================================================================================
Minecraft Client v1.13.0 for Minecraft 1.4.6 to 1.13.0 - By ORelio & Contributors Minecraft Client v1.13.0 for Minecraft 1.4.6 to 1.13.2 - By ORelio & Contributors
================================================================================== ==================================================================================
Thanks for dowloading Minecraft Console Client! Thanks for dowloading Minecraft Console Client!
@ -275,8 +275,8 @@ Bug Hunters
Code contributions Code contributions
Allyoutoo, Aragas, Bancey, bearbear12345, corbanmailloux, dbear20, dogwatch, initsuj, Allyoutoo, Aragas, Bancey, bearbear12345, corbanmailloux, dbear20, dogwatch, initsuj,
JamieSinn, justcool393, lokulin, maxpowa, medxo, Pokechu22, repository, TheMeq, v1RuX, JamieSinn, justcool393, lokulin, maxpowa, medxo, Pokechu22, repository, TheMeq, TheSnoozer,
ZizzyDizzyMC vkorn, v1RuX, ZizzyDizzyMC
Libraries Libraries