mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
fix /xmodel with per-axis model scale
This commit is contained in:
parent
76dfe1aab1
commit
717e2beaed
@ -29,7 +29,7 @@ namespace MCGalaxy.Commands.CPE {
|
||||
new CommandPerm(LevelPermission.Operator, "+ can change the model of bots") }; }
|
||||
}
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("XModel") }; }
|
||||
get { return new[] { new CommandAlias("XModel", "-own") }; }
|
||||
}
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
|
@ -71,30 +71,26 @@ namespace MCGalaxy {
|
||||
|
||||
public static byte[] GZip(this byte[] bytes) {
|
||||
using (MemoryStream ms = new MemoryStream()) {
|
||||
using (GZipStream gs = new GZipStream(ms, CompressionMode.Compress, true))
|
||||
using (GZipStream gs = new GZipStream(ms, CompressionMode.Compress, true)) {
|
||||
gs.Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
|
||||
ms.Position = 0;
|
||||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] Decompress(this byte[] gzip, int capacity = 16)
|
||||
{
|
||||
// Create a GZIP stream with decompression mode.
|
||||
// ... Then create a buffer and write into while reading from the GZIP stream.
|
||||
using (GZipStream stream = new GZipStream(new MemoryStream(gzip), CompressionMode.Decompress))
|
||||
{
|
||||
public static byte[] Decompress(this byte[] gzip, int capacity = 16) {
|
||||
using (GZipStream src = new GZipStream(new MemoryStream(gzip), CompressionMode.Decompress)) {
|
||||
const int size = 4096;
|
||||
byte[] buffer = new byte[size];
|
||||
using (MemoryStream memory = new MemoryStream(capacity))
|
||||
{
|
||||
|
||||
using (MemoryStream dst = new MemoryStream(capacity)) {
|
||||
int count = 0;
|
||||
do {
|
||||
count = stream.Read(buffer, 0, size);
|
||||
if (count > 0) memory.Write(buffer, 0, count);
|
||||
} while (count > 0);
|
||||
return memory.ToArray();
|
||||
while ((count = src.Read(buffer, 0, size)) > 0) {
|
||||
dst.Write(buffer, 0, count);
|
||||
}
|
||||
return dst.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user