Initially add changes, god this will take a while
This commit is contained in:
parent
b43a0668aa
commit
0fad36a08c
272 changed files with 3438 additions and 197 deletions
|
@ -12,13 +12,18 @@ import net.minecraft.util.TypedActionResult;
|
|||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import su.a71.new_soviet.NewSoviet;
|
||||
import su.a71.new_soviet.registration.NSE_Items;
|
||||
import su.a71.new_soviet.sounds.Sounds;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DiceItem extends Item {
|
||||
public DiceItem(Settings settings) {
|
||||
private final int sides;
|
||||
private final String loacl_tooltip;
|
||||
|
||||
public DiceItem(int sides, String localTooltip, Settings settings) {
|
||||
super(settings);
|
||||
this.sides = sides;
|
||||
this.loacl_tooltip = localTooltip;
|
||||
}
|
||||
|
||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
||||
|
@ -27,7 +32,7 @@ public class DiceItem extends Item {
|
|||
if (!world.isClient) {
|
||||
StringBuilder output = new StringBuilder();
|
||||
for (var i = 0; i < itemStack.getCount(); i++) {
|
||||
world.playSound((PlayerEntity)null, user.getX(), user.getY(), user.getZ(), NSE_Items.DICE_SOUND, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
world.playSound((PlayerEntity)null, user.getX(), user.getY(), user.getZ(), 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(", ");
|
||||
}
|
||||
user.sendMessage(Text.translatable(itemStack.getCount() == 1 ? "item.new_soviet.dice.thrown" : "item.new_soviet.dice.thrown_multiple").append(" " + output.subSequence(0, output.length() - 2)));
|
||||
|
@ -38,12 +43,12 @@ public class DiceItem extends Item {
|
|||
}
|
||||
|
||||
public int getSides() {
|
||||
return 6;
|
||||
return sides;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
|
||||
tooltip.add(Text.translatable("item.new_soviet.dice_d6.tooltip"));
|
||||
tooltip.add(Text.translatable(loacl_tooltip));
|
||||
super.appendTooltip(stack, world, tooltip, context);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue