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:
@@ -600,9 +600,7 @@ public class EcoBoss extends PluginDependent<EcoPlugin> {
|
|||||||
|
|
||||||
// Spawn egg
|
// Spawn egg
|
||||||
if (this.getConfig().getBool("spawn-egg.enabled")) {
|
if (this.getConfig().getBool("spawn-egg.enabled")) {
|
||||||
Material material = Material.getMaterial(this.getConfig().getString("spawn-egg.material").toUpperCase());
|
ItemBuilder builder = new ItemStackBuilder(Items.lookup(this.getConfig().getString("spawn-egg.material")).getItem())
|
||||||
assert material != null;
|
|
||||||
ItemBuilder builder = new ItemStackBuilder(material)
|
|
||||||
.setDisplayName(this.getConfig().getString("spawn-egg.name"))
|
.setDisplayName(this.getConfig().getString("spawn-egg.name"))
|
||||||
.addLoreLines(this.getConfig().getStrings("spawn-egg.lore"))
|
.addLoreLines(this.getConfig().getStrings("spawn-egg.lore"))
|
||||||
.writeMetaKey(this.getPlugin().getNamespacedKeyFactory().create("spawn_egg"), PersistentDataType.STRING, this.getId());
|
.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();
|
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")) {
|
if (this.getConfig().getBool("spawn-egg.craftable")) {
|
||||||
Recipes.createAndRegisterRecipe(
|
Recipes.createAndRegisterRecipe(
|
||||||
this.getPlugin(),
|
this.getPlugin(),
|
||||||
@@ -688,7 +689,7 @@ public class EcoBoss extends PluginDependent<EcoPlugin> {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NumberUtils.randFloat(0, 100) <= chance) {
|
if (NumberUtils.randFloat(0, 100) < chance) {
|
||||||
drops.add(itemStack);
|
drops.add(itemStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user