mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
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:
parent
b57630a5e4
commit
c04b17cabc
12 changed files with 10147 additions and 573 deletions
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MinecraftClient.Mapping.BlockPalettes;
|
||||
|
||||
namespace MinecraftClient.Mapping
|
||||
{
|
||||
|
|
@ -11,37 +12,68 @@ namespace MinecraftClient.Mapping
|
|||
public struct Block
|
||||
{
|
||||
/// <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>
|
||||
private ushort blockIdAndMeta;
|
||||
|
||||
/// <summary>
|
||||
/// Id of the block
|
||||
/// </summary>
|
||||
public short BlockId
|
||||
public int BlockId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (short)(blockIdAndMeta >> 4);
|
||||
if (Palette.IdHasMetadata)
|
||||
{
|
||||
return blockIdAndMeta >> 4;
|
||||
}
|
||||
return blockIdAndMeta;
|
||||
}
|
||||
set
|
||||
{
|
||||
blockIdAndMeta = (ushort)(value << 4 | BlockMeta);
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (value > ushort.MaxValue || value < 0)
|
||||
throw new ArgumentOutOfRangeException("value", "Invalid block ID. Accepted range: 0-65535");
|
||||
blockIdAndMeta = (ushort)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metadata of the block
|
||||
/// Metadata of the block.
|
||||
/// This field has no effect starting with Minecraft 1.13.
|
||||
/// </summary>
|
||||
public byte BlockMeta
|
||||
{
|
||||
get
|
||||
{
|
||||
return (byte)(blockIdAndMeta & 0x0F);
|
||||
if (Palette.IdHasMetadata)
|
||||
{
|
||||
return (byte)(blockIdAndMeta & 0x0F);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
blockIdAndMeta = (ushort)((blockIdAndMeta & ~0x0F) | (value & 0x0F));
|
||||
if (Palette.IdHasMetadata)
|
||||
{
|
||||
blockIdAndMeta = (ushort)((blockIdAndMeta & ~0x0F) | (value & 0x0F));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +84,7 @@ namespace MinecraftClient.Mapping
|
|||
{
|
||||
get
|
||||
{
|
||||
return (Material)BlockId;
|
||||
return Palette.FromId(BlockId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -63,27 +95,22 @@ namespace MinecraftClient.Mapping
|
|||
/// <param name="metadata">Block metadata</param>
|
||||
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.BlockId = type;
|
||||
this.BlockMeta = metadata;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a block of the specified type and metadata
|
||||
/// Get a block of the specified type and metadata OR block state
|
||||
/// </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)
|
||||
{
|
||||
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>
|
||||
/// String representation of the block
|
||||
/// </summary>
|
||||
|
|
|
|||
202
MinecraftClient/Mapping/BlockPalettes/Palette112.cs
Normal file
202
MinecraftClient/Mapping/BlockPalettes/Palette112.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
8620
MinecraftClient/Mapping/BlockPalettes/Palette113.cs
Normal file
8620
MinecraftClient/Mapping/BlockPalettes/Palette113.cs
Normal file
File diff suppressed because it is too large
Load diff
87
MinecraftClient/Mapping/BlockPalettes/PaletteGenerator.cs
Normal file
87
MinecraftClient/Mapping/BlockPalettes/PaletteGenerator.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
41
MinecraftClient/Mapping/BlockPalettes/PaletteMapping.cs
Normal file
41
MinecraftClient/Mapping/BlockPalettes/PaletteMapping.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,362 +4,607 @@
|
|||
/// Represents Minecraft Materials
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Mostly ported from CraftBukkit's Material class
|
||||
/// Generated from blocks.json using PaletteGenerator.cs
|
||||
/// </remarks>
|
||||
/// <see href="https://github.com/Bukkit/Bukkit/blob/master/src/main/java/org/bukkit/Material.java"/>
|
||||
public enum Material
|
||||
{
|
||||
Air = 0,
|
||||
Stone = 1,
|
||||
Grass = 2,
|
||||
Dirt = 3,
|
||||
Cobblestone = 4,
|
||||
Wood = 5,
|
||||
Sapling = 6,
|
||||
Bedrock = 7,
|
||||
Water = 8,
|
||||
StationaryWater = 9,
|
||||
Lava = 10,
|
||||
StationaryLava = 11,
|
||||
Sand = 12,
|
||||
Gravel = 13,
|
||||
GoldOre = 14,
|
||||
IronOre = 15,
|
||||
CoalOre = 16,
|
||||
Log = 17,
|
||||
Leaves = 18,
|
||||
Sponge = 19,
|
||||
Glass = 20,
|
||||
LapisOre = 21,
|
||||
LapisBlock = 22,
|
||||
Dispenser = 23,
|
||||
Sandstone = 24,
|
||||
NoteBlock = 25,
|
||||
BedBlock = 26,
|
||||
PoweredRail = 27,
|
||||
DetectorRail = 28,
|
||||
PistonStickyBase = 29,
|
||||
Web = 30,
|
||||
LongGrass = 31,
|
||||
DeadBush = 32,
|
||||
PistonBase = 33,
|
||||
PistonExtension = 34,
|
||||
Wool = 35,
|
||||
PistonMovingPiece = 36,
|
||||
YellowFlower = 37,
|
||||
RedRose = 38,
|
||||
BrownMushroom = 39,
|
||||
RedMushroom = 40,
|
||||
GoldBlock = 41,
|
||||
IronBlock = 42,
|
||||
DoubleStep = 43,
|
||||
Step = 44,
|
||||
Brick = 45,
|
||||
Tnt = 46,
|
||||
Bookshelf = 47,
|
||||
MossyCobblestone = 48,
|
||||
Obsidian = 49,
|
||||
Torch = 50,
|
||||
Fire = 51,
|
||||
MobSpawner = 52,
|
||||
WoodStairs = 53,
|
||||
Chest = 54,
|
||||
RedstoneWire = 55,
|
||||
DiamondOre = 56,
|
||||
DiamondBlock = 57,
|
||||
Workbench = 58,
|
||||
Crops = 59,
|
||||
Soil = 60,
|
||||
Furnace = 61,
|
||||
BurningFurnace = 62,
|
||||
SignPost = 63,
|
||||
WoodenDoor = 64,
|
||||
Ladder = 65,
|
||||
Rails = 66,
|
||||
CobblestoneStairs = 67,
|
||||
WallSign = 68,
|
||||
Lever = 69,
|
||||
StonePlate = 70,
|
||||
IronDoorBlock = 71,
|
||||
WoodPlate = 72,
|
||||
RedstoneOre = 73,
|
||||
GlowingRedstoneOre = 74,
|
||||
RedstoneTorchOff = 75,
|
||||
RedstoneTorchOn = 76,
|
||||
StoneButton = 77,
|
||||
Snow = 78,
|
||||
Ice = 79,
|
||||
SnowBlock = 80,
|
||||
Cactus = 81,
|
||||
Clay = 82,
|
||||
SugarCaneBlock = 83,
|
||||
Jukebox = 84,
|
||||
Fence = 85,
|
||||
Pumpkin = 86,
|
||||
Netherrack = 87,
|
||||
SoulSand = 88,
|
||||
Glowstone = 89,
|
||||
Portal = 90,
|
||||
JackOLantern = 91,
|
||||
CakeBlock = 92,
|
||||
DiodeBlockOff = 93,
|
||||
DiodeBlockOn = 94,
|
||||
StainedGlass = 95,
|
||||
TrapDoor = 96,
|
||||
MonsterEggs = 97,
|
||||
SmoothBrick = 98,
|
||||
HugeMushroom1 = 99,
|
||||
HugeMushroom2 = 100,
|
||||
IronFence = 101,
|
||||
ThinGlass = 102,
|
||||
MelonBlock = 103,
|
||||
PumpkinStem = 104,
|
||||
MelonStem = 105,
|
||||
Vine = 106,
|
||||
FenceGate = 107,
|
||||
BrickStairs = 108,
|
||||
SmoothStairs = 109,
|
||||
Mycel = 110,
|
||||
WaterLily = 111,
|
||||
NetherBrick = 112,
|
||||
NetherFence = 113,
|
||||
NetherBrickStairs = 114,
|
||||
NetherWarts = 115,
|
||||
EnchantmentTable = 116,
|
||||
BrewingStand = 117,
|
||||
Cauldron = 118,
|
||||
EnderPortal = 119,
|
||||
EnderPortalFrame = 120,
|
||||
EnderStone = 121,
|
||||
DragonEgg = 122,
|
||||
RedstoneLampOff = 123,
|
||||
RedstoneLampOn = 124,
|
||||
WoodDoubleStep = 125,
|
||||
WoodStep = 126,
|
||||
Cocoa = 127,
|
||||
SandstoneStairs = 128,
|
||||
EmeraldOre = 129,
|
||||
EnderChest = 130,
|
||||
TripwireHook = 131,
|
||||
Tripwire = 132,
|
||||
EmeraldBlock = 133,
|
||||
SpruceWoodStairs = 134,
|
||||
BirchWoodStairs = 135,
|
||||
JungleWoodStairs = 136,
|
||||
Command = 137,
|
||||
Beacon = 138,
|
||||
CobbleWall = 139,
|
||||
FlowerPot = 140,
|
||||
Carrot = 141,
|
||||
Potato = 142,
|
||||
WoodButton = 143,
|
||||
Skull = 144,
|
||||
Anvil = 145,
|
||||
TrappedChest = 146,
|
||||
GoldPlate = 147,
|
||||
IronPlate = 148,
|
||||
RedstoneComparatorOff = 149,
|
||||
RedstoneComparatorOn = 150,
|
||||
DaylightDetector = 151,
|
||||
RedstoneBlock = 152,
|
||||
QuartzOre = 153,
|
||||
Hopper = 154,
|
||||
QuartzBlock = 155,
|
||||
QuartzStairs = 156,
|
||||
ActivatorRail = 157,
|
||||
Dropper = 158,
|
||||
StainedClay = 159,
|
||||
StainedGlassPane = 160,
|
||||
Leaves2 = 161,
|
||||
Log2 = 162,
|
||||
AcaciaStairs = 163,
|
||||
DarkOakStairs = 164,
|
||||
HayBlock = 170,
|
||||
Carpet = 171,
|
||||
HardClay = 172,
|
||||
CoalBlock = 173,
|
||||
PackedIce = 174,
|
||||
DoublePlant = 175
|
||||
}
|
||||
|
||||
/// <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.Grass:
|
||||
case Material.Dirt:
|
||||
case Material.Cobblestone:
|
||||
case Material.Wood:
|
||||
case Material.Bedrock:
|
||||
case Material.Sand:
|
||||
case Material.Gravel:
|
||||
case Material.GoldOre:
|
||||
case Material.IronOre:
|
||||
case Material.CoalOre:
|
||||
case Material.Log:
|
||||
case Material.Leaves:
|
||||
case Material.Sponge:
|
||||
case Material.Glass:
|
||||
case Material.LapisOre:
|
||||
case Material.LapisBlock:
|
||||
case Material.Dispenser:
|
||||
case Material.Sandstone:
|
||||
case Material.NoteBlock:
|
||||
case Material.BedBlock:
|
||||
case Material.PistonStickyBase:
|
||||
case Material.PistonBase:
|
||||
case Material.PistonExtension:
|
||||
case Material.Wool:
|
||||
case Material.PistonMovingPiece:
|
||||
case Material.GoldBlock:
|
||||
case Material.IronBlock:
|
||||
case Material.DoubleStep:
|
||||
case Material.Step:
|
||||
case Material.Brick:
|
||||
case Material.Tnt:
|
||||
case Material.Bookshelf:
|
||||
case Material.MossyCobblestone:
|
||||
case Material.Obsidian:
|
||||
case Material.MobSpawner:
|
||||
case Material.WoodStairs:
|
||||
case Material.Chest:
|
||||
case Material.DiamondOre:
|
||||
case Material.DiamondBlock:
|
||||
case Material.Workbench:
|
||||
case Material.Soil:
|
||||
case Material.Furnace:
|
||||
case Material.BurningFurnace:
|
||||
case Material.SignPost:
|
||||
case Material.WoodenDoor:
|
||||
case Material.CobblestoneStairs:
|
||||
case Material.WallSign:
|
||||
case Material.StonePlate:
|
||||
case Material.IronDoorBlock:
|
||||
case Material.WoodPlate:
|
||||
case Material.RedstoneOre:
|
||||
case Material.GlowingRedstoneOre:
|
||||
case Material.Ice:
|
||||
case Material.SnowBlock:
|
||||
case Material.Cactus:
|
||||
case Material.Clay:
|
||||
case Material.Jukebox:
|
||||
case Material.Fence:
|
||||
case Material.Pumpkin:
|
||||
case Material.Netherrack:
|
||||
case Material.SoulSand:
|
||||
case Material.Glowstone:
|
||||
case Material.JackOLantern:
|
||||
case Material.CakeBlock:
|
||||
case Material.StainedGlass:
|
||||
case Material.TrapDoor:
|
||||
case Material.MonsterEggs:
|
||||
case Material.SmoothBrick:
|
||||
case Material.HugeMushroom1:
|
||||
case Material.HugeMushroom2:
|
||||
case Material.IronFence:
|
||||
case Material.ThinGlass:
|
||||
case Material.MelonBlock:
|
||||
case Material.FenceGate:
|
||||
case Material.BrickStairs:
|
||||
case Material.SmoothStairs:
|
||||
case Material.Mycel:
|
||||
case Material.NetherBrick:
|
||||
case Material.NetherFence:
|
||||
case Material.NetherBrickStairs:
|
||||
case Material.EnchantmentTable:
|
||||
case Material.BrewingStand:
|
||||
case Material.Cauldron:
|
||||
case Material.EnderPortalFrame:
|
||||
case Material.EnderStone:
|
||||
case Material.DragonEgg:
|
||||
case Material.RedstoneLampOff:
|
||||
case Material.RedstoneLampOn:
|
||||
case Material.WoodDoubleStep:
|
||||
case Material.WoodStep:
|
||||
case Material.SandstoneStairs:
|
||||
case Material.EmeraldOre:
|
||||
case Material.EnderChest:
|
||||
case Material.EmeraldBlock:
|
||||
case Material.SpruceWoodStairs:
|
||||
case Material.BirchWoodStairs:
|
||||
case Material.JungleWoodStairs:
|
||||
case Material.Command:
|
||||
case Material.Beacon:
|
||||
case Material.CobbleWall:
|
||||
case Material.Anvil:
|
||||
case Material.TrappedChest:
|
||||
case Material.GoldPlate:
|
||||
case Material.IronPlate:
|
||||
case Material.DaylightDetector:
|
||||
case Material.RedstoneBlock:
|
||||
case Material.QuartzOre:
|
||||
case Material.Hopper:
|
||||
case Material.QuartzBlock:
|
||||
case Material.QuartzStairs:
|
||||
case Material.Dropper:
|
||||
case Material.StainedClay:
|
||||
case Material.HayBlock:
|
||||
case Material.HardClay:
|
||||
case Material.CoalBlock:
|
||||
case Material.StainedGlassPane:
|
||||
case Material.Leaves2:
|
||||
case Material.Log2:
|
||||
case Material.AcaciaStairs:
|
||||
case Material.DarkOakStairs:
|
||||
case Material.PackedIce:
|
||||
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.StationaryLava:
|
||||
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.StationaryWater:
|
||||
case Material.Lava:
|
||||
case Material.StationaryLava:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Air,
|
||||
Stone,
|
||||
Granite,
|
||||
PolishedGranite,
|
||||
Diorite,
|
||||
PolishedDiorite,
|
||||
Andesite,
|
||||
PolishedAndesite,
|
||||
GrassBlock,
|
||||
Dirt,
|
||||
CoarseDirt,
|
||||
Podzol,
|
||||
Cobblestone,
|
||||
OakPlanks,
|
||||
SprucePlanks,
|
||||
BirchPlanks,
|
||||
JunglePlanks,
|
||||
AcaciaPlanks,
|
||||
DarkOakPlanks,
|
||||
OakSapling,
|
||||
SpruceSapling,
|
||||
BirchSapling,
|
||||
JungleSapling,
|
||||
AcaciaSapling,
|
||||
DarkOakSapling,
|
||||
Bedrock,
|
||||
Water,
|
||||
Lava,
|
||||
Sand,
|
||||
RedSand,
|
||||
Gravel,
|
||||
GoldOre,
|
||||
IronOre,
|
||||
CoalOre,
|
||||
OakLog,
|
||||
SpruceLog,
|
||||
BirchLog,
|
||||
JungleLog,
|
||||
AcaciaLog,
|
||||
DarkOakLog,
|
||||
StrippedSpruceLog,
|
||||
StrippedBirchLog,
|
||||
StrippedJungleLog,
|
||||
StrippedAcaciaLog,
|
||||
StrippedDarkOakLog,
|
||||
StrippedOakLog,
|
||||
OakWood,
|
||||
SpruceWood,
|
||||
BirchWood,
|
||||
JungleWood,
|
||||
AcaciaWood,
|
||||
DarkOakWood,
|
||||
StrippedOakWood,
|
||||
StrippedSpruceWood,
|
||||
StrippedBirchWood,
|
||||
StrippedJungleWood,
|
||||
StrippedAcaciaWood,
|
||||
StrippedDarkOakWood,
|
||||
OakLeaves,
|
||||
SpruceLeaves,
|
||||
BirchLeaves,
|
||||
JungleLeaves,
|
||||
AcaciaLeaves,
|
||||
DarkOakLeaves,
|
||||
Sponge,
|
||||
WetSponge,
|
||||
Glass,
|
||||
LapisOre,
|
||||
LapisBlock,
|
||||
Dispenser,
|
||||
Sandstone,
|
||||
ChiseledSandstone,
|
||||
CutSandstone,
|
||||
NoteBlock,
|
||||
WhiteBed,
|
||||
OrangeBed,
|
||||
MagentaBed,
|
||||
LightBlueBed,
|
||||
YellowBed,
|
||||
LimeBed,
|
||||
PinkBed,
|
||||
GrayBed,
|
||||
LightGrayBed,
|
||||
CyanBed,
|
||||
PurpleBed,
|
||||
BlueBed,
|
||||
BrownBed,
|
||||
GreenBed,
|
||||
RedBed,
|
||||
BlackBed,
|
||||
PoweredRail,
|
||||
DetectorRail,
|
||||
StickyPiston,
|
||||
Cobweb,
|
||||
Grass,
|
||||
Fern,
|
||||
DeadBush,
|
||||
Seagrass,
|
||||
TallSeagrass,
|
||||
Piston,
|
||||
PistonHead,
|
||||
WhiteWool,
|
||||
OrangeWool,
|
||||
MagentaWool,
|
||||
LightBlueWool,
|
||||
YellowWool,
|
||||
LimeWool,
|
||||
PinkWool,
|
||||
GrayWool,
|
||||
LightGrayWool,
|
||||
CyanWool,
|
||||
PurpleWool,
|
||||
BlueWool,
|
||||
BrownWool,
|
||||
GreenWool,
|
||||
RedWool,
|
||||
BlackWool,
|
||||
MovingPiston,
|
||||
Dandelion,
|
||||
Poppy,
|
||||
BlueOrchid,
|
||||
Allium,
|
||||
AzureBluet,
|
||||
RedTulip,
|
||||
OrangeTulip,
|
||||
WhiteTulip,
|
||||
PinkTulip,
|
||||
OxeyeDaisy,
|
||||
BrownMushroom,
|
||||
RedMushroom,
|
||||
GoldBlock,
|
||||
IronBlock,
|
||||
Bricks,
|
||||
Tnt,
|
||||
Bookshelf,
|
||||
MossyCobblestone,
|
||||
Obsidian,
|
||||
Torch,
|
||||
WallTorch,
|
||||
Fire,
|
||||
Spawner,
|
||||
OakStairs,
|
||||
Chest,
|
||||
RedstoneWire,
|
||||
DiamondOre,
|
||||
DiamondBlock,
|
||||
CraftingTable,
|
||||
Wheat,
|
||||
Farmland,
|
||||
Furnace,
|
||||
Sign,
|
||||
OakDoor,
|
||||
Ladder,
|
||||
Rail,
|
||||
CobblestoneStairs,
|
||||
WallSign,
|
||||
Lever,
|
||||
StonePressurePlate,
|
||||
IronDoor,
|
||||
OakPressurePlate,
|
||||
SprucePressurePlate,
|
||||
BirchPressurePlate,
|
||||
JunglePressurePlate,
|
||||
AcaciaPressurePlate,
|
||||
DarkOakPressurePlate,
|
||||
RedstoneOre,
|
||||
RedstoneTorch,
|
||||
RedstoneWallTorch,
|
||||
StoneButton,
|
||||
Snow,
|
||||
Ice,
|
||||
SnowBlock,
|
||||
Cactus,
|
||||
Clay,
|
||||
SugarCane,
|
||||
Jukebox,
|
||||
OakFence,
|
||||
Pumpkin,
|
||||
Netherrack,
|
||||
SoulSand,
|
||||
Glowstone,
|
||||
NetherPortal,
|
||||
CarvedPumpkin,
|
||||
JackOLantern,
|
||||
Cake,
|
||||
Repeater,
|
||||
WhiteStainedGlass,
|
||||
OrangeStainedGlass,
|
||||
MagentaStainedGlass,
|
||||
LightBlueStainedGlass,
|
||||
YellowStainedGlass,
|
||||
LimeStainedGlass,
|
||||
PinkStainedGlass,
|
||||
GrayStainedGlass,
|
||||
LightGrayStainedGlass,
|
||||
CyanStainedGlass,
|
||||
PurpleStainedGlass,
|
||||
BlueStainedGlass,
|
||||
BrownStainedGlass,
|
||||
GreenStainedGlass,
|
||||
RedStainedGlass,
|
||||
BlackStainedGlass,
|
||||
OakTrapdoor,
|
||||
SpruceTrapdoor,
|
||||
BirchTrapdoor,
|
||||
JungleTrapdoor,
|
||||
AcaciaTrapdoor,
|
||||
DarkOakTrapdoor,
|
||||
InfestedStone,
|
||||
InfestedCobblestone,
|
||||
InfestedStoneBricks,
|
||||
InfestedMossyStoneBricks,
|
||||
InfestedCrackedStoneBricks,
|
||||
InfestedChiseledStoneBricks,
|
||||
StoneBricks,
|
||||
MossyStoneBricks,
|
||||
CrackedStoneBricks,
|
||||
ChiseledStoneBricks,
|
||||
BrownMushroomBlock,
|
||||
RedMushroomBlock,
|
||||
MushroomStem,
|
||||
IronBars,
|
||||
GlassPane,
|
||||
Melon,
|
||||
AttachedPumpkinStem,
|
||||
AttachedMelonStem,
|
||||
PumpkinStem,
|
||||
MelonStem,
|
||||
Vine,
|
||||
OakFenceGate,
|
||||
BrickStairs,
|
||||
StoneBrickStairs,
|
||||
Mycelium,
|
||||
LilyPad,
|
||||
NetherBricks,
|
||||
NetherBrickFence,
|
||||
NetherBrickStairs,
|
||||
NetherWart,
|
||||
EnchantingTable,
|
||||
BrewingStand,
|
||||
Cauldron,
|
||||
EndPortal,
|
||||
EndPortalFrame,
|
||||
EndStone,
|
||||
DragonEgg,
|
||||
RedstoneLamp,
|
||||
Cocoa,
|
||||
SandstoneStairs,
|
||||
EmeraldOre,
|
||||
EnderChest,
|
||||
TripwireHook,
|
||||
Tripwire,
|
||||
EmeraldBlock,
|
||||
SpruceStairs,
|
||||
BirchStairs,
|
||||
JungleStairs,
|
||||
CommandBlock,
|
||||
Beacon,
|
||||
CobblestoneWall,
|
||||
MossyCobblestoneWall,
|
||||
FlowerPot,
|
||||
PottedOakSapling,
|
||||
PottedSpruceSapling,
|
||||
PottedBirchSapling,
|
||||
PottedJungleSapling,
|
||||
PottedAcaciaSapling,
|
||||
PottedDarkOakSapling,
|
||||
PottedFern,
|
||||
PottedDandelion,
|
||||
PottedPoppy,
|
||||
PottedBlueOrchid,
|
||||
PottedAllium,
|
||||
PottedAzureBluet,
|
||||
PottedRedTulip,
|
||||
PottedOrangeTulip,
|
||||
PottedWhiteTulip,
|
||||
PottedPinkTulip,
|
||||
PottedOxeyeDaisy,
|
||||
PottedRedMushroom,
|
||||
PottedBrownMushroom,
|
||||
PottedDeadBush,
|
||||
PottedCactus,
|
||||
Carrots,
|
||||
Potatoes,
|
||||
OakButton,
|
||||
SpruceButton,
|
||||
BirchButton,
|
||||
JungleButton,
|
||||
AcaciaButton,
|
||||
DarkOakButton,
|
||||
SkeletonWallSkull,
|
||||
SkeletonSkull,
|
||||
WitherSkeletonWallSkull,
|
||||
WitherSkeletonSkull,
|
||||
ZombieWallHead,
|
||||
ZombieHead,
|
||||
PlayerWallHead,
|
||||
PlayerHead,
|
||||
CreeperWallHead,
|
||||
CreeperHead,
|
||||
DragonWallHead,
|
||||
DragonHead,
|
||||
Anvil,
|
||||
ChippedAnvil,
|
||||
DamagedAnvil,
|
||||
TrappedChest,
|
||||
LightWeightedPressurePlate,
|
||||
HeavyWeightedPressurePlate,
|
||||
Comparator,
|
||||
DaylightDetector,
|
||||
RedstoneBlock,
|
||||
NetherQuartzOre,
|
||||
Hopper,
|
||||
QuartzBlock,
|
||||
ChiseledQuartzBlock,
|
||||
QuartzPillar,
|
||||
QuartzStairs,
|
||||
ActivatorRail,
|
||||
Dropper,
|
||||
WhiteTerracotta,
|
||||
OrangeTerracotta,
|
||||
MagentaTerracotta,
|
||||
LightBlueTerracotta,
|
||||
YellowTerracotta,
|
||||
LimeTerracotta,
|
||||
PinkTerracotta,
|
||||
GrayTerracotta,
|
||||
LightGrayTerracotta,
|
||||
CyanTerracotta,
|
||||
PurpleTerracotta,
|
||||
BlueTerracotta,
|
||||
BrownTerracotta,
|
||||
GreenTerracotta,
|
||||
RedTerracotta,
|
||||
BlackTerracotta,
|
||||
WhiteStainedGlassPane,
|
||||
OrangeStainedGlassPane,
|
||||
MagentaStainedGlassPane,
|
||||
LightBlueStainedGlassPane,
|
||||
YellowStainedGlassPane,
|
||||
LimeStainedGlassPane,
|
||||
PinkStainedGlassPane,
|
||||
GrayStainedGlassPane,
|
||||
LightGrayStainedGlassPane,
|
||||
CyanStainedGlassPane,
|
||||
PurpleStainedGlassPane,
|
||||
BlueStainedGlassPane,
|
||||
BrownStainedGlassPane,
|
||||
GreenStainedGlassPane,
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
498
MinecraftClient/Mapping/MaterialExtensions.cs
Normal file
498
MinecraftClient/Mapping/MaterialExtensions.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -80,7 +80,7 @@ namespace MinecraftClient.Mapping
|
|||
if (chunk != null)
|
||||
return chunk.GetBlock(location);
|
||||
}
|
||||
return new Block(Material.Air);
|
||||
return new Block(0); //Air
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -97,6 +97,11 @@
|
|||
<Compile Include="Commands\Script.cs" />
|
||||
<Compile Include="Commands\Send.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="WinAPI\ConsoleIcon.cs" />
|
||||
<Compile Include="ConsoleIO.cs" />
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ using MinecraftClient.WinAPI;
|
|||
namespace MinecraftClient
|
||||
{
|
||||
/// <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.
|
||||
/// This source code is released under the CDDL 1.0 License.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using MinecraftClient.Proxy;
|
|||
using System.Security.Cryptography;
|
||||
using MinecraftClient.Protocol.Handlers.Forge;
|
||||
using MinecraftClient.Mapping;
|
||||
using MinecraftClient.Mapping.BlockPalettes;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers
|
||||
{
|
||||
|
|
@ -22,16 +23,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
private const int MC191Version = 108;
|
||||
private const int MC110Version = 210;
|
||||
private const int MC111Version = 315;
|
||||
private const int MC17w13aVersion = 318;
|
||||
private const int MC112pre5Version = 332;
|
||||
private const int MC17w31aVersion = 336;
|
||||
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 MC112Version = 335;
|
||||
private const int MC1121Version = 338;
|
||||
private const int MC1122Version = 340;
|
||||
private const int MC113Version = 393;
|
||||
|
||||
private int compression_treshold = 0;
|
||||
|
|
@ -61,6 +55,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
this.protocolversion = ProtocolVersion;
|
||||
this.handler = Handler;
|
||||
this.forgeInfo = ForgeInfo;
|
||||
if (protocolversion >= MC113Version)
|
||||
Block.Palette = new Palette113();
|
||||
else Block.Palette = new Palette112();
|
||||
}
|
||||
|
||||
private Protocol18Handler(TcpClient Client)
|
||||
|
|
@ -171,7 +168,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// <returns>Abstract numbering</returns>
|
||||
private PacketIncomingType getPacketIncomingType(int packetID, int protocol)
|
||||
{
|
||||
if (protocol < MC19Version)
|
||||
if (protocol <= MC18Version) // MC 1.7 and 1.8
|
||||
{
|
||||
switch (packetID)
|
||||
{
|
||||
|
|
@ -194,7 +191,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
default: return PacketIncomingType.UnknownPacket;
|
||||
}
|
||||
}
|
||||
else if (protocol < MC17w13aVersion)
|
||||
else if (protocol <= MC111Version) // MC 1.9, 1.10 and 1.11
|
||||
{
|
||||
switch (packetID)
|
||||
{
|
||||
|
|
@ -217,30 +214,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
default: return PacketIncomingType.UnknownPacket;
|
||||
}
|
||||
}
|
||||
else if (protocolversion < MC112pre5Version)
|
||||
{
|
||||
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)
|
||||
else if (protocol <= MC112Version) // MC 1.12.0
|
||||
{
|
||||
switch (packetID)
|
||||
{
|
||||
|
|
@ -263,7 +237,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
default: return PacketIncomingType.UnknownPacket;
|
||||
}
|
||||
}
|
||||
else if (protocol < MC17w45aVersion)
|
||||
else if (protocol <= MC1122Version) // MC 1.12.2
|
||||
{
|
||||
switch (packetID)
|
||||
{
|
||||
|
|
@ -286,76 +260,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
default: return PacketIncomingType.UnknownPacket;
|
||||
}
|
||||
}
|
||||
else if (protocol < MC17w46aVersion)
|
||||
{
|
||||
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
|
||||
else // MC 1.13+
|
||||
{
|
||||
switch (packetID)
|
||||
{
|
||||
|
|
@ -405,7 +310,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// <returns>Packet ID</returns>
|
||||
private int getPacketOutgoingID(PacketOutgoingType packet, int protocol)
|
||||
{
|
||||
if (protocol < MC19Version)
|
||||
if (protocol <= MC18Version) // MC 1.7 and 1.8
|
||||
{
|
||||
switch (packet)
|
||||
{
|
||||
|
|
@ -421,7 +326,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
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)
|
||||
{
|
||||
|
|
@ -437,23 +342,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case PacketOutgoingType.TeleportConfirm: return 0x00;
|
||||
}
|
||||
}
|
||||
else if (protocolversion < MC112pre5Version)
|
||||
{
|
||||
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)
|
||||
else if (protocol <= MC112Version) // MC 1.12
|
||||
{
|
||||
switch (packet)
|
||||
{
|
||||
|
|
@ -469,7 +358,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case PacketOutgoingType.TeleportConfirm: return 0x00;
|
||||
}
|
||||
}
|
||||
else if (protocol < MC17w45aVersion)
|
||||
else if (protocol <= MC1122Version) // 1.12.2
|
||||
{
|
||||
switch (packet)
|
||||
{
|
||||
|
|
@ -485,55 +374,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case PacketOutgoingType.TeleportConfirm: return 0x00;
|
||||
}
|
||||
}
|
||||
else if (protocol < MC17w46aVersion)
|
||||
{
|
||||
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
|
||||
else // MC 1.13+
|
||||
{
|
||||
switch (packet)
|
||||
{
|
||||
|
|
@ -701,6 +542,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
break;
|
||||
case PacketIncomingType.BlockChange:
|
||||
if (Settings.TerrainAndMovements)
|
||||
{
|
||||
if (protocolversion < MC18Version)
|
||||
{
|
||||
int blockX = readNextInt(packetData);
|
||||
|
|
@ -711,6 +553,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
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)));
|
||||
}
|
||||
break;
|
||||
case PacketIncomingType.MapChunkBulk:
|
||||
if (protocolversion < MC19Version && Settings.TerrainAndMovements)
|
||||
|
|
@ -818,31 +661,28 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
break;
|
||||
case PacketIncomingType.TabCompleteResult:
|
||||
if (protocolversion >= MC17w46aVersion)
|
||||
if (protocolversion >= MC113Version)
|
||||
{
|
||||
autocomplete_transaction_id = readNextVarInt(packetData);
|
||||
}
|
||||
|
||||
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);
|
||||
readNextVarInt(packetData); // Start of text to replace
|
||||
readNextVarInt(packetData); // Length of text to replace
|
||||
}
|
||||
|
||||
int autocomplete_count = readNextVarInt(packetData);
|
||||
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
|
||||
// Don't worry about skipping remaining data since there is no useful for us (yet)
|
||||
for (int i = 0; i < autocomplete_count; i++)
|
||||
{
|
||||
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;
|
||||
case PacketIncomingType.PluginMessage:
|
||||
String channel = readNextString(packetData);
|
||||
|
|
@ -1038,7 +878,16 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
byte bitsPerBlock = readNextByte(cache);
|
||||
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];
|
||||
for (int i = 0; i < paletteLength; i++)
|
||||
{
|
||||
|
|
@ -1068,7 +917,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
int endLong = ((blockNumber + 1) * bitsPerBlock - 1) / 64;
|
||||
|
||||
// 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;
|
||||
if (startLong == endLong)
|
||||
{
|
||||
|
|
@ -2040,7 +1889,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
if (protocolversion >= MC18Version)
|
||||
{
|
||||
if (protocolversion >= MC17w46aVersion)
|
||||
if (protocolversion >= MC113Version)
|
||||
{
|
||||
tabcomplete_packet = concatBytes(tabcomplete_packet, transaction_id);
|
||||
tabcomplete_packet = concatBytes(tabcomplete_packet, getString(BehindCursor));
|
||||
|
|
|
|||
|
|
@ -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!
|
||||
|
|
@ -275,8 +275,8 @@ Bug Hunters
|
|||
Code contributions
|
||||
|
||||
Allyoutoo, Aragas, Bancey, bearbear12345, corbanmailloux, dbear20, dogwatch, initsuj,
|
||||
JamieSinn, justcool393, lokulin, maxpowa, medxo, Pokechu22, repository, TheMeq, v1RuX,
|
||||
ZizzyDizzyMC
|
||||
JamieSinn, justcool393, lokulin, maxpowa, medxo, Pokechu22, repository, TheMeq, TheSnoozer,
|
||||
vkorn, v1RuX, ZizzyDizzyMC
|
||||
|
||||
Libraries
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue