Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
feat: update to levilamina 0.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Feb 2, 2024
1 parent 84973e2 commit 38e7e0e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <ll/api/memory/Hook.h>

// MC
#include <mc/world/Minecraft.h>
// Item
#include <mc/world/item/Item.h>
#include <mc/world/item/ItemDescriptor.h>
Expand Down Expand Up @@ -48,6 +49,7 @@
// Command
#include <mc/server/commands/CommandRegistry.h>
#include "mc/server/commands/CommandParameterData.h"
#include "mc/server/commands/MinecraftCommands.h"
// NBT
#include <mc/nbt/CompoundTag.h>
#include <mc/nbt/CompoundTagVariant.h>
Expand Down Expand Up @@ -79,17 +81,17 @@ namespace plugin {
return false;
}
const unsigned long len = compressBound(original_str.size());
auto *buf = (unsigned char *) malloc(len);
auto *buf = static_cast<unsigned char *>(malloc(len));
if (!buf) {
return false;
}
d_stream.next_in = (unsigned char *) (original_str.c_str());
d_stream.next_in = (unsigned char *) original_str.c_str();
d_stream.avail_in = original_str.size();
d_stream.next_out = buf;
d_stream.avail_out = len;
deflate(&d_stream, Z_SYNC_FLUSH);
deflateEnd(&d_stream);
str.assign((char *) buf, d_stream.total_out);
str.assign(reinterpret_cast<char *>(buf), d_stream.total_out);
free(buf);
return true;
}
Expand Down Expand Up @@ -368,8 +370,7 @@ namespace plugin {
for (int i = 0; i <= 256; ++i) {
try {
if (item.isValidAuxValue(i)) {
const auto itemstack = ItemStack(item, 1, i); // ignore some invaild aux exception
if (!uniqueStr.contains(itemstack.getDescriptionId())) {
if (const auto itemstack = ItemStack(item, 1, i); !uniqueStr.contains(itemstack.getDescriptionId())) {
uniqueStr.insert(itemstack.getDescriptionId());
descriptionId.putString(std::to_string(i), itemstack.getDescriptionId());
}
Expand Down
2 changes: 1 addition & 1 deletion xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ end

-- Option 1: Use the latest version of LeviLamina released on GitHub.

add_requires("levilamina 0.5.1")
add_requires("levilamina 0.6.3")
add_requires("zlib-ng 2.1.3")

-- Option 2: Use a specific version of LeviLamina released on GitHub.
Expand Down

0 comments on commit 38e7e0e

Please sign in to comment.