Skip to content

Commit 6c670c5

Browse files
committed
Implement Auditory sounds
1 parent f96257a commit 6c670c5

28 files changed

+348
-36
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ buildscript {
1818
apply plugin: 'net.minecraftforge.gradle.forge'
1919
apply plugin: 'org.spongepowered.mixin'
2020

21-
version = "1.12.2-1.1.1"
21+
version = "1.12.2-1.2.0"
2222
group = "mod.acgaming.extrasounds"
2323
archivesBaseName = "ExtraSounds"
2424

@@ -67,7 +67,7 @@ repositories {
6767
}
6868

6969
dependencies {
70-
deobfCompile "zone.rong:mixinbooter:4.2"
70+
deobfCompile "zone.rong:mixinbooter:5.0"
7171
deobfCompile "curse.maven:jei-238222:3043174"
7272
//deobfCompile "curse.maven:had-enough-items-557549:3801373"
7373
}

src/main/java/mod/acgaming/extrasounds/ExtraSounds.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class ExtraSounds
1414
{
1515
public static final String MODID = "extrasounds";
1616
public static final String NAME = "Extra Sounds";
17-
public static final String VERSION = "1.12.2-1.1.1";
17+
public static final String VERSION = "1.12.2-1.2.0";
1818
public static final String DEPENDENCIES = "required-after:mixinbooter;after:jei";
1919
public static final Logger LOGGER = LogManager.getLogger("ES");
2020

src/main/java/mod/acgaming/extrasounds/config/ESConfig.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,34 @@ public static class SoundToggles
6262
@Config.Name("Swap Hands Sound")
6363
@Config.Comment("Play a sound when swapping hands to hold an item")
6464
public boolean esSwapHandsSound = true;
65+
66+
@Config.Name("Pull Bow Sound")
67+
@Config.Comment("Play a sound when pulling a bow")
68+
public boolean esPullBowSound = true;
69+
70+
@Config.Name("Ender Pearl Teleport Sound")
71+
@Config.Comment("Play a sound when teleporting via ender pearls")
72+
public boolean esEnderPearlTeleportSound = true;
73+
74+
@Config.Name("Place Boat Sound")
75+
@Config.Comment("Play a sound when placing a boat")
76+
public boolean esPlaceBoatSound = true;
77+
78+
@Config.Name("Place Minecart Sound")
79+
@Config.Comment("Play a sound when placing a minecart")
80+
public boolean esPlaceMinecartSound = true;
81+
82+
@Config.Name("Jukebox Interact Sound")
83+
@Config.Comment("Play a sound when interacting with a jukebox")
84+
public boolean esJukeboxInteractSound = true;
85+
86+
@Config.Name("Flower Pot Plant Sound")
87+
@Config.Comment("Play a sound when planting flowers in a flower pot")
88+
public boolean esFlowerPotPlantSound = true;
89+
90+
@Config.Name("Spawn Egg Sound")
91+
@Config.Comment("Play a sound when spawning an entity with a spawn egg")
92+
public boolean esUseSpawnEggSound = true;
6593
}
6694

6795
public static class SoundVolume
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package mod.acgaming.extrasounds.mixin;
2+
3+
import net.minecraft.block.BlockFlowerPot;
4+
import net.minecraft.block.state.IBlockState;
5+
import net.minecraft.entity.player.EntityPlayer;
6+
import net.minecraft.util.EnumFacing;
7+
import net.minecraft.util.EnumHand;
8+
import net.minecraft.util.math.BlockPos;
9+
import net.minecraft.world.World;
10+
11+
import mod.acgaming.extrasounds.config.ESConfig;
12+
import mod.acgaming.extrasounds.sound.ESSoundEvents;
13+
import mod.acgaming.extrasounds.sound.ESSoundManager;
14+
import org.spongepowered.asm.mixin.Mixin;
15+
import org.spongepowered.asm.mixin.injection.At;
16+
import org.spongepowered.asm.mixin.injection.Inject;
17+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
18+
19+
@Mixin(BlockFlowerPot.class)
20+
public class BlockFlowerPotMixin
21+
{
22+
@Inject(method = "onBlockActivated", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/EntityPlayer;addStat(Lnet/minecraft/stats/StatBase;)V"))
23+
public void esFlowerPotPlant(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ, CallbackInfoReturnable<Boolean> cir)
24+
{
25+
if (ESConfig.soundToggles.esFlowerPotPlantSound) ESSoundManager.playSound(ESSoundEvents.plant_flower_pot, 1.0F, 0.8F);
26+
}
27+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package mod.acgaming.extrasounds.mixin;
2+
3+
import net.minecraft.block.BlockJukebox;
4+
import net.minecraft.block.state.IBlockState;
5+
import net.minecraft.item.ItemStack;
6+
import net.minecraft.util.math.BlockPos;
7+
import net.minecraft.world.World;
8+
9+
import mod.acgaming.extrasounds.config.ESConfig;
10+
import mod.acgaming.extrasounds.sound.ESSoundEvents;
11+
import mod.acgaming.extrasounds.sound.ESSoundManager;
12+
import org.spongepowered.asm.mixin.Mixin;
13+
import org.spongepowered.asm.mixin.injection.At;
14+
import org.spongepowered.asm.mixin.injection.Inject;
15+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
16+
17+
@Mixin(BlockJukebox.class)
18+
public class BlockJukeboxMixin
19+
{
20+
@Inject(method = "insertRecord", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockJukebox$TileEntityJukebox;setRecord(Lnet/minecraft/item/ItemStack;)V"))
21+
public void esJukeboxInsert(World worldIn, BlockPos pos, IBlockState state, ItemStack recordStack, CallbackInfo ci)
22+
{
23+
if (ESConfig.soundToggles.esJukeboxInteractSound) ESSoundManager.playSound(ESSoundEvents.jukebox_insert);
24+
}
25+
26+
@Inject(method = "dropRecord", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockJukebox$TileEntityJukebox;setRecord(Lnet/minecraft/item/ItemStack;)V"))
27+
public void esJukeboxEject(World worldIn, BlockPos pos, IBlockState state, CallbackInfo ci)
28+
{
29+
if (ESConfig.soundToggles.esJukeboxInteractSound) ESSoundManager.playSound(ESSoundEvents.jukebox_eject);
30+
}
31+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package mod.acgaming.extrasounds.mixin;
2+
3+
import net.minecraft.entity.item.EntityEnderPearl;
4+
import net.minecraft.util.math.RayTraceResult;
5+
6+
import mod.acgaming.extrasounds.config.ESConfig;
7+
import mod.acgaming.extrasounds.sound.ESSoundEvents;
8+
import mod.acgaming.extrasounds.sound.ESSoundManager;
9+
import org.spongepowered.asm.mixin.Mixin;
10+
import org.spongepowered.asm.mixin.injection.At;
11+
import org.spongepowered.asm.mixin.injection.Inject;
12+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
13+
14+
@Mixin(EntityEnderPearl.class)
15+
public class EntityEnderPearlMixin
16+
{
17+
@Inject(method = "onImpact", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/EntityLivingBase;setPositionAndUpdate(DDD)V"))
18+
public void esEnderPearlTeleport(RayTraceResult result, CallbackInfo ci)
19+
{
20+
if (ESConfig.soundToggles.esEnderPearlTeleportSound) ESSoundManager.playSound(ESSoundEvents.teleport_ender_pearl);
21+
}
22+
}

src/main/java/mod/acgaming/extrasounds/mixin/GuiContainerCreativeMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
public class GuiContainerCreativeMixin
1919
{
2020
@Inject(at = @At("HEAD"), method = "handleMouseClick")
21-
protected void esSlotClickSound(Slot slotIn, int slotId, int mouseButton, ClickType type, CallbackInfo ci)
21+
public void esSlotClickSound(Slot slotIn, int slotId, int mouseButton, ClickType type, CallbackInfo ci)
2222
{
2323
if (ESConfig.soundToggles.esPickPlaceSound)
2424
{
@@ -34,7 +34,7 @@ protected void esSlotClickSound(Slot slotIn, int slotId, int mouseButton, ClickT
3434
}
3535

3636
@Inject(at = @At("HEAD"), method = "setCurrentCreativeTab")
37-
protected void esTabClickSound(CreativeTabs tab, CallbackInfo ci)
37+
public void esTabClickSound(CreativeTabs tab, CallbackInfo ci)
3838
{
3939
if (ESConfig.soundToggles.esCreativeTabSound)
4040
{

src/main/java/mod/acgaming/extrasounds/mixin/GuiContainerMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void esCloseGUISound(CallbackInfo ci)
2929
}
3030

3131
@Inject(at = @At("HEAD"), method = "handleMouseClick")
32-
protected void esSlotClickSound(Slot slotIn, int slotId, int mouseButton, ClickType type, CallbackInfo ci)
32+
public void esSlotClickSound(Slot slotIn, int slotId, int mouseButton, ClickType type, CallbackInfo ci)
3333
{
3434
if (ESConfig.soundToggles.esPickPlaceSound)
3535
{

src/main/java/mod/acgaming/extrasounds/mixin/GuiInventoryMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
public class GuiInventoryMixin
1717
{
1818
@Inject(at = @At("HEAD"), method = "handleMouseClick")
19-
protected void esSlotClickSound(Slot slotIn, int slotId, int mouseButton, ClickType type, CallbackInfo ci)
19+
public void esSlotClickSound(Slot slotIn, int slotId, int mouseButton, ClickType type, CallbackInfo ci)
2020
{
2121
if (ESConfig.soundToggles.esPickPlaceSound)
2222
{

src/main/java/mod/acgaming/extrasounds/mixin/GuiNewChatMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
public class GuiNewChatMixin
1818
{
1919
@Inject(at = @At("RETURN"), method = "setChatLine")
20-
private void esMessageMentionSound(ITextComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci)
20+
public void esMessageMentionSound(ITextComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci)
2121
{
2222
if (Minecraft.getMinecraft().player == null || displayOnly) return;
2323

0 commit comments

Comments
 (0)