Skip to content

Commit

Permalink
feat: make bony flesh blocks play flesh or bone sounds (with equal pr…
Browse files Browse the repository at this point in the history
…obability)
  • Loading branch information
Elenterius committed Jan 10, 2024
1 parent 3c633aa commit 7cb6065
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public void registerSounds() {
addSimpleSounds(ModSoundEvents.FLESH_BLOCK_BREAK, 4);
addSimpleSounds(ModSoundEvents.FLESH_BLOCK_FALL, 3);

addSimpleRedirects(ModSoundEvents.BONY_FLESH_BLOCK_HIT, ModSoundEvents.FLESH_BLOCK_HIT.get(), SoundEvents.BONE_BLOCK_HIT);
addSimpleRedirects(ModSoundEvents.BONY_FLESH_BLOCK_PLACE, ModSoundEvents.FLESH_BLOCK_PLACE.get(), SoundEvents.BONE_BLOCK_PLACE);
addSimpleRedirects(ModSoundEvents.BONY_FLESH_BLOCK_STEP, ModSoundEvents.FLESH_BLOCK_STEP.get(), SoundEvents.BONE_BLOCK_STEP);
addSimpleRedirects(ModSoundEvents.BONY_FLESH_BLOCK_BREAK, ModSoundEvents.FLESH_BLOCK_BREAK.get(), SoundEvents.BONE_BLOCK_BREAK);
addSimpleRedirects(ModSoundEvents.BONY_FLESH_BLOCK_FALL, ModSoundEvents.FLESH_BLOCK_FALL.get(), SoundEvents.BONE_BLOCK_FALL);

addSimpleSounds(ModSoundEvents.FLESH_DOOR_OPEN, 2);
addSimpleSounds(ModSoundEvents.FLESH_DOOR_CLOSE, 2);

Expand Down Expand Up @@ -82,7 +88,7 @@ public void registerSounds() {
addSimpleRedirect(ModSoundEvents.DIGESTER_CRAFTING_COMPLETED, SoundEvents.PLAYER_BURP, 1f, 1.25f);

addSimpleRedirect(ModSoundEvents.FLESH_BLOB_JUMP, SoundEvents.SLIME_JUMP);
addSimpleRedirect(ModSoundEvents.FLESH_BLOB_HURT, ModSoundEvents.FLESH_BLOCK_BREAK.get(), 0.8f, 0.9f);
addSimpleRedirect(ModSoundEvents.FLESH_BLOB_HURT, ModSoundEvents.FLESH_BLOCK_BREAK, 0.8f, 0.9f);
addSimpleRedirect(ModSoundEvents.FLESH_BLOB_DEATH, SoundEvents.GENERIC_DEATH);
addSimpleSounds(ModSoundEvents.FLESH_BLOB_AMBIENT, 3, 0.8f, 0.9f);
addSimpleSound(ModSoundEvents.GENERIC_MEW_PURR, 0.7f, 0.45f);
Expand Down Expand Up @@ -169,4 +175,13 @@ protected void addSimpleRedirect(RegistryObject<SoundEvent> soundHolder, Registr
);
}

protected void addSimpleRedirects(RegistryObject<SoundEvent> soundHolder, SoundEvent... redirectTargets) {
SoundDefinition soundDefinition = definition().subtitle(translationKey(soundHolder));

for (SoundEvent redirectTarget : redirectTargets) {
soundDefinition.with().with(sound(redirectTarget.getLocation(), SoundDefinition.SoundType.EVENT));
}

add(soundHolder, soundDefinition);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,12 @@ private void addSoundTranslations() {
addSound(ModSoundEvents.FLESH_BLOCK_BREAK, "Break Fleshy Block");
addSound(ModSoundEvents.FLESH_BLOCK_FALL, "Fall on Fleshy Block");

addSound(ModSoundEvents.BONY_FLESH_BLOCK_HIT, "Hit Bony Flesh Block");
addSound(ModSoundEvents.BONY_FLESH_BLOCK_PLACE, "Place Bony Flesh Block");
addSound(ModSoundEvents.BONY_FLESH_BLOCK_STEP, "Step on Bony Flesh Block");
addSound(ModSoundEvents.BONY_FLESH_BLOCK_BREAK, "Break Bony Flesh Block");
addSound(ModSoundEvents.BONY_FLESH_BLOCK_FALL, "Fall on Bony Flesh Block");

addSound(ModSoundEvents.FLESH_DOOR_OPEN, "Open Fleshy Door");
addSound(ModSoundEvents.FLESH_DOOR_CLOSE, "Close Fleshy Door");

Expand Down
5 changes: 5 additions & 0 deletions src/generated/resources/assets/biomancy/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,11 @@
"sounds.biomancy.flesh_block.step": "Step on Fleshy Block",
"sounds.biomancy.flesh_block.break": "Break Fleshy Block",
"sounds.biomancy.flesh_block.fall": "Fall on Fleshy Block",
"sounds.biomancy.bony_flesh_block.hit": "Hit Bony Flesh Block",
"sounds.biomancy.bony_flesh_block.place": "Place Bony Flesh Block",
"sounds.biomancy.bony_flesh_block.step": "Step on Bony Flesh Block",
"sounds.biomancy.bony_flesh_block.break": "Break Bony Flesh Block",
"sounds.biomancy.bony_flesh_block.fall": "Fall on Bony Flesh Block",
"sounds.biomancy.flesh_door.open": "Open Fleshy Door",
"sounds.biomancy.flesh_door.close": "Close Fleshy Door",
"sounds.biomancy.claws.attack.strong": "Strong Claw Attack",
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/com/github/elenterius/biomancy/init/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public final class ModBlocks {
//## Decoration
public static final RegistryObject<RotatedPillarBlock> TUBULAR_FLESH_BLOCK = register("tubular_flesh", RotatedPillarBlock::new);
public static final RegistryObject<FleshBlock> FIBROUS_FLESH = register("fibrous_flesh", FleshBlock::new);
public static final RegistryObject<RotatedPillarBlock> FLESH_PILLAR = register("flesh_pillar", () -> new RotatedPillarBlock(createFleshyBoneProperties()));
public static final RegistryObject<FleshBlock> CHISELED_FLESH = register("chiseled_flesh", () -> new FleshBlock(createFleshyBoneProperties()));
public static final RegistryObject<RotatedPillarBlock> ORNATE_FLESH = register("ornate_flesh", () -> new RotatedPillarBlock(createFleshyBoneProperties()));
public static final RegistryObject<RotatedPillarBlock> FLESH_PILLAR = register("flesh_pillar", () -> new RotatedPillarBlock(createBonyFleshProperties()));
public static final RegistryObject<FleshBlock> CHISELED_FLESH = register("chiseled_flesh", () -> new FleshBlock(createBonyFleshProperties()));
public static final RegistryObject<RotatedPillarBlock> ORNATE_FLESH = register("ornate_flesh", () -> new RotatedPillarBlock(createBonyFleshProperties()));

//## Primal Ecosystem
public static final RegistryObject<FleshBlock> PRIMAL_FLESH = register("primal_flesh", FleshBlock::new);
Expand All @@ -87,7 +87,7 @@ public final class ModBlocks {

//## Utility
public static final RegistryObject<VoiceBoxBlock> VOICE_BOX = register("voice_box", VoiceBoxBlock::new);
public static final RegistryObject<FleshSpikeBlock> FLESH_SPIKE = register("flesh_spike", () -> new FleshSpikeBlock(createFleshyBoneProperties().noOcclusion()));
public static final RegistryObject<FleshSpikeBlock> FLESH_SPIKE = register("flesh_spike", () -> new FleshSpikeBlock(createBonyFleshProperties().noOcclusion()));
public static final RegistryObject<VialHolderBlock> VIAL_HOLDER = register("vial_holder", VialHolderBlock::new);
public static final RegistryObject<NeuralInterceptorBlock> NEURAL_INTERCEPTOR = register("neural_interceptor", NeuralInterceptorBlock::new);

Expand All @@ -107,9 +107,9 @@ public final class ModBlocks {
public static final RegistryObject<LiquidBlock> ACID_FLUID_BLOCK = register("acid_fluid_block", () -> new LiquidBlock(ModFluids.ACID, copyProperties(Blocks.WATER)));

//## Misc
public static final RegistryObject<LadderBlock> FLESH_LADDER = register("flesh_ladder", () -> new LadderBlock(createFleshyBoneProperties().noOcclusion()));
public static final RegistryObject<LadderBlock> FLESH_LADDER = register("flesh_ladder", () -> new LadderBlock(createBonyFleshProperties().noOcclusion()));
public static final RegistryObject<FleshFenceBlock> FLESH_FENCE = register("flesh_fence", FleshFenceBlock::new);
public static final RegistryObject<FleshFenceGateBlock> FLESH_FENCE_GATE = register("flesh_fence_gate", () -> new FleshFenceGateBlock(createFleshyBoneProperties().noOcclusion()));
public static final RegistryObject<FleshFenceGateBlock> FLESH_FENCE_GATE = register("flesh_fence_gate", () -> new FleshFenceGateBlock(createBonyFleshProperties().noOcclusion()));
public static final RegistryObject<IrisDoorBlock> FLESH_IRIS_DOOR = register("flesh_iris_door", IrisDoorBlock::new);
public static final RegistryObject<FleshDoorBlock> FLESH_DOOR = register("flesh_door", FleshDoorBlock::new);
public static final RegistryObject<FullFleshDoorBlock> FULL_FLESH_DOOR = register("full_flesh_door", FullFleshDoorBlock::new);
Expand Down Expand Up @@ -168,8 +168,8 @@ public static BlockBehaviour.Properties createToughFleshProperties() {
return createFleshProperties().strength(6f, 12f);
}

public static BlockBehaviour.Properties createFleshyBoneProperties() {
return BlockBehaviour.Properties.of(ModBlockMaterials.FLESH_MATERIAL).strength(4f, 6f).sound(SoundType.BONE_BLOCK).isValidSpawn(ModBlocks::isValidFleshkinSpawn);
public static BlockBehaviour.Properties createBonyFleshProperties() {
return BlockBehaviour.Properties.of(ModBlockMaterials.FLESH_MATERIAL).strength(4f, 6f).sound(ModSoundTypes.BONY_FLESH_BLOCK).isValidSpawn(ModBlocks::isValidFleshkinSpawn);
}

public static boolean isValidFleshkinSpawn(BlockState state, BlockGetter level, BlockPos pos, EntityType<?> entityType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ public final class ModSoundEvents {
public static final RegistryObject<SoundEvent> FLESH_BLOCK_BREAK = registerSoundEvent("flesh_block.break");
public static final RegistryObject<SoundEvent> FLESH_BLOCK_STEP = registerSoundEvent("flesh_block.step");
public static final RegistryObject<SoundEvent> FLESH_BLOCK_FALL = registerSoundEvent("flesh_block.fall");

public static final RegistryObject<SoundEvent> BONY_FLESH_BLOCK_PLACE = registerSoundEvent("bony_flesh_block.place");
public static final RegistryObject<SoundEvent> BONY_FLESH_BLOCK_HIT = registerSoundEvent("bony_flesh_block.hit");
public static final RegistryObject<SoundEvent> BONY_FLESH_BLOCK_BREAK = registerSoundEvent("bony_flesh_block.break");
public static final RegistryObject<SoundEvent> BONY_FLESH_BLOCK_STEP = registerSoundEvent("bony_flesh_block.step");
public static final RegistryObject<SoundEvent> BONY_FLESH_BLOCK_FALL = registerSoundEvent("bony_flesh_block.fall");

public static final RegistryObject<SoundEvent> FLESH_DOOR_OPEN = registerSoundEvent("flesh_door.open");
public static final RegistryObject<SoundEvent> FLESH_DOOR_CLOSE = registerSoundEvent("flesh_door.close");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@

public final class ModSoundTypes {

private ModSoundTypes() {}

public static final ForgeSoundType FLESH_BLOCK = new ForgeSoundType(1f, 1f,
ModSoundEvents.FLESH_BLOCK_BREAK, ModSoundEvents.FLESH_BLOCK_STEP,
ModSoundEvents.FLESH_BLOCK_PLACE, ModSoundEvents.FLESH_BLOCK_HIT, ModSoundEvents.FLESH_BLOCK_FALL);
public static final ForgeSoundType BONY_FLESH_BLOCK = new ForgeSoundType(1f, 1f,
ModSoundEvents.BONY_FLESH_BLOCK_BREAK, ModSoundEvents.BONY_FLESH_BLOCK_STEP,
ModSoundEvents.BONY_FLESH_BLOCK_PLACE, ModSoundEvents.BONY_FLESH_BLOCK_HIT, ModSoundEvents.BONY_FLESH_BLOCK_FALL);

private ModSoundTypes() {}

}

0 comments on commit 7cb6065

Please sign in to comment.