Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exchange Focus Effect Sound Revamp #482

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,16 @@ public static class FocusEffectsCategory
@Config.Name("[12] Rift: Impact Sound")
@Config.Comment("Adds an impact sound to the rift focus effect")
public boolean utTCRiftFocusImpactSoundToggle = true;

@Config.RequiresMcRestart
@Config.Name("[13] Exchange: Cast Sound Revamp")
@Config.Comment("Overhauls the exchange focus effect cast sound")
public boolean utTCExchangeFocusSoundRevampToggle = true;

@Config.RequiresMcRestart
@Config.Name("[14] Exchange: Impact Sound")
@Config.Comment("Adds an impact sound to the exchange focus effect")
public boolean utTCExchangeFocusImpactSoundToggle = true;
}

public static class FocusMediumsCategory
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package mod.acgaming.universaltweaks.mods.thaumcraft.foci.focuseffects.mixin;

import net.minecraft.entity.Entity;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.RayTraceResult;

import mod.acgaming.universaltweaks.UniversalTweaks;
import mod.acgaming.universaltweaks.config.UTConfigGeneral;
import mod.acgaming.universaltweaks.config.UTConfigMods;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import thaumcraft.api.casters.FocusEffect;
import thaumcraft.api.casters.Trajectory;
import thaumcraft.common.items.casters.foci.FocusEffectExchange;
import thaumcraft.common.lib.SoundsTC;

// Courtesy of Turkey9002
@Mixin(FocusEffectExchange.class)
public abstract class UTExchangeFocusMixin extends FocusEffect
{
@Override
public void onCast(final Entity caster)
{
try
{
if (UTConfigMods.THAUMCRAFT_FOCI.FOCUS_EFFECTS.utTCExchangeFocusSoundRevampToggle) caster.world.playSound(null, caster.getPosition().up(), SoundsTC.hhoff, SoundCategory.PLAYERS, 0.8F, 0.45F + (float) (caster.world.rand.nextGaussian() * 0.05F));
else caster.world.playSound(null, caster.getPosition().up(), SoundEvents.BLOCK_ENCHANTMENT_TABLE_USE, SoundCategory.PLAYERS, 0.2F, 2.0F + (float) (caster.world.rand.nextGaussian() * 0.05F));
}
catch (Exception ignored) {}
}

@Inject(method = "execute", at = @At(value = "RETURN"), remap = false)
public void utFrostFocusImpactSound(RayTraceResult target, Trajectory trajectory, float finalPower, int num, CallbackInfoReturnable<Boolean> cir)
{
if (!UTConfigMods.THAUMCRAFT_FOCI.FOCUS_EFFECTS.utTCExchangeFocusImpactSoundToggle) return;
if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTEffectExchangeFocus ::: Execute");
try
{
this.getPackage().world.playSound(null, target.hitVec.x, target.hitVec.y, target.hitVec.z, SoundsTC.hhon, SoundCategory.PLAYERS, 0.8F, 0.85F + (float) (this.getPackage().getCaster().world.rand.nextGaussian() * 0.05F));
}
catch (Exception ignored) {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTBreakFocusMixin", "UTEarthFocusMixin", "UTFireFocusMixin", "UTFluxFocusMixin", "UTFrostFocusMixin", "UTHealFocusMixin", "UTRiftFocusMixin"]
"mixins": ["UTBreakFocusMixin", "UTEarthFocusMixin", "UTExchangeFocusMixin", "UTFireFocusMixin", "UTFluxFocusMixin", "UTFrostFocusMixin", "UTHealFocusMixin", "UTRiftFocusMixin"]
}
Loading