9
0
mirror of https://github.com/Auxilor/EcoMobs.git synced 2025-12-20 15:39:31 +00:00

Merge pull request #15

Added Items lookup system support to egg material, registered egg items in the Items lookup system
This commit is contained in:
Will FP
2022-01-20 11:58:46 +00:00
committed by GitHub

View File

@@ -600,9 +600,7 @@ public class EcoBoss extends PluginDependent<EcoPlugin> {
// Spawn egg
if (this.getConfig().getBool("spawn-egg.enabled")) {
Material material = Material.getMaterial(this.getConfig().getString("spawn-egg.material").toUpperCase());
assert material != null;
ItemBuilder builder = new ItemStackBuilder(material)
ItemBuilder builder = new ItemStackBuilder(Items.lookup(this.getConfig().getString("spawn-egg.material")).getItem())
.setDisplayName(this.getConfig().getString("spawn-egg.name"))
.addLoreLines(this.getConfig().getStrings("spawn-egg.lore"))
.writeMetaKey(this.getPlugin().getNamespacedKeyFactory().create("spawn_egg"), PersistentDataType.STRING, this.getId());
@@ -614,6 +612,9 @@ public class EcoBoss extends PluginDependent<EcoPlugin> {
this.spawnEgg = builder.build();
Items.registerCustomItem(this.getPlugin().getNamespacedKeyFactory().create(this.getId()+"_spawn_egg"),
Items.lookup(this.getConfig().getString("spawn-egg.material")));
if (this.getConfig().getBool("spawn-egg.craftable")) {
Recipes.createAndRegisterRecipe(
this.getPlugin(),
@@ -688,7 +689,7 @@ public class EcoBoss extends PluginDependent<EcoPlugin> {
continue;
}
if (NumberUtils.randFloat(0, 100) <= chance) {
if (NumberUtils.randFloat(0, 100) < chance) {
drops.add(itemStack);
}
}