Skip to content

Commit

Permalink
Implement Empty Sound (requires testing on looping sounds)
Browse files Browse the repository at this point in the history
  • Loading branch information
tehgreatdoge authored Jan 18, 2024
1 parent 93b0cf7 commit bbbf892
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.phys.Vec3;
import net.povstalec.sgjourney.common.block_entities.stargate.AbstractStargateEntity;
import net.povstalec.sgjourney.common.init.SoundInit;

public abstract class StargateSound extends AbstractTickableSoundInstance
{
Expand All @@ -26,6 +27,8 @@ public abstract class StargateSound extends AbstractTickableSoundInstance
protected StargateSound(AbstractStargateEntity stargate, SoundEvent soundEvent, double fullDistance, double maxDistance)
{
super(soundEvent, SoundSource.BLOCKS, SoundInstance.createUnseededRandom());
if (soundEvent == SoundInit.EMPTY_SOUND_INSTANCE)
this.stop();
this.stargate = stargate;
this.x = stargate.getBlockPos().getX();
this.y = stargate.getBlockPos().getY();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public class SoundInit
public static final RegistryObject<SoundEvent> MATOK_CLOSE = registerSoundEvent("matok_close");

public static final RegistryObject<SoundEvent> EQUIP_NAQUADAH_ARMOR = registerSoundEvent("equip_naquadah_armor");
public static final SoundEvent EMPTY_SOUND_INSTANCE = SoundEvent.createVariableRangeEvent(new ResourceLocation(StargateJourney.MODID, "empty"));
public static final RegistryObject<SoundEvent> EMPTY_SOUND = SOUNDS.register("empty", () -> EMPTY_SOUND_INSTANCE);

public static final RegistryObject<SoundEvent> NOTHING = registerSoundEvent("nothing");

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/sgjourney/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
"sounds.sgjourney.chevron_encode" : "Chevron encoded",
"sounds.sgjourney.chevron_engage" : "Chevron engaged",
"sounds.sgjourney.dial_fail" : "Stargate dialing fails",
"sounds.sgjourney.empty" : "ERROR, contact devs",

"sounds.sgjourney.wormhole_open" : "Wormhole opens",
"sounds.sgjourney.wormhole_close" : "Wormhole closes",
Expand Down

0 comments on commit bbbf892

Please sign in to comment.