mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-30 17:54:56 +00:00
Test loot material lookup, plugin block keys, the module summary log and the plugin content wait
This commit is contained in:
1 parent
bfd2a762c7
commit
65a6cebe9c
6 files changed
+323
-3
No files matched your search
@@ -29,6 +29,7 @@ import art.arcane.volmlib.util.format.Form;
|
||||
import com.volmit.item.ItemAttribute;
|
||||
import com.volmit.item.ItemDrop;
|
||||
import com.volmit.item.ItemEnchantment;
|
||||
import com.volmit.resource.ContentKey;
|
||||
import com.volmit.resource.ResourceId;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
@@ -96,7 +97,7 @@ public final class BukkitItemStacks {
|
||||
stack.setAmount(drop.amount());
|
||||
return stack;
|
||||
}
|
||||
Material material = Material.matchMaterial(drop.item().toString());
|
||||
Material material = materialOf(drop.item());
|
||||
if (material == null) {
|
||||
IrisLogging.warnOnce("loot:material:" + drop.item(), "Unknown Material: %s", drop.item());
|
||||
return null;
|
||||
@@ -104,6 +105,11 @@ public final class BukkitItemStacks {
|
||||
return new ItemStack(material, drop.amount());
|
||||
}
|
||||
|
||||
/** The vanilla material a platform item key such as {@code minecraft:coal} names; null when none does. */
|
||||
static Material materialOf(ContentKey item) {
|
||||
return Material.matchMaterial(item.toString());
|
||||
}
|
||||
|
||||
private static KMap<String, Object> customNbtOf(ItemDrop drop) {
|
||||
Map<String, Object> customNbt = drop.extras().customNbt();
|
||||
return customNbt.isEmpty() ? null : new KMap<>(customNbt);
|
||||
|
||||
@@ -56,7 +56,7 @@ import java.util.Map;
|
||||
/**
|
||||
* Bukkit adapter resolving namespaced keys against the live Bukkit registries.
|
||||
*/
|
||||
public final class BukkitRegistries implements PlatformRegistries {
|
||||
public class BukkitRegistries implements PlatformRegistries {
|
||||
@Override
|
||||
public PlatformBlockState block(String key) {
|
||||
BlockData data = BukkitBlockResolution.get(key);
|
||||
@@ -126,13 +126,18 @@ public final class BukkitRegistries implements PlatformRegistries {
|
||||
|
||||
@Override
|
||||
public List<String> blockKeys() {
|
||||
List<String> keys = new ArrayList<>(vanillaBlockKeys());
|
||||
keys.addAll(externalKeys(DataType.BLOCK));
|
||||
return keys;
|
||||
}
|
||||
|
||||
List<String> vanillaBlockKeys() {
|
||||
List<String> keys = new ArrayList<>();
|
||||
for (Material material : Registry.MATERIAL) {
|
||||
if (material.isBlock()) {
|
||||
keys.add(material.getKey().toString());
|
||||
}
|
||||
}
|
||||
keys.addAll(externalKeys(DataType.BLOCK));
|
||||
return keys;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user