diff --git a/src/generated/resources/.cache/73a0c150702b0db33c4f7a4031c7885e3223a862 b/src/generated/resources/.cache/73a0c150702b0db33c4f7a4031c7885e3223a862 index a7c7ec4f9..64829dbdd 100644 --- a/src/generated/resources/.cache/73a0c150702b0db33c4f7a4031c7885e3223a862 +++ b/src/generated/resources/.cache/73a0c150702b0db33c4f7a4031c7885e3223a862 @@ -1,4 +1,4 @@ -// 1.20.1 2024-02-18T23:17:23.6326183 Tags for minecraft:mob_effect mod id ars_nouveau +// 1.20.1 2024-04-28T11:08:37.1245583 Tags for minecraft:mob_effect mod id ars_nouveau 08d652bf70406a53ea8f4c794d20f054284765b9 data/ars_nouveau/tags/mob_effect/deny_dispel.json -35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/ars_nouveau/tags/mob_effect/to_sync.json +eeb33e305587ee0fddec8dfc8d9477b45bc45d7b data/ars_nouveau/tags/mob_effect/to_sync.json 0315b9264874191953c091e06cf2d340f81d6d67 data/ars_nouveau/tags/mob_effect/unstable_gifts.json diff --git a/src/generated/resources/assets/ars_nouveau/lang/en_us.json b/src/generated/resources/assets/ars_nouveau/lang/en_us.json index cd1285956..37a359360 100644 --- a/src/generated/resources/assets/ars_nouveau/lang/en_us.json +++ b/src/generated/resources/assets/ars_nouveau/lang/en_us.json @@ -217,7 +217,7 @@ "ars_nouveau.glyph_desc.glyph_bounce": "Gives players the Bounce effect, causing them to bounce upwards upon falling. Amplification of Bounce will preserve additional forward facing motion per bounce.", "ars_nouveau.glyph_desc.glyph_break": "A spell you start with. Breaks blocks of an average hardness. Can be amplified to increase the harvest level. Sensitive will simulate breaking blocks with Shears instead of a pickaxe.", "ars_nouveau.glyph_desc.glyph_cold_snap": "Causes wet, slowed, or freezing entities to take a burst of damage and erupt into falling ice. Falling ice will slow and damage nearby entities. Can also be used to erupt a block of ice instead. Falling blocks of ice can be manipulated with the Focus of Block Shaping. Entities afflicted with Freezing will be set to the maximum freeze level immediately.", - "ars_nouveau.glyph_desc.glyph_conjure_water": "Places water at a location or extinguishes entities on fire.", + "ars_nouveau.glyph_desc.glyph_conjure_water": "Places water at a location or extinguishes entities on fire. If augmented with extend time, it will keep entities wet for a longer period of time.", "ars_nouveau.glyph_desc.glyph_craft": "Opens the crafting menu.", "ars_nouveau.glyph_desc.glyph_crush": "Turns stone into gravel, and gravel into sand. Will also crush flowers into bonus dye. Need Sensitive to work on items. For full recipe support, see JEI. Will also harm entities and deals bonus damage to entities that are swimming.", "ars_nouveau.glyph_desc.glyph_cut": "Simulates using shears on entities and blocks, or damages non-shearable entities for a small amount. Amplify will simulate using an Axe instead of Shears. For simulating breaking with shears, see Break and Sensitive. Costs nothing.", diff --git a/src/generated/resources/data/ars_nouveau/tags/mob_effect/to_sync.json b/src/generated/resources/data/ars_nouveau/tags/mob_effect/to_sync.json index f72d209df..3833d1d19 100644 --- a/src/generated/resources/data/ars_nouveau/tags/mob_effect/to_sync.json +++ b/src/generated/resources/data/ars_nouveau/tags/mob_effect/to_sync.json @@ -1,3 +1,5 @@ { - "values": [] + "values": [ + "ars_nouveau:soggy" + ] } \ No newline at end of file diff --git a/src/main/java/com/hollingsworth/arsnouveau/common/datagen/PotionEffectTagProvider.java b/src/main/java/com/hollingsworth/arsnouveau/common/datagen/PotionEffectTagProvider.java index c8f05fe7e..33e34ec4c 100644 --- a/src/main/java/com/hollingsworth/arsnouveau/common/datagen/PotionEffectTagProvider.java +++ b/src/main/java/com/hollingsworth/arsnouveau/common/datagen/PotionEffectTagProvider.java @@ -31,6 +31,6 @@ protected void addTags(HolderLookup.Provider pProvider) { ); //placeholder to not leave the tag empty this.tag(PotionEffectTags.DISPEL_DENY).add(ModPotions.SUMMONING_SICKNESS_EFFECT.get()); - this.tag(PotionEffectTags.TO_SYNC); + this.tag(PotionEffectTags.TO_SYNC).add(ModPotions.SOAKED_EFFECT.get()); } } diff --git a/src/main/java/com/hollingsworth/arsnouveau/common/lib/LibPotions.java b/src/main/java/com/hollingsworth/arsnouveau/common/lib/LibPotions.java index 29e6548c5..500ff8ced 100644 --- a/src/main/java/com/hollingsworth/arsnouveau/common/lib/LibPotions.java +++ b/src/main/java/com/hollingsworth/arsnouveau/common/lib/LibPotions.java @@ -22,6 +22,7 @@ public class LibPotions { public static final String BLAST = "blasting"; public static final String FREEZING = "freezing"; public static final String DEFENCE = "shielding"; + public static final String SOAKED = "soaked"; public static String potion(String base) { return base + "_potion"; diff --git a/src/main/java/com/hollingsworth/arsnouveau/common/mixin/EntityMixin.java b/src/main/java/com/hollingsworth/arsnouveau/common/mixin/EntityMixin.java new file mode 100644 index 000000000..cbfa8bd7e --- /dev/null +++ b/src/main/java/com/hollingsworth/arsnouveau/common/mixin/EntityMixin.java @@ -0,0 +1,29 @@ +package com.hollingsworth.arsnouveau.common.mixin; + +import com.hollingsworth.arsnouveau.setup.registry.ModPotions; +import com.llamalad7.mixinextras.injector.ModifyReturnValue; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(Entity.class) +public class EntityMixin { + + @ModifyReturnValue(method = "isInWaterOrRain", at = @At("RETURN")) + private boolean ars_nouveau$isInWaterOrRain(boolean original) { + if (((Entity) (Object) this) instanceof LivingEntity livingEntity && livingEntity.hasEffect(ModPotions.SOAKED_EFFECT.get())) { + return true; + } + return original; + } + + @ModifyReturnValue(method = "setSecondsOnFire", at = @At("RETURN")) + private int ars_nouveau$setSecondsOnFire(int original) { + if (((Entity) (Object) this) instanceof LivingEntity livingEntity && livingEntity.hasEffect(ModPotions.SOAKED_EFFECT.get())) { + return 0; + } + return original; + } + +} diff --git a/src/main/java/com/hollingsworth/arsnouveau/common/potions/ParticleMobEffect.java b/src/main/java/com/hollingsworth/arsnouveau/common/potions/ParticleMobEffect.java index fa3121fb9..b3368eb4e 100644 --- a/src/main/java/com/hollingsworth/arsnouveau/common/potions/ParticleMobEffect.java +++ b/src/main/java/com/hollingsworth/arsnouveau/common/potions/ParticleMobEffect.java @@ -18,6 +18,11 @@ public void applyEffectTick(LivingEntity living, int amplifier) { } } + @Override + public boolean isDurationEffectTick(int pDuration, int pAmplifier) { + return pDuration > 0; + } + public abstract ParticleOptions getParticle(); public int getChance() { diff --git a/src/main/java/com/hollingsworth/arsnouveau/common/potions/SoggyEffect.java b/src/main/java/com/hollingsworth/arsnouveau/common/potions/SoggyEffect.java new file mode 100644 index 000000000..126f2170a --- /dev/null +++ b/src/main/java/com/hollingsworth/arsnouveau/common/potions/SoggyEffect.java @@ -0,0 +1,31 @@ +package com.hollingsworth.arsnouveau.common.potions; + +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.world.effect.MobEffectCategory; +import net.minecraft.world.entity.LivingEntity; + +public class SoggyEffect extends ParticleMobEffect { + + public SoggyEffect() { + super(MobEffectCategory.NEUTRAL, 0x0000FF); + } + + @Override + public void applyEffectTick(LivingEntity living, int amplifier) { + super.applyEffectTick(living, amplifier); + if (living.isOnFire()) { + living.clearFire(); + } + } + + @Override + public ParticleOptions getParticle() { + return ParticleTypes.DRIPPING_WATER; + } + + @Override + public int getChance() { + return 4; + } +} diff --git a/src/main/java/com/hollingsworth/arsnouveau/common/spell/effect/EffectConjureWater.java b/src/main/java/com/hollingsworth/arsnouveau/common/spell/effect/EffectConjureWater.java index b3cc0da08..d95029c3e 100644 --- a/src/main/java/com/hollingsworth/arsnouveau/common/spell/effect/EffectConjureWater.java +++ b/src/main/java/com/hollingsworth/arsnouveau/common/spell/effect/EffectConjureWater.java @@ -6,8 +6,12 @@ import com.hollingsworth.arsnouveau.common.items.curios.ShapersFocus; import com.hollingsworth.arsnouveau.common.lib.GlyphLib; import com.hollingsworth.arsnouveau.common.spell.augment.AugmentAOE; +import com.hollingsworth.arsnouveau.common.spell.augment.AugmentExtendTime; import com.hollingsworth.arsnouveau.common.spell.augment.AugmentPierce; +import com.hollingsworth.arsnouveau.common.spell.augment.AugmentSensitive; +import com.hollingsworth.arsnouveau.setup.registry.ModPotions; import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; @@ -19,12 +23,13 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.Vec3; +import net.minecraftforge.common.ForgeConfigSpec; import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.Set; -public class EffectConjureWater extends AbstractEffect { +public class EffectConjureWater extends AbstractEffect implements IPotionEffect { public static EffectConjureWater INSTANCE = new EffectConjureWater(); @@ -38,6 +43,13 @@ public void onResolveEntity(EntityHitResult rayTraceResult, Level world, @NotNul if (entity.isOnFire()) { entity.clearFire(); } + if (entity instanceof LivingEntity livingEntity && spellStats.getDurationMultiplier() > 0) { + applyConfigPotion(livingEntity, ModPotions.SOAKED_EFFECT.get(), spellStats); + } + if (spellStats.isSensitive() && !world.dimensionType().ultraWarm()) { + placeWater(world, shooter, spellContext, resolver, entity.blockPosition(), Direction.UP); + } + } @Override @@ -47,23 +59,27 @@ public void onResolveBlock(BlockHitResult rayTraceResult, Level world, @NotNull if (world.dimensionType().ultraWarm()) return; for (BlockPos pos1 : posList) { - if (!BlockUtil.destroyRespectsClaim(getPlayer(shooter, (ServerLevel) world), world, pos1)) - continue; - if(!world.isInWorldBounds(pos1)) - continue; - BlockState hitState = world.getBlockState(pos1); - if (hitState.getBlock() instanceof LiquidBlockContainer liquidBlockContainer && liquidBlockContainer.canPlaceLiquid(world, pos1, world.getBlockState(pos1), Fluids.WATER)) { - liquidBlockContainer.placeLiquid(world, pos1, hitState, Fluids.WATER.getSource(true)); - ShapersFocus.tryPropagateBlockSpell(new BlockHitResult( - new Vec3(pos1.getX(), pos1.getY(), pos1.getZ()), rayTraceResult.getDirection(), pos1, false - ), world, shooter, spellContext, resolver); - } else if (world.getBlockState(pos1.relative(rayTraceResult.getDirection())).canBeReplaced(Fluids.WATER)) { - pos1 = pos1.relative(rayTraceResult.getDirection()); - world.setBlockAndUpdate(pos1, Blocks.WATER.defaultBlockState()); - ShapersFocus.tryPropagateBlockSpell(new BlockHitResult( - new Vec3(pos1.getX(), pos1.getY(), pos1.getZ()), rayTraceResult.getDirection(), pos1, false - ), world, shooter, spellContext, resolver); - } + placeWater(world, shooter, spellContext, resolver, pos1, rayTraceResult.getDirection()); + } + } + + private void placeWater(Level world, @NotNull LivingEntity shooter, SpellContext spellContext, SpellResolver resolver, BlockPos pos1, Direction direction) { + if (!BlockUtil.destroyRespectsClaim(getPlayer(shooter, (ServerLevel) world), world, pos1)) + return; + if (!world.isInWorldBounds(pos1)) + return; + BlockState hitState = world.getBlockState(pos1); + if (hitState.getBlock() instanceof LiquidBlockContainer liquidBlockContainer && liquidBlockContainer.canPlaceLiquid(world, pos1, world.getBlockState(pos1), Fluids.WATER)) { + liquidBlockContainer.placeLiquid(world, pos1, hitState, Fluids.WATER.getSource(true)); + ShapersFocus.tryPropagateBlockSpell(new BlockHitResult( + new Vec3(pos1.getX(), pos1.getY(), pos1.getZ()), direction, pos1, false + ), world, shooter, spellContext, resolver); + } else if (world.getBlockState(pos1.relative(direction)).canBeReplaced(Fluids.WATER)) { + pos1 = pos1.relative(direction); + world.setBlockAndUpdate(pos1, Blocks.WATER.defaultBlockState()); + ShapersFocus.tryPropagateBlockSpell(new BlockHitResult( + new Vec3(pos1.getX(), pos1.getY(), pos1.getZ()), direction, pos1, false + ), world, shooter, spellContext, resolver); } } @@ -75,12 +91,12 @@ public int getDefaultManaCost() { @NotNull @Override public Set getCompatibleAugments() { - return augmentSetOf(AugmentAOE.INSTANCE, AugmentPierce.INSTANCE); + return augmentSetOf(AugmentAOE.INSTANCE, AugmentPierce.INSTANCE, AugmentExtendTime.INSTANCE, AugmentSensitive.INSTANCE); } @Override public String getBookDescription() { - return "Places water at a location or extinguishes entities on fire."; + return "Places water at a location or extinguishes entities on fire. If augmented with extend time, it will keep entities wet for a longer period of time."; } @Override @@ -93,4 +109,22 @@ public SpellTier defaultTier() { public Set getSchools() { return setOf(SpellSchools.ELEMENTAL_WATER); } + + + @Override + public int getBaseDuration() { + return POTION_TIME == null ? 30 : POTION_TIME.get(); + } + + @Override + public int getExtendTimeDuration() { + return EXTEND_TIME == null ? 10 : EXTEND_TIME.get(); + } + + @Override + public void buildConfig(ForgeConfigSpec.Builder builder) { + super.buildConfig(builder); + addPotionConfig(builder, 20); + addExtendTimeConfig(builder, 10); + } } diff --git a/src/main/java/com/hollingsworth/arsnouveau/common/spell/effect/EffectCrush.java b/src/main/java/com/hollingsworth/arsnouveau/common/spell/effect/EffectCrush.java index 248bdabcb..ce412bc39 100644 --- a/src/main/java/com/hollingsworth/arsnouveau/common/spell/effect/EffectCrush.java +++ b/src/main/java/com/hollingsworth/arsnouveau/common/spell/effect/EffectCrush.java @@ -11,7 +11,6 @@ import com.hollingsworth.arsnouveau.setup.registry.RecipeRegistry; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.level.ServerLevel; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.item.ItemEntity; @@ -54,7 +53,7 @@ public void onResolve(HitResult rayTraceResult, Level world, @NotNull LivingEnti @Override public void onResolveEntity(EntityHitResult rayTraceResult, Level level,@NotNull LivingEntity shooter, SpellStats spellStats, SpellContext spellContext, SpellResolver resolver) { - float damage = (float) ((rayTraceResult.getEntity().isSwimming() ? DAMAGE.get() * 3.0 : DAMAGE.get()) + AMP_VALUE.get() * spellStats.getAmpMultiplier()); + float damage = (float) ((rayTraceResult.getEntity().isUnderWater() ? DAMAGE.get() * 3.0 : DAMAGE.get()) + AMP_VALUE.get() * spellStats.getAmpMultiplier()); attemptDamage(level, shooter, spellStats, spellContext, resolver, rayTraceResult.getEntity(), buildDamageSource(level, shooter), damage); } diff --git a/src/main/java/com/hollingsworth/arsnouveau/setup/registry/ModPotions.java b/src/main/java/com/hollingsworth/arsnouveau/setup/registry/ModPotions.java index 8102182bd..fa018bf0d 100644 --- a/src/main/java/com/hollingsworth/arsnouveau/setup/registry/ModPotions.java +++ b/src/main/java/com/hollingsworth/arsnouveau/setup/registry/ModPotions.java @@ -63,6 +63,7 @@ public void addAttributeModifiers(LivingEntity pLivingEntity, AttributeMap pAttr } }); public static final RegistryObject IMMOLATE_EFFECT = EFFECTS.register(IMMOLATE, ImmolateEffect::new); + public static final RegistryObject SOAKED_EFFECT = EFFECTS.register(SOAKED, SoggyEffect::new); public static final RegistryObject BOUNCE_EFFECT = EFFECTS.register(BOUNCE, BounceEffect::new); public static final RegistryObject MAGIC_FIND_EFFECT = EFFECTS.register(MAGIC_FIND, MagicFindEffect::new); diff --git a/src/main/resources/ars_nouveau.mixins.json b/src/main/resources/ars_nouveau.mixins.json index d066fdf42..8cf4e13ac 100644 --- a/src/main/resources/ars_nouveau.mixins.json +++ b/src/main/resources/ars_nouveau.mixins.json @@ -19,6 +19,7 @@ "mixins": [ "CrossbowMixin", "DamageSourceMixin", + "EntityMixin", "LivingAccessor", "MobAccessor", "PotionRecipeMixin",