Skip to content

Commit

Permalink
Better sound design, updated range/cooldown values
Browse files Browse the repository at this point in the history
  • Loading branch information
Faboslav committed Oct 11, 2023
1 parent cfe6098 commit f8627fa
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import net.minecraft.entity.data.DataTracker;
import net.minecraft.entity.data.TrackedData;
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.passive.PassiveEntity;
import net.minecraft.entity.player.PlayerEntity;
Expand Down Expand Up @@ -172,6 +175,12 @@ public void tick() {
this.discard();
}

StatusEffectInstance invisibilityStatusEffect = this.getStatusEffect(StatusEffects.INVISIBILITY);

if(this.isHidden() && invisibilityStatusEffect != null && invisibilityStatusEffect.getDuration() == 1) {
this.playReappearSound();
}

if (this.getWorld().isClient() == false && this.isAnyKeyframeAnimationRunning()) {
this.setKeyframeAnimationTicks(this.getKeyframeAnimationTicks() - 1);
}
Expand Down Expand Up @@ -273,6 +282,7 @@ public boolean damage(
}

this.playHurtSound(source);
this.playDisappearSound();
this.spawnCloudParticles();
this.discard();

Expand Down Expand Up @@ -329,6 +339,24 @@ protected void playHurtSound(DamageSource source) {
this.playSound(this.getHurtSound(source), 1.0F, RandomGenerator.generateFloat(1.15F, 1.3F));
}

public SoundEvent getDisappearSound() {
return FriendsAndFoesSoundEvents.ENTITY_RASCAL_DISAPPEAR.get();
}

public void playDisappearSound() {
SoundEvent soundEvent = this.getDisappearSound();
this.playSound(soundEvent, 1.0F, RandomGenerator.generateFloat(1.5F, 1.6F));
}

public SoundEvent getReappearSound() {
return FriendsAndFoesSoundEvents.ENTITY_RASCAL_REAPPEAR.get();
}

public void playReappearSound() {
SoundEvent soundEvent = this.getReappearSound();
this.playSound(soundEvent, 1.0F, RandomGenerator.generateFloat(1.5F, 1.6F));
}

@Override
protected void playStepSound(
BlockPos pos,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private static void addIdleActivities(Brain<RascalEntity> brain) {
brain.setTaskList(
Activity.IDLE,
ImmutableList.of(
Pair.of(0, RascalFindInteractionTargetTask.create(8)),
Pair.of(0, RascalFindInteractionTargetTask.create(6)),
Pair.of(0, makeRandomWanderTask())
)
);
Expand Down Expand Up @@ -161,9 +161,7 @@ private static void runAwayFrom(RascalEntity rascal, LivingEntity target) {
MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE,
FriendsAndFoesMemoryModuleTypes.RASCAL_NOD_COOLDOWN.get()
);
//NOD_COOLDOWN_PROVIDER = TimeHelper.betweenSeconds(25, 30);
NOD_COOLDOWN_PROVIDER = TimeHelper.betweenSeconds(10, 11);
//AVOID_MEMORY_DURATION = TimeHelper.betweenSeconds(20, 30);
AVOID_MEMORY_DURATION = TimeHelper.betweenSeconds(5, 10);
NOD_COOLDOWN_PROVIDER = TimeHelper.betweenSeconds(20, 20);
AVOID_MEMORY_DURATION = TimeHelper.betweenSeconds(20, 20);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import net.minecraft.entity.ai.brain.MemoryModuleType;
import net.minecraft.entity.ai.brain.task.LookTargetUtil;
import net.minecraft.entity.ai.brain.task.MultiTickTask;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
Expand All @@ -29,7 +31,7 @@
public final class RascalWaitForPlayerTask extends MultiTickTask<RascalEntity>
{
private final static int NOD_DURATION = 90;
public final static float NOD_RANGE = 3.5F;
public final static float NOD_RANGE = 4F;

private int nodTicks;
private LivingEntity nearestTarget;
Expand Down Expand Up @@ -145,14 +147,15 @@ protected void finishRunning(ServerWorld world, RascalEntity rascal, long time)
rascal.spawnCloudParticles();

if (rascal.shouldGiveReward()) {
rascal.playAmbientSound();
rascal.playDisappearSound();
rascal.discard();
return;
}

rascal.setPose(RascalEntityPose.DEFAULT);
//rascal.addStatusEffect(new StatusEffectInstance(StatusEffects.INVISIBILITY, 400));
rascal.addStatusEffect(new StatusEffectInstance(StatusEffects.INVISIBILITY, 400));
RascalBrain.setNodCooldown(rascal);
rascal.playDisappearSound();
rascal.enableAmbientSounds();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ public final class FriendsAndFoesSoundEvents
public static final Supplier<SoundEvent> ENTITY_MOOBLOOM_CONVERT;
public static final Supplier<SoundEvent> ENTITY_PLAYER_MIRROR_MOVE;
public static final Supplier<SoundEvent> ENTITY_RASCAL_AMBIENT;
public static final Supplier<SoundEvent> ENTITY_RASCAL_NOD;
public static final Supplier<SoundEvent> ENTITY_RASCAL_DISAPPEAR;
public static final Supplier<SoundEvent> ENTITY_RASCAL_HURT;
public static final Supplier<SoundEvent> ENTITY_RASCAL_NOD;
public static final Supplier<SoundEvent> ENTITY_RASCAL_REAPPEAR;
public static final Supplier<SoundEvent> ENTITY_RASCAL_REWARD;
public static final Supplier<SoundEvent> ENTITY_RASCAL_REWARD_BAD;
public static final Supplier<SoundEvent> ENTITY_TUFF_GOLEM_GLUE_ON;
Expand Down Expand Up @@ -91,8 +93,10 @@ public final class FriendsAndFoesSoundEvents
ENTITY_MOOBLOOM_CONVERT = register("entity", "moobloom.convert");
ENTITY_PLAYER_MIRROR_MOVE = register("entity", "player.mirror_move");
ENTITY_RASCAL_AMBIENT = register("entity", "rascal.ambient");
ENTITY_RASCAL_NOD = register("entity", "rascal.nod");
ENTITY_RASCAL_DISAPPEAR = register("entity", "rascal.disappear");
ENTITY_RASCAL_HURT = register("entity", "rascal.hurt");
ENTITY_RASCAL_NOD = register("entity", "rascal.nod");
ENTITY_RASCAL_REAPPEAR = register("entity", "rascal.reappear");
ENTITY_RASCAL_REWARD = register("entity", "rascal.reward");
ENTITY_RASCAL_REWARD_BAD = register("entity", "rascal.reward_bad");
ENTITY_TUFF_GOLEM_GLUE_ON = register("entity", "tuff_golem.glue_on");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@
"subtitle.entity.friendsandfoes.moobloom.convert": "Moobloom transforms",
"subtitle.entity.friendsandfoes.player.mirror_move": "Player displaces",
"subtitle.entity.friendsandfoes.rascal.ambient": "Rascal taunts",
"subtitle.entity.friendsandfoes.rascal.disappear": "Rascal disappears",
"subtitle.entity.friendsandfoes.rascal.nod": "Rascal nods",
"subtitle.entity.friendsandfoes.rascal.hurt": "Rascal hurts",
"subtitle.entity.friendsandfoes.rascal.reappear": "Rascal appears",
"subtitle.entity.friendsandfoes.rascal.reward": "Rascal gives reward",
"subtitle.entity.friendsandfoes.rascal.reward_bad": "Rascal gives bad reward",
"subtitle.entity.friendsandfoes.shield_debris.impact": "Shield debris impacted",
Expand Down
26 changes: 20 additions & 6 deletions common/src/main/resources/assets/friendsandfoes/sounds.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,12 @@
],
"subtitle": "subtitle.entity.friendsandfoes.rascal.ambient"
},
"entity.rascal.nod": {
"entity.rascal.disappear": {
"sounds": [
"friendsandfoes:entity/rascal/nod1",
"friendsandfoes:entity/rascal/nod2",
"friendsandfoes:entity/rascal/nod3",
"friendsandfoes:entity/rascal/nod4"
"friendsandfoes:entity/rascal/disappear1",
"friendsandfoes:entity/rascal/disappear2"
],
"subtitle": "subtitle.entity.friendsandfoes.rascal.nod"
"subtitle": "subtitle.entity.friendsandfoes.rascal.disappear"
},
"entity.rascal.hurt": {
"sounds": [
Expand All @@ -211,6 +209,22 @@
],
"subtitle": "subtitle.entity.friendsandfoes.rascal.hurt"
},
"entity.rascal.nod": {
"sounds": [
"friendsandfoes:entity/rascal/nod1",
"friendsandfoes:entity/rascal/nod2",
"friendsandfoes:entity/rascal/nod3",
"friendsandfoes:entity/rascal/nod4"
],
"subtitle": "subtitle.entity.friendsandfoes.rascal.nod"
},
"entity.rascal.reappear": {
"sounds": [
"friendsandfoes:entity/rascal/reappear1",
"friendsandfoes:entity/rascal/reappear2"
],
"subtitle": "subtitle.entity.friendsandfoes.rascal.reappear"
},
"entity.rascal.reward": {
"sounds": [
"friendsandfoes:entity/rascal/reward1",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit f8627fa

Please sign in to comment.