Skip to content

Commit

Permalink
Add unique runic bauble sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
IcarussOne committed Sep 3, 2024
1 parent b92e21d commit 87fe347
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/main/java/mod/icarus/crimsonrevelations/events/CREvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import baubles.api.BaublesApi;
import mod.icarus.crimsonrevelations.NewCrimsonRevelations;
import mod.icarus.crimsonrevelations.init.CRItems;
import mod.icarus.crimsonrevelations.init.CRSoundEvents;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
Expand All @@ -17,12 +18,10 @@
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import thaumcraft.common.lib.SoundsTC;

@EventBusSubscriber(modid = NewCrimsonRevelations.MODID)
@GameRegistry.ObjectHolder(NewCrimsonRevelations.MODID)
public class CREvents {
// TODO: Custom sounds
@SubscribeEvent
public static void onHurtEvent(LivingHurtEvent event) {
World world = event.getEntity().world;
Expand All @@ -35,7 +34,7 @@ public static void onHurtEvent(LivingHurtEvent event) {
// Kinetic Girdle of Shielding - Explodes when the Runic Shielding is pierced (20 second cooldown).
if (charge > 0) {
if (charge <= event.getAmount() && BaublesApi.isBaubleEquipped(player, CRItems.runicGirdleKinetic) > 2 && !(player.getCooldownTracker().hasCooldown(CRItems.runicGirdleKinetic))) {
player.world.playSound(null, player.posX, player.posY, player.posZ, SoundsTC.runicShieldEffect, SoundCategory.PLAYERS, 1.0F, 1.0F + (float) player.getEntityWorld().rand.nextGaussian() * 0.05F);
player.world.playSound(null, player.posX, player.posY, player.posZ, CRSoundEvents.RUNIC_BAUBLE_KINETIC, SoundCategory.PLAYERS, 0.8F, 1.0F);
player.world.createExplosion(player, player.posX, player.posY + player.height / 2.0F, player.posZ, 2.0F, false);

List<Entity> entities = player.world.getEntitiesWithinAABBExcludingEntity(player, player.getEntityBoundingBox().grow(3.0D, 3.0D, 3.0D));
Expand All @@ -53,25 +52,25 @@ public static void onHurtEvent(LivingHurtEvent event) {

// Revitalizing Ring of Shielding - Gives 6 seconds of Regeneration II when the Runic Shielding is pierced (20 second cooldown).
if (charge <= event.getAmount() && BaublesApi.isBaubleEquipped(player, CRItems.runicRingRegen) > 0 && !(player.getCooldownTracker().hasCooldown(CRItems.runicRingRegen))) {
player.world.playSound(null, player.posX, player.posY, player.posZ, SoundsTC.runicShieldEffect, SoundCategory.PLAYERS, 1.0F, 1.0F + (float) player.getEntityWorld().rand.nextGaussian() * 0.05F);
player.world.playSound(null, player.posX, player.posY, player.posZ, CRSoundEvents.RUNIC_BAUBLE_REGEN, SoundCategory.PLAYERS, 1.5F, 1.0F);
player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 6 * 20, 1, true, true));

((EntityPlayer) player).addStat(StatList.getObjectUseStats(CRItems.runicRingRegen));
((EntityPlayer) player).getCooldownTracker().setCooldown(CRItems.runicRingRegen, 20 * 20);
}

// Amulet of Emergency Shielding - Gives 8 points of Runic Shielding when the Runic Shielding is pierced (1 minute cooldown).
// Amulet of Emergency Shielding - Gives 8 points of Runic Shielding when the Runic Shielding is pierced (40 second cooldown).
if (charge <= event.getAmount() && BaublesApi.isBaubleEquipped(player, CRItems.runicAmuletEmergency) > -1 && !(player.getCooldownTracker().hasCooldown(CRItems.runicAmuletEmergency))) {
player.world.playSound(null, player.posX, player.posY, player.posZ, SoundsTC.runicShieldEffect, SoundCategory.PLAYERS, 1.0F, 1.0F + (float) player.getEntityWorld().rand.nextGaussian() * 0.05F);
player.world.playSound(null, player.posX, player.posY, player.posZ, CRSoundEvents.RUNIC_BAUBLE_EMERGENCY, SoundCategory.PLAYERS, 1.0F, 1.0F);
player.setAbsorptionAmount(charge + 8);

((EntityPlayer) player).addStat(StatList.getObjectUseStats(CRItems.runicAmuletEmergency));
((EntityPlayer) player).getCooldownTracker().setCooldown(CRItems.runicAmuletEmergency, 60 * 20);
((EntityPlayer) player).getCooldownTracker().setCooldown(CRItems.runicAmuletEmergency, 40 * 20);
}

// Charged Ring of Shielding - 25% chance to give 1 point of Runic Shielding, often restoring the Runic Shielding lost from damage.
if (BaublesApi.isBaubleEquipped(player, CRItems.runicRingCharged) > 0 && !(player.getCooldownTracker().hasCooldown(CRItems.runicRingCharged)) && player.world.rand.nextDouble() <= 0.25D) {
player.world.playSound(null, player.posX, player.posY, player.posZ, SoundsTC.runicShieldEffect, SoundCategory.PLAYERS, 1.0F, 1.0F + (float) player.getEntityWorld().rand.nextGaussian() * 0.05F);
player.world.playSound(null, player.posX, player.posY, player.posZ, CRSoundEvents.RUNIC_BAUBLE_CHARGE, SoundCategory.PLAYERS, 1.0F, 1.0F + (float) player.getEntityWorld().rand.nextGaussian() * 0.05F);
player.setAbsorptionAmount(charge + 1);

((EntityPlayer) player).addStat(StatList.getObjectUseStats(CRItems.runicRingCharged));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@
public class CRSoundEvents {
public static final SoundEvent FOCUS_BLINDING_LIGHT_HIT = new SoundEvent(new ResourceLocation(NewCrimsonRevelations.MODID, "focus.blinding_light.hit"));
public static final SoundEvent FOCUS_BLINDING_LIGHT_SHOOT = new SoundEvent(new ResourceLocation(NewCrimsonRevelations.MODID, "focus.blinding_light.shoot"));
public static final SoundEvent RUNIC_BAUBLE_CHARGE = new SoundEvent(new ResourceLocation(NewCrimsonRevelations.MODID, "bauble.runic.charge"));
public static final SoundEvent RUNIC_BAUBLE_EMERGENCY = new SoundEvent(new ResourceLocation(NewCrimsonRevelations.MODID, "bauble.runic.emergency"));
public static final SoundEvent RUNIC_BAUBLE_KINETIC = new SoundEvent(new ResourceLocation(NewCrimsonRevelations.MODID, "bauble.runic.kinetic"));
public static final SoundEvent RUNIC_BAUBLE_REGEN = new SoundEvent(new ResourceLocation(NewCrimsonRevelations.MODID, "bauble.runic.regen"));
}
20 changes: 20 additions & 0 deletions src/main/resources/assets/crimsonrevelations/sounds.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,25 @@
"sounds": [
"crimsonrevelations:foci/blinding_light/shoot"
]
},
"bauble.runic.charge": {
"sounds": [
"crimsonrevelations:bauble/runic/charge"
]
},
"bauble.runic.emergency": {
"sounds": [
"crimsonrevelations:bauble/runic/emergency"
]
},
"bauble.runic.kinetic": {
"sounds": [
"crimsonrevelations:bauble/runic/kinetic"
]
},
"bauble.runic.regen": {
"sounds": [
"crimsonrevelations:bauble/runic/regen"
]
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 87fe347

Please sign in to comment.