Add dice statistic, begin re-adding stairs and slabs
This commit is contained in:
parent
2a695c6029
commit
7ac09095e5
7 changed files with 45 additions and 24 deletions
|
@ -17,6 +17,7 @@ import java.util.List;
|
|||
import su.a71.new_soviet.Config;
|
||||
import su.a71.new_soviet.NewSoviet;
|
||||
import su.a71.new_soviet.registration.NSE_Sounds;
|
||||
import su.a71.new_soviet.registration.NSE_Stats;
|
||||
|
||||
public class DiceItem extends Item {
|
||||
private final int sides;
|
||||
|
@ -34,8 +35,12 @@ public class DiceItem extends Item {
|
|||
if (!world.isClient) {
|
||||
StringBuilder output = new StringBuilder();
|
||||
for (var i = 0; i < itemStack.getCount(); i++) {
|
||||
int result = NewSoviet.RANDOM.nextBetween(1, this.getSides());
|
||||
if (result == this.getSides()) {
|
||||
user.incrementStat(NSE_Stats.ROLL_PERFECT_DICE);
|
||||
}
|
||||
world.playSound(null, user.getX(), user.getY(), user.getZ(), NSE_Sounds.DICE_SOUND, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
output.append(NewSoviet.RANDOM.nextBetween(1, this.getSides())).append(", ");
|
||||
output.append(result).append(", ");
|
||||
}
|
||||
if (Config.INSTANCE.shouldAnnounceDice()) {
|
||||
world.getPlayers().forEach(player -> player.sendMessage(Text.translatable(itemStack.getCount() == 1 ? "item.new_soviet.dice.thrown_announce" : "item.new_soviet.dice.thrown_multiple_announce", user.getDisplayName()).append(" " + output.subSequence(0, output.length() - 2)), false));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue