1.0.1
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"anvil_cost": 5,
|
||||
"description": {
|
||||
"translate": "enchantment.more_spear_enchantments.crippling"
|
||||
},
|
||||
"effects": {
|
||||
"minecraft:post_attack": [
|
||||
{
|
||||
"affected": "victim",
|
||||
"effect": {
|
||||
"type": "more_spear_enchantments:crippling",
|
||||
"duration": {
|
||||
"type": "minecraft:linear",
|
||||
"base": 2.0,
|
||||
"per_level_above_first": 1.0
|
||||
}
|
||||
},
|
||||
"enchanted": "attacker"
|
||||
}
|
||||
]
|
||||
},
|
||||
"max_cost": {
|
||||
"base": 1,
|
||||
"per_level_above_first": 15
|
||||
},
|
||||
"max_level": 3,
|
||||
"min_cost": {
|
||||
"base": 1,
|
||||
"per_level_above_first": 10
|
||||
},
|
||||
"slots": [
|
||||
"hand"
|
||||
],
|
||||
"supported_items": "#more_spear_enchantments:spears",
|
||||
"weight": 10
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"anvil_cost": 5,
|
||||
"description": {
|
||||
"translate": "enchantment.more_spear_enchantments.poisoning"
|
||||
},
|
||||
"effects": {
|
||||
"minecraft:post_attack": [
|
||||
{
|
||||
"affected": "victim",
|
||||
"effect": {
|
||||
"type": "more_spear_enchantments:poison",
|
||||
"duration": {
|
||||
"type": "minecraft:linear",
|
||||
"base": 3.0,
|
||||
"per_level_above_first": 1.0
|
||||
}
|
||||
},
|
||||
"enchanted": "attacker"
|
||||
}
|
||||
]
|
||||
},
|
||||
"max_cost": {
|
||||
"base": 1,
|
||||
"per_level_above_first": 15
|
||||
},
|
||||
"max_level": 3,
|
||||
"min_cost": {
|
||||
"base": 1,
|
||||
"per_level_above_first": 10
|
||||
},
|
||||
"slots": [
|
||||
"hand"
|
||||
],
|
||||
"supported_items": "#more_spear_enchantments:spears",
|
||||
"weight": 10
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"anvil_cost": 5,
|
||||
"description": {
|
||||
"translate": "enchantment.more_spear_enchantments.thundering"
|
||||
},
|
||||
"effects": {
|
||||
"minecraft:post_attack": [
|
||||
{
|
||||
"affected": "victim",
|
||||
"effect": {
|
||||
"type": "more_spear_enchantments:lightning",
|
||||
"amount": {
|
||||
"type": "minecraft:linear",
|
||||
"base": 0.4,
|
||||
"per_level_above_first": 0.2
|
||||
}
|
||||
},
|
||||
"enchanted": "attacker"
|
||||
}
|
||||
]
|
||||
},
|
||||
"max_cost": {
|
||||
"base": 1,
|
||||
"per_level_above_first": 15
|
||||
},
|
||||
"max_level": 3,
|
||||
"min_cost": {
|
||||
"base": 1,
|
||||
"per_level_above_first": 10
|
||||
},
|
||||
"slots": [
|
||||
"hand"
|
||||
],
|
||||
"supported_items": "#more_spear_enchantments:spears",
|
||||
"weight": 10
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"anvil_cost": 5,
|
||||
"description": {
|
||||
"translate": "enchantment.more_spear_enchantments.withering"
|
||||
},
|
||||
"effects": {
|
||||
"minecraft:post_attack": [
|
||||
{
|
||||
"affected": "victim",
|
||||
"effect": {
|
||||
"type": "more_spear_enchantments:withering",
|
||||
"duration": {
|
||||
"type": "minecraft:linear",
|
||||
"base": 2.0,
|
||||
"per_level_above_first": 1.0
|
||||
}
|
||||
},
|
||||
"enchanted": "attacker"
|
||||
}
|
||||
]
|
||||
},
|
||||
"max_cost": {
|
||||
"base": 1,
|
||||
"per_level_above_first": 15
|
||||
},
|
||||
"max_level": 3,
|
||||
"min_cost": {
|
||||
"base": 1,
|
||||
"per_level_above_first": 10
|
||||
},
|
||||
"slots": [
|
||||
"hand"
|
||||
],
|
||||
"supported_items": "#more_spear_enchantments:spears",
|
||||
"weight": 10
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"values": [
|
||||
"minecraft:wooden_spear",
|
||||
"minecraft:stone_spear",
|
||||
"minecraft:copper_spear",
|
||||
"minecraft:iron_spear",
|
||||
"minecraft:golden_spear",
|
||||
"minecraft:diamond_spear",
|
||||
"minecraft:netherite_spear"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package dev.sillyangel.more_spear_enchantments;
|
||||
|
||||
import dev.sillyangel.more_spear_enchantments.enchantment.ModEnchantmentEffects;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public final class MoreSpearEnchantments {
|
||||
public static final String MOD_ID = "more_spear_enchantments";
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
||||
|
||||
public static void init() {
|
||||
LOGGER.info("Initializing More Spear Enchantments");
|
||||
ModEnchantmentEffects.registerModEnchantmentEffects();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package dev.sillyangel.more_spear_enchantments.enchantment;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import dev.architectury.registry.registries.DeferredRegister;
|
||||
import dev.architectury.registry.registries.RegistrySupplier;
|
||||
import dev.sillyangel.more_spear_enchantments.MoreSpearEnchantments;
|
||||
import dev.sillyangel.more_spear_enchantments.enchantment.effect.*;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.effect.EnchantmentEntityEffect;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class ModEnchantmentEffects {
|
||||
// Deferred register for enchantment effect types
|
||||
public static final DeferredRegister<MapCodec<? extends EnchantmentEntityEffect>> ENCHANTMENT_ENTITY_EFFECTS =
|
||||
DeferredRegister.create(MoreSpearEnchantments.MOD_ID, RegistryKeys.ENCHANTMENT_ENTITY_EFFECT_TYPE);
|
||||
|
||||
// Enchantment registry keys
|
||||
public static final RegistryKey<Enchantment> THUNDERING = of("thundering");
|
||||
public static final RegistryKey<Enchantment> WITHERING = of("withering");
|
||||
public static final RegistryKey<Enchantment> POISONING = of("poisoning");
|
||||
public static final RegistryKey<Enchantment> CRIPPLING = of("crippling");
|
||||
|
||||
// Register enchantment effect types
|
||||
public static final RegistrySupplier<MapCodec<LightningEnchantmentEffect>> LIGHTNING_EFFECT =
|
||||
ENCHANTMENT_ENTITY_EFFECTS.register("lightning", () -> LightningEnchantmentEffect.CODEC);
|
||||
public static final RegistrySupplier<MapCodec<PoisonEnchantmentEffect>> POISON_EFFECT =
|
||||
ENCHANTMENT_ENTITY_EFFECTS.register("poison", () -> PoisonEnchantmentEffect.CODEC);
|
||||
public static final RegistrySupplier<MapCodec<WitheringEnchantmentEffect>> WITHERING_EFFECT =
|
||||
ENCHANTMENT_ENTITY_EFFECTS.register("withering", () -> WitheringEnchantmentEffect.CODEC);
|
||||
public static final RegistrySupplier<MapCodec<CripplingEnchantmentEffect>> CRIPPLING_EFFECT =
|
||||
ENCHANTMENT_ENTITY_EFFECTS.register("crippling", () -> CripplingEnchantmentEffect.CODEC);
|
||||
|
||||
private static RegistryKey<Enchantment> of(String path) {
|
||||
Identifier id = Identifier.of(MoreSpearEnchantments.MOD_ID, path);
|
||||
return RegistryKey.of(RegistryKeys.ENCHANTMENT, id);
|
||||
}
|
||||
|
||||
public static void registerModEnchantmentEffects() {
|
||||
MoreSpearEnchantments.LOGGER.info("Registering EnchantmentEffects for " + MoreSpearEnchantments.MOD_ID);
|
||||
ENCHANTMENT_ENTITY_EFFECTS.register();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package dev.sillyangel.more_spear_enchantments.enchantment.effect;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.enchantment.EnchantmentEffectContext;
|
||||
import net.minecraft.enchantment.EnchantmentLevelBasedValue;
|
||||
import net.minecraft.enchantment.effect.EnchantmentEntityEffect;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public record CripplingEnchantmentEffect(EnchantmentLevelBasedValue duration) implements EnchantmentEntityEffect {
|
||||
public static final MapCodec<CripplingEnchantmentEffect> CODEC = RecordCodecBuilder.mapCodec(instance ->
|
||||
instance.group(
|
||||
EnchantmentLevelBasedValue.CODEC.fieldOf("duration").forGetter(CripplingEnchantmentEffect::duration)
|
||||
).apply(instance, CripplingEnchantmentEffect::new)
|
||||
);
|
||||
|
||||
@Override
|
||||
public void apply(ServerWorld world, int level, EnchantmentEffectContext context, Entity target, Vec3d pos) {
|
||||
if (target instanceof LivingEntity victim) {
|
||||
if (context.owner() != null && context.owner() instanceof PlayerEntity player) {
|
||||
int Duration = (int) (this.duration.getValue(level) * 50); // Convert to ticks
|
||||
int slownessAmplifier = level - 1; // Level 1 = Slowness 0, Level 2 = Slowness I, Level 3 = Slowness II
|
||||
int weaknessAmplifier = level - 1; // Level 1 = Weakness 0, Level 2 = Weakness I, Level 3 = Weakness II
|
||||
victim.addStatusEffect(new StatusEffectInstance(
|
||||
StatusEffects.SLOWNESS,
|
||||
Duration,
|
||||
slownessAmplifier,
|
||||
false,
|
||||
true
|
||||
));
|
||||
victim.addStatusEffect(new StatusEffectInstance(
|
||||
StatusEffects.WEAKNESS,
|
||||
Duration,
|
||||
weaknessAmplifier,
|
||||
false,
|
||||
true
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapCodec<? extends EnchantmentEntityEffect> getCodec() {
|
||||
return CODEC;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package dev.sillyangel.more_spear_enchantments.enchantment.effect;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.SpawnReason;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.enchantment.EnchantmentEffectContext;
|
||||
import net.minecraft.enchantment.EnchantmentLevelBasedValue;
|
||||
import net.minecraft.enchantment.effect.EnchantmentEntityEffect;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public record LightningEnchantmentEffect(EnchantmentLevelBasedValue amount) implements EnchantmentEntityEffect {
|
||||
public static final MapCodec<LightningEnchantmentEffect> CODEC = RecordCodecBuilder.mapCodec(instance ->
|
||||
instance.group(
|
||||
EnchantmentLevelBasedValue.CODEC.fieldOf("amount").forGetter(LightningEnchantmentEffect::amount)
|
||||
).apply(instance, LightningEnchantmentEffect::new)
|
||||
);
|
||||
|
||||
@Override
|
||||
public void apply(ServerWorld world, int level, EnchantmentEffectContext context, Entity target, Vec3d pos) {
|
||||
if (target instanceof LivingEntity victim) {
|
||||
if (context.owner() != null && context.owner() instanceof PlayerEntity player) {
|
||||
float numStrikes = this.amount.getValue(level);
|
||||
|
||||
for (float i = 0; i < numStrikes; i++) {
|
||||
BlockPos position = victim.getBlockPos();
|
||||
EntityType.LIGHTNING_BOLT.spawn(world, position, SpawnReason.TRIGGERED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapCodec<? extends EnchantmentEntityEffect> getCodec() {
|
||||
return CODEC;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package dev.sillyangel.more_spear_enchantments.enchantment.effect;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.enchantment.EnchantmentEffectContext;
|
||||
import net.minecraft.enchantment.EnchantmentLevelBasedValue;
|
||||
import net.minecraft.enchantment.effect.EnchantmentEntityEffect;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public record PoisonEnchantmentEffect(EnchantmentLevelBasedValue duration) implements EnchantmentEntityEffect {
|
||||
public static final MapCodec<PoisonEnchantmentEffect> CODEC = RecordCodecBuilder.mapCodec(instance ->
|
||||
instance.group(
|
||||
EnchantmentLevelBasedValue.CODEC.fieldOf("duration").forGetter(PoisonEnchantmentEffect::duration)
|
||||
).apply(instance, PoisonEnchantmentEffect::new)
|
||||
);
|
||||
|
||||
@Override
|
||||
public void apply(ServerWorld world, int level, EnchantmentEffectContext context, Entity target, Vec3d pos) {
|
||||
if (target instanceof LivingEntity victim) {
|
||||
if (context.owner() != null && context.owner() instanceof PlayerEntity player) {
|
||||
int poisonDuration = (int) (this.duration.getValue(level) * 40); // Convert to ticks
|
||||
int poisonAmplifier = level - 2; // Level 1 = Poison 0, Level 2 = Poison I, Level 3 = Poison II
|
||||
|
||||
victim.addStatusEffect(new StatusEffectInstance(
|
||||
StatusEffects.POISON,
|
||||
poisonDuration,
|
||||
poisonAmplifier,
|
||||
false,
|
||||
true
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapCodec<? extends EnchantmentEntityEffect> getCodec() {
|
||||
return CODEC;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package dev.sillyangel.more_spear_enchantments.enchantment.effect;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.enchantment.EnchantmentEffectContext;
|
||||
import net.minecraft.enchantment.EnchantmentLevelBasedValue;
|
||||
import net.minecraft.enchantment.effect.EnchantmentEntityEffect;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public record WitheringEnchantmentEffect(EnchantmentLevelBasedValue duration) implements EnchantmentEntityEffect {
|
||||
public static final MapCodec<WitheringEnchantmentEffect> CODEC = RecordCodecBuilder.mapCodec(instance ->
|
||||
instance.group(
|
||||
EnchantmentLevelBasedValue.CODEC.fieldOf("duration").forGetter(WitheringEnchantmentEffect::duration)
|
||||
).apply(instance, WitheringEnchantmentEffect::new)
|
||||
);
|
||||
|
||||
@Override
|
||||
public void apply(ServerWorld world, int level, EnchantmentEffectContext context, Entity target, Vec3d pos) {
|
||||
if (target instanceof LivingEntity victim) {
|
||||
if (context.owner() != null && context.owner() instanceof PlayerEntity player) {
|
||||
int witherDuration = (int) (this.duration.getValue(level) * 40); // Convert to ticks
|
||||
int witherAmplifier = level - 2; // Level 1 = Wither 0, Level 2 = Wither I, Level 3 = Wither II
|
||||
|
||||
victim.addStatusEffect(new StatusEffectInstance(
|
||||
StatusEffects.WITHER,
|
||||
witherDuration,
|
||||
witherAmplifier,
|
||||
false,
|
||||
true
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapCodec<? extends EnchantmentEntityEffect> getCodec() {
|
||||
return CODEC;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package dev.sillyangel.more_spear_enchantments.util;
|
||||
|
||||
import dev.sillyangel.more_spear_enchantments.MoreSpearEnchantments;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class ModTags {
|
||||
public static class Blocks {
|
||||
|
||||
private static TagKey<Block> createTag(String name) {
|
||||
return TagKey.of(RegistryKeys.BLOCK, Identifier.of(MoreSpearEnchantments.MOD_ID, name));
|
||||
}
|
||||
}
|
||||
|
||||
public static class Items {
|
||||
public static final TagKey<Item> SPEARS = createTag("spears");
|
||||
|
||||
private static TagKey<Item> createTag(String name) {
|
||||
return TagKey.of(RegistryKeys.ITEM, Identifier.of(MoreSpearEnchantments.MOD_ID, name));
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 92 KiB |
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"enchantment.more_spear_enchantments.thundering": "Storm o' Thunder",
|
||||
"enchantment.more_spear_enchantments.withering": "Rot o' Doom",
|
||||
"enchantment.more_spear_enchantments.crippling": "Crippled Legs",
|
||||
"enchantment.more_spear_enchantments.poisoning": "Venom'd Blade"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"enchantment.more_spear_enchantments.thundering": "ƃuᴉɹǝpunɥꓕ",
|
||||
"enchantment.more_spear_enchantments.withering": "ƃuᴉɹǝɥʇᴉM",
|
||||
"enchantment.more_spear_enchantments.crippling": "ƃuᴉlddᴉɹƆ",
|
||||
"enchantment.more_spear_enchantments.poisoning": "ƃuᴉuosuᴉԀ"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"enchantment.more_spear_enchantments.thundering": "Thundering",
|
||||
"enchantment.more_spear_enchantments.withering": "Withering",
|
||||
"enchantment.more_spear_enchantments.crippling": "Crippling",
|
||||
"enchantment.more_spear_enchantments.poisoning": "Poisoning"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"enchantment.more_spear_enchantments.thundering": "Tronante",
|
||||
"enchantment.more_spear_enchantments.withering": "Marchitante",
|
||||
"enchantment.more_spear_enchantments.crippling": "Lisiador",
|
||||
"enchantment.more_spear_enchantments.poisoning": "Envenenamiento"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"enchantment.more_spear_enchantments.thundering": "Tonnerre",
|
||||
"enchantment.more_spear_enchantments.withering": "Flétrissure",
|
||||
"enchantment.more_spear_enchantments.crippling": "Estropiant",
|
||||
"enchantment.more_spear_enchantments.poisoning": "Empoisonnement"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "dev.sillyangel.more_spear_enchantments.mixin",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"minVersion": "0.8",
|
||||
"client": [
|
||||
],
|
||||
"mixins": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user