Skip to content

Commit

Permalink
Add Sounds to Waterwheel and Windmill (#5950)
Browse files Browse the repository at this point in the history
* Working towards creaking sounds for mill wheels

* Update and finalize sounds for wind and watermills

* Fix not including .ogg and * imports
  • Loading branch information
voidsong-dragonfly committed Jun 17, 2024
1 parent 049c794 commit a373f0f
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,21 @@

package blusunrize.immersiveengineering.common.blocks.wooden;

import blusunrize.immersiveengineering.ImmersiveEngineering;
import blusunrize.immersiveengineering.api.IEProperties;
import blusunrize.immersiveengineering.api.energy.IRotationAcceptor;
import blusunrize.immersiveengineering.api.utils.SafeChunkUtils;
import blusunrize.immersiveengineering.common.blocks.IEBaseBlockEntity;
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IGeneralMultiblock;
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IHasDummyBlocks;
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.ISoundBE;
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IStateBasedDirectional;
import blusunrize.immersiveengineering.common.blocks.PlacementLimitation;
import blusunrize.immersiveengineering.common.blocks.ticking.IEClientTickableBE;
import blusunrize.immersiveengineering.common.blocks.ticking.IEServerTickableBE;
import blusunrize.immersiveengineering.common.util.IEBlockCapabilityCaches;
import blusunrize.immersiveengineering.common.util.IEBlockCapabilityCaches.IEBlockCapabilityCache;
import blusunrize.immersiveengineering.common.util.IESounds;
import blusunrize.immersiveengineering.common.util.Utils;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
Expand All @@ -39,7 +42,7 @@
import java.util.ArrayList;
import java.util.List;

public class WatermillBlockEntity extends IEBaseBlockEntity implements IEServerTickableBE, IEClientTickableBE, IStateBasedDirectional, IHasDummyBlocks
public class WatermillBlockEntity extends IEBaseBlockEntity implements IEServerTickableBE, IEClientTickableBE, IStateBasedDirectional, IHasDummyBlocks, ISoundBE
{
public int[] offset = {0, 0};
public float rotation = 0;
Expand All @@ -66,6 +69,7 @@ public void tickClient()
{
rotation += perTick;
rotation %= 1;
ImmersiveEngineering.proxy.handleTileSound(IESounds.mill_creaking, this, getPower()>0, 0.9f, 1f);
}

@Override
Expand Down Expand Up @@ -326,4 +330,10 @@ public void breakDummies(BlockPos pos, BlockState state)
}
}
}

@Override
public boolean shouldPlaySound(String sound)
{
return getPower()>0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package blusunrize.immersiveengineering.common.blocks.wooden;

import blusunrize.immersiveengineering.ImmersiveEngineering;
import blusunrize.immersiveengineering.api.IEProperties;
import blusunrize.immersiveengineering.api.energy.IRotationAcceptor;
import blusunrize.immersiveengineering.api.energy.WindmillBiome;
Expand All @@ -17,12 +18,14 @@
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IPlacementInteraction;
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IPlayerInteraction;
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IStateBasedDirectional;
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.ISoundBE;
import blusunrize.immersiveengineering.common.blocks.PlacementLimitation;
import blusunrize.immersiveengineering.common.blocks.ticking.IEClientTickableBE;
import blusunrize.immersiveengineering.common.blocks.ticking.IEServerTickableBE;
import blusunrize.immersiveengineering.common.register.IEBlockEntities;
import blusunrize.immersiveengineering.common.register.IEItems.Ingredients;
import blusunrize.immersiveengineering.common.util.CachedRecipe;
import blusunrize.immersiveengineering.common.util.IESounds;
import blusunrize.immersiveengineering.common.util.ItemNBTHelper;
import com.google.common.collect.Lists;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -52,7 +55,7 @@
import java.util.function.BiFunction;

public class WindmillBlockEntity extends IEBaseBlockEntity implements IEServerTickableBE, IEClientTickableBE,
IStateBasedDirectional, IPlacementInteraction, IPlayerInteraction, IBlockBounds
IStateBasedDirectional, IPlacementInteraction, IPlayerInteraction, IBlockBounds, ISoundBE
{
public float rotation = 0;
public float turnSpeed = 0;
Expand Down Expand Up @@ -82,6 +85,7 @@ public void tickClient()
{
rotation += getActualTurnSpeed();
rotation %= 1;
ImmersiveEngineering.proxy.handleTileSound(IESounds.mill_creaking, this, turnSpeed>0, 0.9f, 1f);
}


Expand Down Expand Up @@ -255,4 +259,10 @@ public VoxelShape getBlockBounds(@Nullable CollisionContext ctx)
{
return SHAPES.get(this.getFacing());
}

@Override
public boolean shouldPlaySound(String sound)
{
return turnSpeed>0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class IESounds
public static final Holder<SoundEvent> process1Lift = registerSound("process_1_lift");
public static final Holder<SoundEvent> process2 = registerSound("process_2");
public static final Holder<SoundEvent> process2Lift = registerSound("process_2_lift");
public static final Holder<SoundEvent> mill_creaking = registerSound("mill_creaking");
public static final Holder<SoundEvent> electromagnet = registerSound("electromagnet");


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@
"subtitle.immersiveengineering.process_1_lift": "Automatic Engineer's Workbench whirrs",
"subtitle.immersiveengineering.process_2": "Automatic Engineer's Workbench solders",
"subtitle.immersiveengineering.process_2_lift": "Automatic Engineer's Workbench whirrs",
"subtitle.immersiveengineering.mill_creaking": "Mill wheel creaks",
"subtitle.immersiveengineering.electromagnet": "Electromagnet hums",
"recipe.immersiveengineering.hammerCrushing": "Crushing",
"death.attack.ieRevolver_casull": "%1$s was shot by %2$s",
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/assets/immersiveengineering/sounds.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,13 @@
],
"subtitle": "subtitle.immersiveengineering.process_2_lift"
},
"mill_creaking": {
"category": "block",
"sounds": [
"immersiveengineering:mill_creaking"
],
"subtitle": "subtitle.immersiveengineering.mill_creaking"
},
"electromagnet": {
"category": "player",
"sounds": [
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Links to all of the sounds so that they're not lost
## Links to all of the sounds so that they're not lost

- Blast Furnace Preheaters: https://freesound.org/people/iankath/sounds/173991/
- Fermenter: https://freesound.org/people/decembered/sounds/140217/
Expand All @@ -12,4 +12,5 @@
- Automatic Workbench Lifts: https://freesound.org/people/scivirus/sounds/435730/
- Automatic Workbench Drill: https://freesound.org/people/nuncaconoci/sounds/619243/
- Automatic Workbench Solder: https://freesound.org/people/soundsofscienceupf/sounds/460832/
- Eletromagnet: https://freesound.org/people/_MC5_/sounds/672082/
- Eletromagnet: https://freesound.org/people/_MC5_/sounds/672082/
- Waterwheel/Windmill Creak: https://freesound.org/people/phonoflora/sounds/535013/

0 comments on commit a373f0f

Please sign in to comment.