Skip to content

Commit

Permalink
1.19.2 -> 1.19.3 (1.20)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sollace committed Dec 11, 2022
1 parent 93c916e commit 248a7d9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 21 deletions.
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ org.gradle.daemon=false

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.3
loader_version=0.14.9
fabric_version=0.59.0+1.19.2
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.2
loader_version=0.14.11
fabric_version=0.68.1+1.19.3

# Mod Properties
group=com.tamaized
Expand All @@ -15,5 +15,5 @@ org.gradle.daemon=false
description=Brings back the old Void Fog

# Dependencies
modmenu_version=4.0.6
kirin_version=1.11.0
modmenu_version=5.0.0-alpha.3
kirin_version=1.13.2
47 changes: 32 additions & 15 deletions src/main/java/com/tamaized/voidfog/InsanityEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.Entity;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
Expand All @@ -14,19 +15,19 @@ public class InsanityEngine {
private int timeToNextSound = 0;
private int insanityBuildUp;

private final SoundEvent[] events = new SoundEvent[] {
SoundEvents.ENTITY_POLAR_BEAR_WARNING,
SoundEvents.AMBIENT_CAVE,
SoundEvents.ENTITY_CREEPER_PRIMED,
SoundEvents.ENTITY_ZOMBIE_DESTROY_EGG,
SoundEvents.BLOCK_CHEST_CLOSE,
SoundEvents.UI_TOAST_IN,
SoundEvents.BLOCK_COMPOSTER_READY,
SoundEvents.BLOCK_METAL_STEP,
SoundEvents.UI_BUTTON_CLICK,
SoundEvents.ENTITY_ZOGLIN_ANGRY,
SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON,
SoundEvents.ENTITY_ZOMBIE_STEP
private final Sound[] events = new Sound[] {
Sound.of(SoundEvents.ENTITY_POLAR_BEAR_WARNING),
Sound.of(SoundEvents.AMBIENT_CAVE),
Sound.of(SoundEvents.ENTITY_CREEPER_PRIMED),
Sound.of(SoundEvents.ENTITY_ZOMBIE_DESTROY_EGG),
Sound.of(SoundEvents.BLOCK_CHEST_CLOSE),
Sound.of(SoundEvents.UI_TOAST_IN),
Sound.of(SoundEvents.BLOCK_COMPOSTER_READY),
Sound.of(SoundEvents.BLOCK_METAL_STEP),
Sound.of(SoundEvents.UI_BUTTON_CLICK),
Sound.of(SoundEvents.ENTITY_ZOGLIN_ANGRY),
Sound.of(SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON),
Sound.of(SoundEvents.ENTITY_ZOMBIE_STEP)
};

public void update(World world, Entity entity, Voidable dimension) {
Expand Down Expand Up @@ -72,8 +73,24 @@ private int getRarity(double y, World world) {
}

private void doAScary(World world, BlockPos pos) {
SoundEvent event = events[world.random.nextInt(events.length)];
Sound event = events[world.random.nextInt(events.length)];
float pitch = 1 + world.random.nextFloat();
world.playSound(MinecraftClient.getInstance().player, pos, event, SoundCategory.AMBIENT, 2, pitch);
event.play(world, pos, 1, pitch);
}

interface Sound {
static Sound of(SoundEvent event) {
return (world, pos, volume, pitch) -> {
world.playSound(MinecraftClient.getInstance().player, pos, event, SoundCategory.AMBIENT, volume, pitch);
};
}

static Sound of(RegistryEntry<SoundEvent> event) {
return (world, pos, volume, pitch) -> {
world.playSound(MinecraftClient.getInstance().player, pos.getX(), pos.getY(), pos.getZ(), event, SoundCategory.AMBIENT, volume, pitch, world.getRandom().nextLong());
};
}

void play(World world, BlockPos pos, float volume, float pitch);
}
}

0 comments on commit 248a7d9

Please sign in to comment.