Compare commits
2 Commits
b9c1853b8a
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
f0222253df
|
|||
|
bd25bedacc
|
@@ -4,12 +4,30 @@ import dev.sillyangel.more_spear_enchantments.enchantment.SpearEnchantments;
|
|||||||
import io.papermc.paper.plugin.bootstrap.BootstrapContext;
|
import io.papermc.paper.plugin.bootstrap.BootstrapContext;
|
||||||
import io.papermc.paper.plugin.bootstrap.PluginBootstrap;
|
import io.papermc.paper.plugin.bootstrap.PluginBootstrap;
|
||||||
import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager;
|
import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager;
|
||||||
|
import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents;
|
||||||
|
import io.papermc.paper.registry.RegistryKey;
|
||||||
|
import io.papermc.paper.registry.TypedKey;
|
||||||
import io.papermc.paper.registry.event.RegistryEvents;
|
import io.papermc.paper.registry.event.RegistryEvents;
|
||||||
|
import io.papermc.paper.registry.keys.tags.EnchantmentTagKeys;
|
||||||
|
import io.papermc.paper.tag.PostFlattenTagRegistrar;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@SuppressWarnings("UnstableApiUsage")
|
@SuppressWarnings("UnstableApiUsage")
|
||||||
public class SpearEnchantmentsBootstrap implements PluginBootstrap {
|
public class SpearEnchantmentsBootstrap implements PluginBootstrap {
|
||||||
|
|
||||||
|
// Define all enchantments in one place for easy management
|
||||||
|
private static final Set<TypedKey<Enchantment>> ALL_ENCHANTMENTS = Set.of(
|
||||||
|
SpearEnchantments.VAMPIRIC,
|
||||||
|
SpearEnchantments.EXPLOSIVE,
|
||||||
|
SpearEnchantments.LIGHTNING,
|
||||||
|
SpearEnchantments.CRIPPLING,
|
||||||
|
SpearEnchantments.POISON,
|
||||||
|
SpearEnchantments.WITHERING
|
||||||
|
);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bootstrap(@NotNull BootstrapContext context) {
|
public void bootstrap(@NotNull BootstrapContext context) {
|
||||||
context.getLogger().info("MoreSpearEnchantments bootstrap starting...");
|
context.getLogger().info("MoreSpearEnchantments bootstrap starting...");
|
||||||
@@ -21,6 +39,14 @@ public class SpearEnchantmentsBootstrap implements PluginBootstrap {
|
|||||||
SpearEnchantments.registerEnchantments(event.registry());
|
SpearEnchantments.registerEnchantments(event.registry());
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// Add all enchantments to the appropriate tags
|
||||||
|
manager.registerEventHandler(LifecycleEvents.TAGS.postFlatten(RegistryKey.ENCHANTMENT), event -> {
|
||||||
|
final PostFlattenTagRegistrar<Enchantment> registrar = event.registrar();
|
||||||
|
registrar.addToTag(EnchantmentTagKeys.TRADEABLE, ALL_ENCHANTMENTS);
|
||||||
|
registrar.addToTag(EnchantmentTagKeys.NON_TREASURE, ALL_ENCHANTMENTS);
|
||||||
|
registrar.addToTag(EnchantmentTagKeys.IN_ENCHANTING_TABLE, ALL_ENCHANTMENTS);
|
||||||
|
});
|
||||||
|
|
||||||
context.getLogger().info("MoreSpearEnchantments bootstrap complete!");
|
context.getLogger().info("MoreSpearEnchantments bootstrap complete!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class SpearEnchantments {
|
|||||||
registry.register(
|
registry.register(
|
||||||
VAMPIRIC,
|
VAMPIRIC,
|
||||||
builder -> builder
|
builder -> builder
|
||||||
.description(Component.text("Vampiric"))
|
.description(Component.translatable("enchantment.more_spear_enchantments.vampiric", "Vampiric"))
|
||||||
.maxLevel(3)
|
.maxLevel(3)
|
||||||
.weight(2)
|
.weight(2)
|
||||||
.minimumCost(EnchantmentRegistryEntry.EnchantmentCost.of(10, 8))
|
.minimumCost(EnchantmentRegistryEntry.EnchantmentCost.of(10, 8))
|
||||||
@@ -80,7 +80,7 @@ public class SpearEnchantments {
|
|||||||
registry.register(
|
registry.register(
|
||||||
EXPLOSIVE,
|
EXPLOSIVE,
|
||||||
builder -> builder
|
builder -> builder
|
||||||
.description(Component.text("Explosive"))
|
.description(Component.translatable("enchantment.more_spear_enchantments.explosive", "Explosive"))
|
||||||
.maxLevel(3)
|
.maxLevel(3)
|
||||||
.weight(1)
|
.weight(1)
|
||||||
.minimumCost(EnchantmentRegistryEntry.EnchantmentCost.of(20, 10))
|
.minimumCost(EnchantmentRegistryEntry.EnchantmentCost.of(20, 10))
|
||||||
@@ -95,7 +95,7 @@ public class SpearEnchantments {
|
|||||||
registry.register(
|
registry.register(
|
||||||
LIGHTNING,
|
LIGHTNING,
|
||||||
builder -> builder
|
builder -> builder
|
||||||
.description(Component.text("Lightning"))
|
.description(Component.translatable("enchantment.more_spear_enchantments.lightning", "Lightning"))
|
||||||
.maxLevel(3)
|
.maxLevel(3)
|
||||||
.weight(2)
|
.weight(2)
|
||||||
.minimumCost(EnchantmentRegistryEntry.EnchantmentCost.of(15, 9))
|
.minimumCost(EnchantmentRegistryEntry.EnchantmentCost.of(15, 9))
|
||||||
@@ -110,7 +110,7 @@ public class SpearEnchantments {
|
|||||||
registry.register(
|
registry.register(
|
||||||
CRIPPLING,
|
CRIPPLING,
|
||||||
builder -> builder
|
builder -> builder
|
||||||
.description(Component.text("Crippling"))
|
.description(Component.translatable("enchantment.more_spear_enchantments.crippling", "Crippling"))
|
||||||
.maxLevel(3)
|
.maxLevel(3)
|
||||||
.weight(2)
|
.weight(2)
|
||||||
.minimumCost(EnchantmentRegistryEntry.EnchantmentCost.of(10, 8))
|
.minimumCost(EnchantmentRegistryEntry.EnchantmentCost.of(10, 8))
|
||||||
@@ -125,7 +125,7 @@ public class SpearEnchantments {
|
|||||||
registry.register(
|
registry.register(
|
||||||
POISON,
|
POISON,
|
||||||
builder -> builder
|
builder -> builder
|
||||||
.description(Component.text("Poison"))
|
.description(Component.translatable("enchantment.more_spear_enchantments.poison", "Poison"))
|
||||||
.maxLevel(3)
|
.maxLevel(3)
|
||||||
.weight(2)
|
.weight(2)
|
||||||
.minimumCost(EnchantmentRegistryEntry.EnchantmentCost.of(10, 8))
|
.minimumCost(EnchantmentRegistryEntry.EnchantmentCost.of(10, 8))
|
||||||
@@ -140,7 +140,7 @@ public class SpearEnchantments {
|
|||||||
registry.register(
|
registry.register(
|
||||||
WITHERING,
|
WITHERING,
|
||||||
builder -> builder
|
builder -> builder
|
||||||
.description(Component.text("Withering"))
|
.description(Component.translatable("enchantment.more_spear_enchantments.withering", "Withering"))
|
||||||
.maxLevel(3)
|
.maxLevel(3)
|
||||||
.weight(1)
|
.weight(1)
|
||||||
.minimumCost(EnchantmentRegistryEntry.EnchantmentCost.of(15, 9))
|
.minimumCost(EnchantmentRegistryEntry.EnchantmentCost.of(15, 9))
|
||||||
|
|||||||
Reference in New Issue
Block a user