Skip to content

Commit

Permalink
Normalise names (again).
Browse files Browse the repository at this point in the history
  • Loading branch information
Provismet committed Jul 14, 2024
1 parent 4d79eda commit 00f5437
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* @param z The z component.
* @param strength The strength of the velocity vector. All values are multiplied by strength.
*/
public record ApplyVelocityEnchantmentEffect (double x, double y, double z, EnchantmentLevelBasedValue strength, boolean respectAttribute) implements EnchantmentEntityEffect {
public static final MapCodec<ApplyVelocityEnchantmentEffect> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(Codec.DOUBLE.fieldOf("x").forGetter(ApplyVelocityEnchantmentEffect::x), Codec.DOUBLE.fieldOf("y").forGetter(ApplyVelocityEnchantmentEffect::y), Codec.DOUBLE.fieldOf("z").forGetter(ApplyVelocityEnchantmentEffect::z), EnchantmentLevelBasedValue.CODEC.fieldOf("strength").forGetter(ApplyVelocityEnchantmentEffect::strength), Codec.BOOL.fieldOf("respect_knockback_resistance").forGetter(ApplyVelocityEnchantmentEffect::respectAttribute)).apply(instance, ApplyVelocityEnchantmentEffect::new));
public record ApplyVelocityEffect(double x, double y, double z, EnchantmentLevelBasedValue strength, boolean respectAttribute) implements EnchantmentEntityEffect {
public static final MapCodec<ApplyVelocityEffect> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(Codec.DOUBLE.fieldOf("x").forGetter(ApplyVelocityEffect::x), Codec.DOUBLE.fieldOf("y").forGetter(ApplyVelocityEffect::y), Codec.DOUBLE.fieldOf("z").forGetter(ApplyVelocityEffect::z), EnchantmentLevelBasedValue.CODEC.fieldOf("strength").forGetter(ApplyVelocityEffect::strength), Codec.BOOL.fieldOf("respect_knockback_resistance").forGetter(ApplyVelocityEffect::respectAttribute)).apply(instance, ApplyVelocityEffect::new));

@Override
public void apply (ServerWorld world, int level, EnchantmentEffectContext context, Entity entity, Vec3d pos) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* Applies frozen ticks to the target.
* @param duration The number of seconds to apply frozen ticks for. The entity gains {@code duration * 20} ticks.
*/
public record FreezeEnchantmentEffect (EnchantmentLevelBasedValue duration) implements EnchantmentEntityEffect {
public static final MapCodec<FreezeEnchantmentEffect> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(EnchantmentLevelBasedValue.CODEC.fieldOf("duration").forGetter(effect -> effect.duration)).apply(instance, FreezeEnchantmentEffect::new));
public record FreezeEffect(EnchantmentLevelBasedValue duration) implements EnchantmentEntityEffect {
public static final MapCodec<FreezeEffect> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(EnchantmentLevelBasedValue.CODEC.fieldOf("duration").forGetter(effect -> effect.duration)).apply(instance, FreezeEffect::new));

@Override
public void apply (ServerWorld world, int level, EnchantmentEffectContext context, Entity entity, Vec3d pos) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* Heals the entity. This cannot take the entity over its maximum health.
* @param value The amount of health to heal.
*/
public record HealEnchantmentEffect (EnchantmentLevelBasedValue value) implements EnchantmentEntityEffect {
public static final MapCodec<HealEnchantmentEffect> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(EnchantmentLevelBasedValue.CODEC.fieldOf("value").forGetter(HealEnchantmentEffect::value)).apply(instance, HealEnchantmentEffect::new));
public record HealEffect(EnchantmentLevelBasedValue value) implements EnchantmentEntityEffect {
public static final MapCodec<HealEffect> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(EnchantmentLevelBasedValue.CODEC.fieldOf("value").forGetter(HealEffect::value)).apply(instance, HealEffect::new));

@Override
public void apply (ServerWorld world, int level, EnchantmentEffectContext context, Entity entity, Vec3d pos) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

import com.mojang.serialization.MapCodec;
import com.provismet.CombatPlusCore.CPCMain;
import com.provismet.CombatPlusCore.enchantment.effect.singleEntity.ApplyVelocityEnchantmentEffect;
import com.provismet.CombatPlusCore.enchantment.effect.singleEntity.ApplyVelocityEffect;
import com.provismet.CombatPlusCore.enchantment.effect.singleEntity.CodeExecutionSingleEntityEffect;
import com.provismet.CombatPlusCore.enchantment.effect.singleEntity.DamageEquipmentEffect;
import com.provismet.CombatPlusCore.enchantment.effect.singleEntity.FreezeEnchantmentEffect;
import com.provismet.CombatPlusCore.enchantment.effect.singleEntity.HealEnchantmentEffect;
import com.provismet.CombatPlusCore.enchantment.effect.singleEntity.FreezeEffect;
import com.provismet.CombatPlusCore.enchantment.effect.singleEntity.HealEffect;
import net.minecraft.enchantment.effect.EnchantmentEntityEffect;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;

public class SingleEntityEffects {
public static void register () {
registerEntityEffect("code_execution_single_entity", CodeExecutionSingleEntityEffect.CODEC);
registerEntityEffect("freeze", FreezeEnchantmentEffect.CODEC);
registerEntityEffect("apply_velocity", ApplyVelocityEnchantmentEffect.CODEC);
registerEntityEffect("heal", HealEnchantmentEffect.CODEC);
registerEntityEffect("freeze", FreezeEffect.CODEC);
registerEntityEffect("apply_velocity", ApplyVelocityEffect.CODEC);
registerEntityEffect("heal", HealEffect.CODEC);
registerEntityEffect("damage_equipment", DamageEquipmentEffect.CODEC);
}

Expand Down

0 comments on commit 00f5437

Please sign in to comment.