Integrate screwdriver
This commit is contained in:
parent
1b290d9169
commit
8f1af13933
6 changed files with 81 additions and 1 deletions
|
@ -13,6 +13,7 @@ import net.minecraft.server.world.ServerWorld;
|
|||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.stat.Stats;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.IntProperty;
|
||||
|
@ -88,6 +89,7 @@ public class SirenBlock extends HorizontalFacingBlock implements Waterloggable {
|
|||
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), NSE_Sounds.SCREWDRIVER_SOUND, SoundCategory.BLOCKS, 1.0f, (float) NewSoviet.RANDOM.nextBetween(8, 11) / 10);
|
||||
|
||||
player.sendMessage(Text.translatable("block.new_soviet.siren.set").append(Text.translatable("block.new_soviet.siren.sound." + SIREN_SOUNDS.get(world.getBlockState(pos).get(SOUND_INDEX)).translation_key()).formatted(Formatting.YELLOW)), true);
|
||||
player.incrementStat(Stats.USED.getOrCreateStat(NSE_Items.SCREWDRIVER));
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
return super.onUse(state, world, pos, player, hand, hit);
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.item.ItemPlacementContext;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.stat.Stats;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
|
@ -86,6 +87,7 @@ public class WindowBlock extends HorizontalFacingBlock {
|
|||
player.sendMessage(Text.translatable("block.new_soviet.window.unfixed").formatted(Formatting.BOLD), true);
|
||||
}
|
||||
world.setBlockState(pos, state.with(CLOSED, !state.get(CLOSED)), 2);
|
||||
player.incrementStat(Stats.USED.getOrCreateStat(NSE_Items.SCREWDRIVER));
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
return super.onUse(state, world, pos, player, hand, hit);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue