mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
update to newest version
This commit is contained in:
parent
31dac18c85
commit
fa51d9632d
3 changed files with 28 additions and 8 deletions
2
.gitattributes
vendored
2
.gitattributes
vendored
|
|
@ -1,2 +0,0 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
|
@ -324,16 +324,18 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// </summary>
|
||||
private Dictionary<string, object> ReadNextNbt(List<byte> cache, bool root)
|
||||
{
|
||||
Dictionary<string, object> NbtData = new Dictionary<string, object>();
|
||||
|
||||
if (root)
|
||||
{
|
||||
if (cache[0] == 0) // TAG_End
|
||||
return NbtData;
|
||||
if (cache[0] != 10) // TAG_Compound
|
||||
throw new System.IO.InvalidDataException("Failed to decode NBT: Does not start with TAG_Compound");
|
||||
ReadNextByte(cache); // Tag type (TAG_Compound)
|
||||
ReadData(ReadNextUShort(cache), cache); // NBT root name
|
||||
}
|
||||
|
||||
Dictionary<string, object> NbtData = new Dictionary<string, object>();
|
||||
|
||||
while (true)
|
||||
{
|
||||
int fieldType = ReadNextByte(cache);
|
||||
|
|
@ -445,7 +447,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
if (protocolversion < Protocol18Handler.MC18Version)
|
||||
{
|
||||
byte[] length = BitConverter.GetBytes((short)array.Length);
|
||||
Array.Reverse(length);
|
||||
Array.Reverse(length); //Endianness
|
||||
return ConcatBytes(length, array);
|
||||
}
|
||||
else return ConcatBytes(GetVarInt(array.Length), array);
|
||||
|
|
@ -464,7 +466,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a byte array representing the given location encoded as an unsigned short
|
||||
/// Get a byte array representing the given location encoded as an unsigned long
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A modulo will be applied if the location is outside the following ranges:
|
||||
|
|
@ -475,11 +477,14 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// <returns>Location representation as ulong</returns>
|
||||
public byte[] GetLocation(Location location)
|
||||
{
|
||||
byte[] locationBytes;
|
||||
if (protocolversion >= Protocol18Handler.MC114Version)
|
||||
{
|
||||
return BitConverter.GetBytes(((((ulong)location.X) & 0x3FFFFFF) << 38) | ((((ulong)location.Z) & 0x3FFFFFF) << 12) | (((ulong)location.Y) & 0xFFF));
|
||||
locationBytes = BitConverter.GetBytes(((((ulong)location.X) & 0x3FFFFFF) << 38) | ((((ulong)location.Z) & 0x3FFFFFF) << 12) | (((ulong)location.Y) & 0xFFF));
|
||||
}
|
||||
else return BitConverter.GetBytes(((((ulong)location.X) & 0x3FFFFFF) << 38) | ((((ulong)location.Y) & 0xFFF) << 26) | (((ulong)location.Z) & 0x3FFFFFF));
|
||||
else locationBytes = BitConverter.GetBytes(((((ulong)location.X) & 0x3FFFFFF) << 38) | ((((ulong)location.Y) & 0xFFF) << 26) | (((ulong)location.Z) & 0x3FFFFFF));
|
||||
Array.Reverse(locationBytes); //Endianness
|
||||
return locationBytes;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
17
MinecraftClient/config/sample-script-with-http-request.cs
Normal file
17
MinecraftClient/config/sample-script-with-http-request.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
//MCCScript 1.0
|
||||
|
||||
string mojangStatus = PerformHttpRequest("https://status.mojang.com/check");
|
||||
MCC.LogToConsole(mojangStatus);
|
||||
|
||||
//MCCScript Extensions
|
||||
|
||||
string PerformHttpRequest(string uri)
|
||||
{
|
||||
var request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri);
|
||||
var response = (System.Net.HttpWebResponse)request.GetResponse();
|
||||
string responseString;
|
||||
using (var stream = response.GetResponseStream())
|
||||
using (var reader = new StreamReader(stream))
|
||||
responseString = reader.ReadToEnd();
|
||||
return responseString;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue