Added support for custom potion effects in loot chests

main
Shinare 4 months ago
parent dd1992e99c
commit c6bffc4b48

1
.gitignore vendored

@ -0,0 +1 @@
target

@ -3,7 +3,7 @@
<groupId>com.zivilon</groupId>
<artifactId>DungeonTools</artifactId>
<version>1.4</version>
<version>1.5</version>
<packaging>jar</packaging>
<name>DungeonTools</name>

@ -161,6 +161,29 @@ public class loot_chest_command implements CommandExecutor {
}
}
// Parse CustomPotionEffects
if (custom_item_section.contains("CustomPotionEffects")) {
List<Map<?, ?>> potion_effects = custom_item_section.getMapList("CustomPotionEffects");
NBTList effects_NBT = new NBTList();
for (Map<?, ?> effect_map : potion_effects) {
NBTCompound effect_NBT = new NBTCompound();
if (effect_map.containsKey("Id")) {
effect_NBT.put("Id", ((Number) effect_map.get("Id")).byteValue());
}
if (effect_map.containsKey("Amplifier")) {
effect_NBT.put("Amplifier", ((Number) effect_map.get("Amplifier")).byteValue());
}
if (effect_map.containsKey("Duration")) {
effect_NBT.put("Duration", ((Number) effect_map.get("Duration")).intValue());
}
if (effect_map.containsKey("ShowParticles")) {
effect_NBT.put("ShowParticles", (Boolean) effect_map.get("ShowParticles"));
}
effects_NBT.add(effect_NBT);
}
tag_NBT.put("CustomPotionEffects", effects_NBT);
}
ConfigurationSection enchantments_section = custom_item_section.getConfigurationSection("enchantments");
if (enchantments_section != null) {
NBTList ench_NBT = new NBTList();
@ -324,4 +347,4 @@ public class loot_chest_command implements CommandExecutor {
}
return true;
}
}
}

@ -1,8 +1,8 @@
main: com.zivilon.dungeontools.DungeonTools
name: DungeonTools
author: Shinare
version: 1.4
depend: [FakePlayer]
version: 1.5
depend: [FakePlayer, PowerNBT]
commands:
loot_chest:
description: Creates a loot chest in specified location

Loading…
Cancel
Save