Added the muffler upgrade (#2928)

* Added flag for ability to play sound.

* Added muffler functionality

* Added muffler to upgrade advancement

* Added muffler model

* Added muffler lang entry

* Added muffler placeholder texture

* Added muffler recipe + toast

* Added muffler tooltip
This commit is contained in:
Ayutac 2022-04-28 10:52:10 +02:00 committed by GitHub
parent b14a4c72a1
commit a574c7f67e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 135 additions and 5 deletions

View file

@ -89,8 +89,13 @@ public class AbstractBlockBlockEntity extends GenericMachineBlockEntity implemen
//BlockBreakerProcessable
@Override
public void playSound() {
if (RecipeCrafter.soundHandler != null) {
if (RecipeCrafter.soundHandler != null && canPlaySound()) {
RecipeCrafter.soundHandler.playSound(false, this);
}
}
@Override
public boolean canPlaySound() {
return !isMuffled();
}
}

View file

@ -23,9 +23,19 @@ public interface BlockProcessable extends IUpgradeHandler, RedstoneConfigurable,
*/
boolean consumeEnergy(int amount);
/**
* <b>Play a sound to the Minecraft world</b>
*
* @see #canPlaySound()
*/
void playSound();
/**
* <b>If a sound can be played.</b>
*
* @see #playSound()
*/
default boolean canPlaySound() {
return true;
}
}

View file

@ -1496,6 +1496,9 @@ public class TRContent {
if (aesu != null) {
aesu.superconductors += TechRebornConfig.superConductorCount;
}
}),
MUFFLER((blockEntity, handler, stack) -> {
blockEntity.muffle();
});
public String name;