From a3119578180356bbae7eff730e2b1e26f9fe630d Mon Sep 17 00:00:00 2001 From: SammySemicolon <69329424+SammySemicolon@users.noreply.github.com> Date: Thu, 23 Nov 2023 16:46:41 +0100 Subject: [PATCH] Cancer Ring --- gradle.properties | 2 +- src/generated/resources/.cache/cache | 2 +- .../resources/assets/malum/lang/en_us.json | 17 +++--- .../screen/codex/AbstractMalumScreen.java | 16 ++--- .../block/MalumBlockEntityInventory.java | 43 ++++++++++++++ .../spirit_altar/SpiritAltarBlockEntity.java | 9 +-- .../SpiritCrucibleCoreBlockEntity.java | 5 +- .../SpiritCatalyzerCoreBlockEntity.java | 3 +- .../storage/MalumItemHolderBlockEntity.java | 3 +- .../common/effect/GrowingFleshEffect.java | 19 ++++++ .../curios/weeping/CurioGrowingFleshRing.java | 23 ++++++- .../malum/core/handlers/SoulWardHandler.java | 56 +++++++++++------- .../java/com/sammy/malum/data/MalumLang.java | 6 +- .../registry/common/MobEffectRegistry.java | 1 + .../malum/registry/common/SoundRegistry.java | 6 +- src/main/resources/assets/malum/sounds.json | 6 +- .../textures/mob_effect/cancerous_growth.png | Bin 0 -> 435 bytes 17 files changed, 160 insertions(+), 57 deletions(-) create mode 100644 src/main/java/com/sammy/malum/common/block/MalumBlockEntityInventory.java create mode 100644 src/main/java/com/sammy/malum/common/effect/GrowingFleshEffect.java create mode 100644 src/main/resources/assets/malum/textures/mob_effect/cancerous_growth.png diff --git a/gradle.properties b/gradle.properties index 0b031b275..1aa3c427b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.daemon=false # Dependency Version minecraftVersion=1.18.2 forgeVersion=40.2.0 -lodestoneVersion=1.4.2.509 +lodestoneVersion=1.4.2.512 forgegradleVersion=5.1.53 mixingradleVersion=0.7-SNAPSHOT librarianVersion=1.+ diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index f36f7d182..9612b0cfd 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -219,7 +219,7 @@ cb6a17c4dca30d064eedc28529420373d25d1933 assets/malum/blockstates/wall_ether_tor 55635004672302336ef4a04dbe0d38dff66c4cd9 assets/malum/blockstates/weeping_well_core.json 55188decc0c9a982e5ba40f8df2adea65a032e32 assets/malum/blockstates/weeping_well_corner.json 62e007ecef751f8b9b42eaa138f06d18cc008d05 assets/malum/blockstates/weeping_well_side.json -f369ed947c43c3b9bc854f446e3d4d7711718682 assets/malum/lang/en_us.json +7b41bc2f9961161f15821f38176d8e57bff2d844 assets/malum/lang/en_us.json c2637401df2afc394d62b5c6bde312c604cdb21f assets/malum/models/block/blazing_quartz_ore.json 782e64739e04f0b87aa0aeafb55893cc348df504 assets/malum/models/block/blighted_earth.json c0b5a7b1d337a7090eaf86d07fd8b47d35fbc1e1 assets/malum/models/block/blighted_soil.json diff --git a/src/generated/resources/assets/malum/lang/en_us.json b/src/generated/resources/assets/malum/lang/en_us.json index 939dba19e..a86c2a5e4 100644 --- a/src/generated/resources/assets/malum/lang/en_us.json +++ b/src/generated/resources/assets/malum/lang/en_us.json @@ -226,25 +226,26 @@ "death.attack.scythe_sweep.player": "%s was sliced in twain by %s", "death.attack.voodoo": "%s's soul shattered", "death.attack.voodoo.player": "%s's soul was shattered by %s", - "effect.malum.aethers_charm": "Aether's Charm", + "effect.malum.aethers_charm": "Aether'''s Charm", "effect.malum.aethers_charm.description": "The heavens call for you, increasing jump height and decreasing gravity.", - "effect.malum.anglers_lure": "Angler's Lure", + "effect.malum.anglers_lure": "Angler'''s Lure", "effect.malum.anglers_lure.description": "Let any fish who meets my gaze learn the true meaning of fear; for I am the harbinger of death. The bane of creatures sub-aqueous, my rod is true and unwavering as I cast into the aquatic abyss. A man, scorned by this uncaring Earth, finds solace in the sea. My only friend, the worm upon my hook. Wriggling, writhing, struggling to surmount the mortal pointlessness that permeates this barren world. I am alone. I am empty. And yet, I fish.", + "effect.malum.cancerous_growth": "Cancerou'''s Growth", "effect.malum.earthen_might": "Earthen Might", "effect.malum.earthen_might.description": "Your fists and tools are reinforced with earth, increasing your overall damage.", "effect.malum.gaian_bulwark": "Gaian Bulwark", "effect.malum.gaian_bulwark.description": "You are protected by an earthen bulwark, increasing your armor.", "effect.malum.gluttony": "Gluttony", "effect.malum.gluttony.description": "You feed on the vulnerable, increasing scythe proficiency and gradually restoring lost hunger.", - "effect.malum.ifrits_embrace": "Ifrit's Embrace", + "effect.malum.ifrits_embrace": "Ifrit'''s Embrace", "effect.malum.ifrits_embrace.description": "The warm embrace of fire coats your soul, mending your seared scars.", - "effect.malum.miners_rage": "Miner's Rage", + "effect.malum.miners_rage": "Miner'''s Rage", "effect.malum.miners_rage.description": "Your tools are bolstered with radiance, increasing your mining and attack speed.", - "effect.malum.poseidons_grasp": "Poseidon's Grasp", + "effect.malum.poseidons_grasp": "Poseidon'''s Grasp", "effect.malum.poseidons_grasp.description": "You reach out for further power, increasing your reach and item pickup distance.", "effect.malum.rejected": "Rejected", "effect.malum.wicked_intent": "Wicked Intent", - "effect.malum.zephyrs_courage": "Zephyr's Courage", + "effect.malum.zephyrs_courage": "Zephyr'''s Courage", "effect.malum.zephyrs_courage.description": "The zephyr propels you forward, increasing your movement speed.", "enchantment.malum.haunted": "Haunted", "enchantment.malum.haunted.desc": "Deals extra magic damage.", @@ -890,6 +891,7 @@ "malum.subtitle.deepslate_soulstone_step": "Footsteps", "malum.subtitle.ether_break": "Block broken", "malum.subtitle.ether_place": "Block placed", + "malum.subtitle.flesh_ring_absorbs": "Flesh ring absorbs", "malum.subtitle.gilded_trinket_equipped": "Gilded trinket equipped", "malum.subtitle.hallowed_gold_break": "Block broken", "malum.subtitle.hallowed_gold_hit": "Block breaking", @@ -921,8 +923,9 @@ "malum.subtitle.soul_stained_steel_hit": "Block breaking", "malum.subtitle.soul_stained_steel_place": "Block placed", "malum.subtitle.soul_stained_steel_step": "Footsteps", - "malum.subtitle.soul_ward_charges": "Soul ward charges", + "malum.subtitle.soul_ward_charged": "Soul ward charged", "malum.subtitle.soul_ward_damaged": "Soul ward damaged", + "malum.subtitle.soul_ward_depleted": "Soul ward depleted", "malum.subtitle.soul_ward_grows": "Soul ward grows", "malum.subtitle.soulstone_break": "Block broken", "malum.subtitle.soulstone_hit": "Block breaking", diff --git a/src/main/java/com/sammy/malum/client/screen/codex/AbstractMalumScreen.java b/src/main/java/com/sammy/malum/client/screen/codex/AbstractMalumScreen.java index f568344f1..479a1d22f 100644 --- a/src/main/java/com/sammy/malum/client/screen/codex/AbstractMalumScreen.java +++ b/src/main/java/com/sammy/malum/client/screen/codex/AbstractMalumScreen.java @@ -19,22 +19,18 @@ protected AbstractMalumScreen(Component pTitle) { public abstract Supplier getSweetenerSound(); public void playPageFlipSound(Supplier soundEvent, float pitch) { - playSound(soundEvent, Math.max(1, pitch * 0.8f)); - playSound(getSweetenerSound(), pitch); + playSound(soundEvent, 1, Math.max(1, pitch * 0.8f)); + playSound(getSweetenerSound(), 0.2f, pitch); } public void playSweetenedSound(Supplier soundEvent, float sweetenerPitch) { - playSound(soundEvent); - playSound(getSweetenerSound(), sweetenerPitch); + playSound(soundEvent, 1, 1); + playSound(getSweetenerSound(), 0.2f, sweetenerPitch); } - public void playSound(Supplier soundEvent) { - playSound(soundEvent, 1); - } - - public void playSound(Supplier soundEvent, float pitch) { + public void playSound(Supplier soundEvent, float volume, float pitch) { Player playerEntity = Minecraft.getInstance().player; - playerEntity.playNotifySound(soundEvent.get(), SoundSource.PLAYERS, 1f, pitch); + playerEntity.playNotifySound(soundEvent.get(), SoundSource.PLAYERS, volume, pitch); } @Override diff --git a/src/main/java/com/sammy/malum/common/block/MalumBlockEntityInventory.java b/src/main/java/com/sammy/malum/common/block/MalumBlockEntityInventory.java new file mode 100644 index 000000000..2f97a3f73 --- /dev/null +++ b/src/main/java/com/sammy/malum/common/block/MalumBlockEntityInventory.java @@ -0,0 +1,43 @@ +package com.sammy.malum.common.block; + +import com.sammy.malum.common.item.spirit.*; +import com.sammy.malum.registry.common.*; +import net.minecraft.sounds.*; +import net.minecraft.world.entity.player.*; +import net.minecraft.world.item.*; +import net.minecraft.world.level.*; +import team.lodestar.lodestone.helpers.*; +import team.lodestar.lodestone.systems.blockentity.*; + +import java.util.function.*; + +public class MalumBlockEntityInventory extends LodestoneBlockEntityInventory { + public MalumBlockEntityInventory(int slotCount, int allowedItemSize, Predicate inputPredicate, Predicate outputPredicate) { + super(slotCount, allowedItemSize, inputPredicate, outputPredicate); + } + + public MalumBlockEntityInventory(int slotCount, int allowedItemSize, Predicate inputPredicate) { + super(slotCount, allowedItemSize, inputPredicate); + } + + public MalumBlockEntityInventory(int slotCount, int allowedItemSize) { + super(slotCount, allowedItemSize); + } + + @Override + public void extractItem(Player playerEntity, ItemStack stack, int slot) { + super.extractItem(playerEntity, stack, slot); + SoundEvent soundEvent = stack.getItem() instanceof SpiritShardItem ? SoundRegistry.PEDESTAL_SPIRIT_PICKUP.get() : SoundRegistry.PEDESTAL_ITEM_PICKUP.get(); + playerEntity.level.playSound(null, playerEntity.blockPosition(), soundEvent, SoundSource.BLOCKS, 0.7f, RandomHelper.randomBetween(playerEntity.level.random, 0.8f, 1.2f)); + } + + @Override + public ItemStack insertItem(Player playerEntity, ItemStack stack) { + final ItemStack result = super.insertItem(playerEntity, stack); + if (!result.isEmpty()) { + SoundEvent soundEvent = result.getItem() instanceof SpiritShardItem ? SoundRegistry.PEDESTAL_SPIRIT_INSERT.get() : SoundRegistry.PEDESTAL_ITEM_INSERT.get(); + playerEntity.level.playSound(null, playerEntity.blockPosition(), soundEvent, SoundSource.BLOCKS, 0.7f, RandomHelper.randomBetween(playerEntity.level.random, 0.8f, 1.2f)); + } + return result; + } +} diff --git a/src/main/java/com/sammy/malum/common/block/curiosities/spirit_altar/SpiritAltarBlockEntity.java b/src/main/java/com/sammy/malum/common/block/curiosities/spirit_altar/SpiritAltarBlockEntity.java index 6c1270399..859ca57ff 100644 --- a/src/main/java/com/sammy/malum/common/block/curiosities/spirit_altar/SpiritAltarBlockEntity.java +++ b/src/main/java/com/sammy/malum/common/block/curiosities/spirit_altar/SpiritAltarBlockEntity.java @@ -1,5 +1,6 @@ package com.sammy.malum.common.block.curiosities.spirit_altar; +import com.sammy.malum.common.block.*; import com.sammy.malum.common.block.storage.*; import com.sammy.malum.common.item.spirit.*; import com.sammy.malum.common.recipe.*; @@ -68,7 +69,7 @@ public SpiritAltarBlockEntity(BlockEntityType public SpiritAltarBlockEntity(BlockPos pos, BlockState state) { super(BlockEntityRegistry.SPIRIT_ALTAR.get(), pos, state); - inventory = new LodestoneBlockEntityInventory(1, 64, t -> !(t.getItem() instanceof SpiritShardItem)) { + inventory = new MalumBlockEntityInventory(1, 64, t -> !(t.getItem() instanceof SpiritShardItem)) { @Override public void onContentsChanged(int slot) { super.onContentsChanged(slot); @@ -76,14 +77,14 @@ public void onContentsChanged(int slot) { BlockHelper.updateAndNotifyState(level, worldPosition); } }; - extrasInventory = new LodestoneBlockEntityInventory(8, 1) { + extrasInventory = new MalumBlockEntityInventory(8, 1) { @Override public void onContentsChanged(int slot) { super.onContentsChanged(slot); BlockHelper.updateAndNotifyState(level, worldPosition); } }; - spiritInventory = new LodestoneBlockEntityInventory(SpiritTypeRegistry.SPIRITS.size(), 64) { + spiritInventory = new MalumBlockEntityInventory(SpiritTypeRegistry.SPIRITS.size(), 64) { @Override public void onContentsChanged(int slot) { super.onContentsChanged(slot); @@ -265,7 +266,7 @@ public boolean consume() { if (matches) { level.playSound(null, provider.getAccessPointBlockPos(), SoundRegistry.ALTAR_CONSUME.get(), SoundSource.BLOCKS, 1, 0.9f + level.random.nextFloat() * 0.2f); ParticleEffectTypeRegistry.SPIRIT_ALTAR_EATS_ITEM.createPositionedEffect(level, new PositionEffectData(worldPosition), ColorEffectData.fromRecipe(recipe.spirits), SpiritAltarEatItemParticleEffect.createData(provider.getAccessPointBlockPos(), providedStack)); - extrasInventory.insertItem(level, providedStack.split(requestedItem.count)); + extrasInventory.insertItem(providedStack.split(requestedItem.count)); inventoryForAltar.updateData(); BlockHelper.updateAndNotifyState(level, provider.getAccessPointBlockPos()); break; diff --git a/src/main/java/com/sammy/malum/common/block/curiosities/spirit_crucible/SpiritCrucibleCoreBlockEntity.java b/src/main/java/com/sammy/malum/common/block/curiosities/spirit_crucible/SpiritCrucibleCoreBlockEntity.java index dea059233..122d299d0 100644 --- a/src/main/java/com/sammy/malum/common/block/curiosities/spirit_crucible/SpiritCrucibleCoreBlockEntity.java +++ b/src/main/java/com/sammy/malum/common/block/curiosities/spirit_crucible/SpiritCrucibleCoreBlockEntity.java @@ -1,5 +1,6 @@ package com.sammy.malum.common.block.curiosities.spirit_crucible; +import com.sammy.malum.common.block.*; import com.sammy.malum.core.systems.spirit.*; import com.sammy.malum.visual_effects.*; import com.sammy.malum.common.item.impetus.ImpetusItem; @@ -75,7 +76,7 @@ public class SpiritCrucibleCoreBlockEntity extends MultiBlockCoreEntity implemen public SpiritCrucibleCoreBlockEntity(BlockEntityType type, MultiBlockStructure structure, BlockPos pos, BlockState state) { super(type, structure, pos, state); - inventory = new LodestoneBlockEntityInventory(1, 1, t -> !(t.getItem() instanceof SpiritShardItem)) { + inventory = new MalumBlockEntityInventory(1, 1, t -> !(t.getItem() instanceof SpiritShardItem)) { @Override public void onContentsChanged(int slot) { super.onContentsChanged(slot); @@ -83,7 +84,7 @@ public void onContentsChanged(int slot) { BlockHelper.updateAndNotifyState(level, worldPosition); } }; - spiritInventory = new LodestoneBlockEntityInventory(4, 64) { + spiritInventory = new MalumBlockEntityInventory(4, 64) { @Override public void onContentsChanged(int slot) { super.onContentsChanged(slot); diff --git a/src/main/java/com/sammy/malum/common/block/curiosities/spirit_crucible/catalyzer/SpiritCatalyzerCoreBlockEntity.java b/src/main/java/com/sammy/malum/common/block/curiosities/spirit_crucible/catalyzer/SpiritCatalyzerCoreBlockEntity.java index fb56cd8e1..5d0516c61 100644 --- a/src/main/java/com/sammy/malum/common/block/curiosities/spirit_crucible/catalyzer/SpiritCatalyzerCoreBlockEntity.java +++ b/src/main/java/com/sammy/malum/common/block/curiosities/spirit_crucible/catalyzer/SpiritCatalyzerCoreBlockEntity.java @@ -1,5 +1,6 @@ package com.sammy.malum.common.block.curiosities.spirit_crucible.catalyzer; +import com.sammy.malum.common.block.*; import com.sammy.malum.common.block.curiosities.spirit_crucible.*; import com.sammy.malum.common.item.spirit.SpiritShardItem; import com.sammy.malum.core.systems.spirit.*; @@ -51,7 +52,7 @@ public class SpiritCatalyzerCoreBlockEntity extends MultiBlockCoreEntity impleme public SpiritCatalyzerCoreBlockEntity(BlockEntityType type, MultiBlockStructure structure, BlockPos pos, BlockState state) { super(type, structure, pos, state); - inventory = new LodestoneBlockEntityInventory(1, 64, t -> !(t.getItem() instanceof SpiritShardItem)) { + inventory = new MalumBlockEntityInventory(1, 64, t -> !(t.getItem() instanceof SpiritShardItem)) { @Override public void onContentsChanged(int slot) { super.onContentsChanged(slot); diff --git a/src/main/java/com/sammy/malum/common/block/storage/MalumItemHolderBlockEntity.java b/src/main/java/com/sammy/malum/common/block/storage/MalumItemHolderBlockEntity.java index 1a3e7ac08..d80357e52 100644 --- a/src/main/java/com/sammy/malum/common/block/storage/MalumItemHolderBlockEntity.java +++ b/src/main/java/com/sammy/malum/common/block/storage/MalumItemHolderBlockEntity.java @@ -1,5 +1,6 @@ package com.sammy.malum.common.block.storage; +import com.sammy.malum.common.block.*; import com.sammy.malum.common.item.spirit.*; import com.sammy.malum.core.systems.spirit.*; import com.sammy.malum.visual_effects.*; @@ -14,7 +15,7 @@ public abstract class MalumItemHolderBlockEntity extends ItemHolderBlockEntity i public MalumItemHolderBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state); - inventory = new LodestoneBlockEntityInventory(1, 64) { + inventory = new MalumBlockEntityInventory(1, 64) { @Override public void onContentsChanged(int slot) { super.onContentsChanged(slot); diff --git a/src/main/java/com/sammy/malum/common/effect/GrowingFleshEffect.java b/src/main/java/com/sammy/malum/common/effect/GrowingFleshEffect.java new file mode 100644 index 000000000..0688aefd2 --- /dev/null +++ b/src/main/java/com/sammy/malum/common/effect/GrowingFleshEffect.java @@ -0,0 +1,19 @@ +package com.sammy.malum.common.effect; + +import net.minecraft.world.effect.*; +import net.minecraft.world.entity.*; +import net.minecraft.world.entity.ai.attributes.*; +import team.lodestar.lodestone.helpers.*; + +import java.awt.*; + +public class GrowingFleshEffect extends MobEffect { + public GrowingFleshEffect() { + super(MobEffectCategory.BENEFICIAL, ColorHelper.getColor(new Color(126, 25, 95))); + addAttributeModifier(Attributes.MAX_HEALTH, "04448cbf-ee2c-4f36-b71f-e641a312834a", 0.05f, AttributeModifier.Operation.MULTIPLY_TOTAL); + } + + @Override + public void applyEffectTick(LivingEntity entityLivingBaseIn, int amplifier) { + } +} \ No newline at end of file diff --git a/src/main/java/com/sammy/malum/common/item/curiosities/curios/weeping/CurioGrowingFleshRing.java b/src/main/java/com/sammy/malum/common/item/curiosities/curios/weeping/CurioGrowingFleshRing.java index 2bb13247e..0d49f26f3 100644 --- a/src/main/java/com/sammy/malum/common/item/curiosities/curios/weeping/CurioGrowingFleshRing.java +++ b/src/main/java/com/sammy/malum/common/item/curiosities/curios/weeping/CurioGrowingFleshRing.java @@ -2,9 +2,30 @@ import com.sammy.malum.common.item.curiosities.curios.*; import com.sammy.malum.core.systems.item.*; +import com.sammy.malum.registry.common.*; +import net.minecraft.sounds.*; +import net.minecraft.world.effect.*; +import net.minecraft.world.entity.*; +import net.minecraft.world.item.*; +import net.minecraft.world.level.*; +import team.lodestar.lodestone.helpers.*; -public class CurioGrowingFleshRing extends MalumCurioItem implements IVoidItem { +public class CurioGrowingFleshRing extends MalumCurioItem implements IVoidItem, IMalumEventResponderItem { public CurioGrowingFleshRing(Properties builder) { super(builder, MalumTrinketType.VOID); } + + @Override + public void pickupSpirit(LivingEntity collector, ItemStack stack, double arcaneResonance) { + MobEffect cancerousGrowth = MobEffectRegistry.CANCEROUS_GROWTH.get(); + MobEffectInstance effect = collector.getEffect(cancerousGrowth); + if (effect == null) { + collector.addEffect(new MobEffectInstance(cancerousGrowth, 1200, 0, true, true, true)); + } else { + EntityHelper.extendEffect(effect, collector, (int) (1200+arcaneResonance*600), 144000); + EntityHelper.amplifyEffect(effect, collector, 1, 19); + } + Level level = collector.level; + level.playSound(null, collector.blockPosition(), SoundRegistry.FLESH_RING_ABSORBS.get(), SoundSource.PLAYERS, 0.3f, 1.5f + level.random.nextFloat() * 0.5f); + } } \ No newline at end of file diff --git a/src/main/java/com/sammy/malum/core/handlers/SoulWardHandler.java b/src/main/java/com/sammy/malum/core/handlers/SoulWardHandler.java index 54624c04e..d9ec7134b 100644 --- a/src/main/java/com/sammy/malum/core/handlers/SoulWardHandler.java +++ b/src/main/java/com/sammy/malum/core/handlers/SoulWardHandler.java @@ -14,7 +14,7 @@ import net.minecraft.client.player.LocalPlayer; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; -import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.*; import net.minecraft.util.Mth; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.ai.attributes.AttributeInstance; @@ -53,21 +53,27 @@ public void deserializeNBT(CompoundTag tag) { public static void recoverSoulWard(TickEvent.PlayerTickEvent event) { Player player = event.player; - SoulWardHandler soulWardHandler = MalumPlayerDataCapability.getCapability(player).soulWardHandler; - AttributeInstance soulWardCap = player.getAttribute(AttributeRegistry.SOUL_WARD_CAP.get()); - - if (soulWardCap != null) { - if (soulWardHandler.soulWard < soulWardCap.getValue() && soulWardHandler.soulWardProgress <= 0) { - soulWardHandler.soulWard++; - if (player.level.isClientSide && !player.isCreative()) { - player.playSound(soulWardHandler.soulWard >= soulWardCap.getValue() ? SoundRegistry.SOUL_WARD_CHARGE.get() : SoundRegistry.SOUL_WARD_GROW.get(), 1, Mth.nextFloat(player.getRandom(), 0.6f, 1.4f)); + if (!player.level.isClientSide) { + SoulWardHandler soulWardHandler = MalumPlayerDataCapability.getCapability(player).soulWardHandler; + AttributeInstance soulWardCap = player.getAttribute(AttributeRegistry.SOUL_WARD_CAP.get()); + + if (soulWardCap != null) { + if (soulWardHandler.soulWard < soulWardCap.getValue() && soulWardHandler.soulWardProgress <= 0) { + soulWardHandler.soulWard++; + if (!player.isCreative()) { + SoundEvent sound = soulWardHandler.soulWard >= soulWardCap.getValue() ? SoundRegistry.SOUL_WARD_CHARGE.get() : SoundRegistry.SOUL_WARD_GROW.get(); + float pitch = 1f + (soulWardHandler.soulWard / (float) soulWardCap.getValue()) * 0.5f + (Mth.ceil(soulWardHandler.soulWard) % 3) * 0.25f; + player.level.playSound(null, player.blockPosition(), sound, SoundSource.PLAYERS, 1, pitch); + } + soulWardHandler.soulWardProgress = getSoulWardCooldown(player); + MalumPlayerDataCapability.syncTrackingAndSelf(player); + } else { + soulWardHandler.soulWardProgress--; + } + if (soulWardHandler.soulWard > soulWardCap.getValue()) { + soulWardHandler.soulWard = (float) soulWardCap.getValue(); + MalumPlayerDataCapability.syncTrackingAndSelf(player); } - soulWardHandler.soulWardProgress = getSoulWardCooldown(player); - } else { - soulWardHandler.soulWardProgress--; - } - if (soulWardHandler.soulWard > soulWardCap.getValue()) { - soulWardHandler.soulWard = (float) soulWardCap.getValue(); } } } @@ -78,8 +84,8 @@ public static void shieldPlayer(LivingHurtEvent event) { } if (event.getEntityLiving() instanceof Player player) { if (!player.level.isClientSide) { - SoulWardHandler soulWardHandler = MalumPlayerDataCapability.getCapability(player).soulWardHandler; - soulWardHandler.soulWardProgress = getSoulWardCooldown(0) + getSoulWardCooldown(player); + SoulWardHandler soulWardHandler = MalumPlayerDataCapability.getCapability(player).soulWardHandler; + soulWardHandler.soulWardProgress = getSoulWardCooldown(0) + getSoulWardCooldown(player); if (soulWardHandler.soulWard > 0) { DamageSource source = event.getSource(); @@ -107,7 +113,8 @@ public static void shieldPlayer(LivingHurtEvent event) { eventItem.onSoulwardAbsorbDamage(event, player, s, soulwardLost, absorbed); } } - player.level.playSound(null, player.blockPosition(), SoundRegistry.SOUL_WARD_HIT.get(), SoundSource.PLAYERS, 1, Mth.nextFloat(player.getRandom(), 1.5f, 2f)); + SoundEvent sound = soulWardHandler.soulWard == 0 ? SoundRegistry.SOUL_WARD_DEPLETE.get() : SoundRegistry.SOUL_WARD_HIT.get(); + player.level.playSound(null, player.blockPosition(), sound, SoundSource.PLAYERS, 1, Mth.nextFloat(player.getRandom(), 1f, 1.5f)); event.setAmount(result); MalumPlayerDataCapability.syncTrackingAndSelf(player); @@ -138,7 +145,8 @@ public static void renderSoulWard(ForgeIngameGui gui, PoseStack poseStack, int w LocalPlayer player = minecraft.player; if (!player.isCreative() && !player.isSpectator()) { SoulWardHandler soulWardHandler = MalumPlayerDataCapability.getCapability(player).soulWardHandler; - if (soulWardHandler.soulWard > 0) { + final float soulWard = soulWardHandler.soulWard; + if (soulWard > 0) { float absorb = Mth.ceil(player.getAbsorptionAmount()); float maxHealth = (float) player.getAttribute(Attributes.MAX_HEALTH).getValue(); float armor = (float) player.getAttribute(Attributes.ARMOR).getValue(); @@ -167,12 +175,14 @@ public static void renderSoulWard(ForgeIngameGui gui, PoseStack poseStack, int w .setShader(() -> shaderInstance); int size = 13; - for (int i = 0; i < Math.ceil(Math.floor(soulWardHandler.soulWard) / 3f); i++) { - int row = (int) (Math.ceil(i) / 10f); + boolean forceDisplay = soulWard <= 1; + double soulWardAmount = forceDisplay ? 1 : Math.ceil(Math.floor(soulWard) / 3f); + for (int i = 0; i < soulWardAmount; i++) { + int row = (int) (i / 10f); int x = left + i % 10 * 8; int y = top - row * 4 + rowHeight * 2 - 15; - int progress = Math.min(3, (int) soulWardHandler.soulWard - i * 3); - int xTextureOffset = 1 + (3 - progress) * 15; + int progress = Math.min(3, (int) soulWard - i * 3); + int xTextureOffset = forceDisplay ? 31 : 1 + (3 - progress) * 15; shaderInstance.safeGetUniform("UVCoordinates").set(new Vector4f(xTextureOffset / 45f, (xTextureOffset + size) / 45f, 0, 15 / 45f)); shaderInstance.safeGetUniform("TimeOffset").set(i * 150f); diff --git a/src/main/java/com/sammy/malum/data/MalumLang.java b/src/main/java/com/sammy/malum/data/MalumLang.java index 062de7ada..48b013441 100644 --- a/src/main/java/com/sammy/malum/data/MalumLang.java +++ b/src/main/java/com/sammy/malum/data/MalumLang.java @@ -93,7 +93,11 @@ protected void addTranslations() { }); effects.forEach(e -> { - String alteredPath = e.getId().getPath().replaceFirst("s_", "'s_"); + String[] replacements = new String[]{"ns_", "rs_", "ts_"}; + String alteredPath = e.getId().getPath(); + for (String replacement : replacements) { + alteredPath = alteredPath.replaceFirst("s_", "'s_"); + } String name = DataHelper.toTitleCase(alteredPath, "_"); add("effect.malum." + e.get().getRegistryName().getPath(), name); }); diff --git a/src/main/java/com/sammy/malum/registry/common/MobEffectRegistry.java b/src/main/java/com/sammy/malum/registry/common/MobEffectRegistry.java index 4eb1dac7b..f41b2d616 100644 --- a/src/main/java/com/sammy/malum/registry/common/MobEffectRegistry.java +++ b/src/main/java/com/sammy/malum/registry/common/MobEffectRegistry.java @@ -35,6 +35,7 @@ public class MobEffectRegistry { public static final RegistryObject ANGLERS_LURE = EFFECTS.register("anglers_lure", CorruptedAqueousAura::new); public static final RegistryObject GLUTTONY = attachAlchemicalProficiency(EFFECTS.register("gluttony", GluttonyEffect::new), 0.5f); + public static final RegistryObject CANCEROUS_GROWTH = EFFECTS.register("cancerous_growth", GrowingFleshEffect::new); public static final RegistryObject WICKED_INTENT = attachAlchemicalProficiency(EFFECTS.register("wicked_intent", WickedIntentEffect::new), 0.2f); public static final RegistryObject REJECTED = EFFECTS.register("rejected", RejectedEffect::new); diff --git a/src/main/java/com/sammy/malum/registry/common/SoundRegistry.java b/src/main/java/com/sammy/malum/registry/common/SoundRegistry.java index 6c797264e..e650377cc 100644 --- a/src/main/java/com/sammy/malum/registry/common/SoundRegistry.java +++ b/src/main/java/com/sammy/malum/registry/common/SoundRegistry.java @@ -41,8 +41,6 @@ public class SoundRegistry { public static final RegistryObject METALLIC_TRINKET_EQUIP = register(new SoundEvent(MalumMod.malumPath("metallic_trinket_equipped"))); public static final RegistryObject VOID_TRINKET_EQUIP = register(new SoundEvent(MalumMod.malumPath("void_trinket_equipped"))); - - public static final RegistryObject ARCANE_WHISPERS = register(new SoundEvent(MalumMod.malumPath("arcane_whispers"))); public static final RegistryObject SPIRIT_PICKUP = register(new SoundEvent(MalumMod.malumPath("spirit_picked_up"))); public static final RegistryObject SOUL_SHATTER = register(new SoundEvent(MalumMod.malumPath("a_soul_shatters"))); @@ -77,12 +75,14 @@ public class SoundRegistry { public static final RegistryObject VOID_SLASH = register(new SoundEvent(MalumMod.malumPath("void_slash_swooshes"))); public static final RegistryObject HIDDEN_BLADE_STRIKES = register(new SoundEvent(MalumMod.malumPath("hidden_blade_strikes"))); public static final RegistryObject HUNGRY_BELT_FEEDS = register(new SoundEvent(MalumMod.malumPath("hungry_belt_feeds"))); + public static final RegistryObject FLESH_RING_ABSORBS = register(new SoundEvent(MalumMod.malumPath("flesh_ring_absorbs"))); public static final RegistryObject NITRATE_THROWN = register(new SoundEvent(MalumMod.malumPath("nitrate_thrown"))); public static final RegistryObject SPIRIT_MOTE_CREATED = register(new SoundEvent(MalumMod.malumPath("spirit_mote_created"))); public static final RegistryObject SOUL_WARD_HIT = register(new SoundEvent(MalumMod.malumPath("soul_ward_damaged"))); public static final RegistryObject SOUL_WARD_GROW = register(new SoundEvent(MalumMod.malumPath("soul_ward_grows"))); - public static final RegistryObject SOUL_WARD_CHARGE = register(new SoundEvent(MalumMod.malumPath("soul_ward_charges"))); + public static final RegistryObject SOUL_WARD_CHARGE = register(new SoundEvent(MalumMod.malumPath("soul_ward_charged"))); + public static final RegistryObject SOUL_WARD_DEPLETE = register(new SoundEvent(MalumMod.malumPath("soul_ward_depleted"))); public static final RegistryObject SOULSTONE_BREAK = register(new SoundEvent(MalumMod.malumPath("soulstone_break"))); public static final RegistryObject SOULSTONE_PLACE = register(new SoundEvent(MalumMod.malumPath("soulstone_place"))); diff --git a/src/main/resources/assets/malum/sounds.json b/src/main/resources/assets/malum/sounds.json index 3b603d95b..c9dbcd2c4 100644 --- a/src/main/resources/assets/malum/sounds.json +++ b/src/main/resources/assets/malum/sounds.json @@ -56,13 +56,15 @@ "aerial_magic_swooshes": { "sounds":["minecraft:mob/phantom/flap1","minecraft:mob/phantom/flap2","minecraft:mob/phantom/flap3","minecraft:mob/phantom/flap4","minecraft:mob/phantom/flap5","minecraft:mob/phantom/flap6"], "subtitle": "malum.subtitle.aerial_magic_swooshes" }, "void_slash_swooshes": { "sounds":["malum:void_slash"], "subtitle": "malum.subtitle.void_slash_swooshes" }, "hungry_belt_feeds": { "sounds":["malum:curiosities/starved_belt/nom1", "malum:curiosities/starved_belt/nom2", "malum:curiosities/starved_belt/nom3", "malum:curiosities/starved_belt/nom4"], "subtitle": "malum.subtitle.hungry_belt_feeds" }, + "flesh_ring_absorbs": { "sounds":["malum:curiosities/cancer_ring/grow1", "malum:curiosities/cancer_ring/gro2", "malum:curiosities/cancer_ring/grow3"], "subtitle": "malum.subtitle.flesh_ring_absorbs" }, "hidden_blade_strikes": { "sounds":["malum:curiosities/hidden_blade/strike1", "malum:curiosities/hidden_blade/strike2", "malum:curiosities/hidden_blade/strike3"], "subtitle": "malum.subtitle.hidden_blade_strikes" }, "nitrate_thrown": { "sounds":["minecraft:random/bow"], "subtitle": "malum.subtitle.nitrate_thrown" }, "spirit_mote_created": { "sounds":["malum:curiosities/spirit_mote/created1", "malum:curiosities/spirit_mote/created2", "malum:curiosities/spirit_mote/created3"], "subtitle": "malum.subtitle.spirit_mote_created" }, "soul_ward_grows": { "sounds":["malum:curiosities/soul_ward/grow1","malum:curiosities/soul_ward/grow2","malum:curiosities/soul_ward/grow3","malum:curiosities/soul_ward/grow4"], "subtitle": "malum.subtitle.soul_ward_grows" }, - "soul_ward_damaged": { "sounds":["malum:curiosities/soul_ward/grow1","malum:curiosities/soul_ward/grow2","malum:curiosities/soul_ward/grow3","malum:curiosities/soul_ward/grow4"], "subtitle": "malum.subtitle.soul_ward_damaged" }, - "soul_ward_charges": { "sounds":["malum:curiosities/soul_ward/charge1","malum:curiosities/soul_ward/charge2"], "subtitle": "malum.subtitle.soul_ward_charges" }, + "soul_ward_damaged": { "sounds":["malum:curiosities/soul_ward/dmg1","malum:curiosities/soul_ward/dmg2","malum:curiosities/soul_ward/dmg3","malum:curiosities/soul_ward/dmg4"], "subtitle": "malum.subtitle.soul_ward_damaged" }, + "soul_ward_charged": { "sounds":["malum:curiosities/soul_ward/full1","malum:curiosities/soul_ward/full2"], "subtitle": "malum.subtitle.soul_ward_charged" }, + "soul_ward_depleted": { "sounds":["malum:curiosities/soul_ward/break1","malum:curiosities/soul_ward/break2"], "subtitle": "malum.subtitle.soul_ward_depleted" }, "the_deep_beckons": { "sounds":["malum:suspicious_sound"], "subtitle": "malum.subtitle.the_deep_beckons" }, "the_heavens_sing": { "sounds":["malum:heavenly_organs"], "subtitle": "malum.subtitle.the_heavens_sing" }, diff --git a/src/main/resources/assets/malum/textures/mob_effect/cancerous_growth.png b/src/main/resources/assets/malum/textures/mob_effect/cancerous_growth.png new file mode 100644 index 0000000000000000000000000000000000000000..2e534bd6dcddc7e0b54189171249964bbb5faa35 GIT binary patch literal 435 zcmV;k0ZjghP)VuJ35El3x(H;5C<`+~>z!(_?_CwL z8Pb1hg4yl=_F@=@VGzs}Fhg|DF9U17Y#7C`Msf-R^ZPc27JhU528k<}{WoKgf`|Vm z{$hrvt4d&go%THjzmL6exgDR+pcsbYB9K8a=O1R11#5D6nF*%<3RZz#qw?b^n154p zD#J|n>)@~h@!