mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +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
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue