fix /xmodel with per-axis model scale

This commit is contained in:
UnknownShadow200 2018-04-12 20:25:51 +10:00
parent 76dfe1aab1
commit 717e2beaed
2 changed files with 11 additions and 15 deletions

View File

@ -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) {

View File

@ -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();
}
}
}