Improve registration and do small dependency cleanup

This commit is contained in:
Andrew-71 2023-08-13 23:20:04 +03:00
parent 2dcf58e405
commit ca2c5aa93e
18 changed files with 61 additions and 83 deletions

View file

@ -19,8 +19,6 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import net.minecraft.block.RedstoneLampBlock;
import net.minecraft.block.TorchBlock;
import org.jetbrains.annotations.Nullable;
public class CeilingFanBlock extends Block implements Waterloggable {

View file

@ -16,9 +16,8 @@ import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import org.jetbrains.annotations.Nullable;
import java.util.function.ToIntFunction;
import org.jetbrains.annotations.Nullable;
public class LampBlock extends Block implements Waterloggable {
public static final BooleanProperty HANGING;

View file

@ -23,10 +23,10 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import net.minecraft.world.explosion.Explosion;
import org.jetbrains.annotations.Nullable;
import su.a71.new_soviet.NewSoviet;
public class LandMineBlock extends HorizontalFacingBlock implements Waterloggable {
public static final BooleanProperty WATERLOGGED;
protected static final VoxelShape SHAPE;

View file

@ -1,7 +1,6 @@
package su.a71.new_soviet.blocks;
import net.minecraft.block.*;
import net.minecraft.particle.DustParticleEffect;
import net.minecraft.text.Text;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.ProjectileEntity;
@ -26,10 +25,12 @@ import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import org.jetbrains.annotations.Nullable;
import su.a71.new_soviet.NewSoviet;
import su.a71.new_soviet.registration.NSE_Custom;
import su.a71.new_soviet.registration.NSE_Items;
import su.a71.new_soviet.registration.NSE_Sounds;
public class LightBulbBlock extends Block implements Waterloggable {
protected static final VoxelShape SHAPE;
@ -98,7 +99,7 @@ public class LightBulbBlock extends Block implements Waterloggable {
@Override
public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) {
if (!state.get(BROKEN)) {
world.playSound((PlayerEntity)null, hit.getBlockPos().getX(), hit.getBlockPos().getY(), hit.getBlockPos().getZ(), NSE_Custom.LIGHT_BULB_BROKEN_SOUND, SoundCategory.NEUTRAL, 0.8f, 1f);
world.playSound((PlayerEntity)null, hit.getBlockPos().getX(), hit.getBlockPos().getY(), hit.getBlockPos().getZ(), NSE_Sounds.LIGHT_BULB_BROKEN_SOUND, SoundCategory.NEUTRAL, 0.8f, 1f);
}
world.setBlockState(hit.getBlockPos(), (BlockState)state.with(BROKEN, true).with(ON, false), 2);
super.onProjectileHit(world, state, hit, projectile);

View file

@ -19,11 +19,11 @@ import net.minecraft.util.math.random.Random;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import su.a71.new_soviet.registration.NSE_Custom;
import su.a71.new_soviet.registration.NSE_Sounds;
public class SirenBlock extends HorizontalFacingBlock implements Waterloggable {
public static final BooleanProperty ON;
@ -46,7 +46,7 @@ public class SirenBlock extends HorizontalFacingBlock implements Waterloggable {
if (bl) {
world.scheduleBlockTick(pos, this, 4);
} else {
world.playSound((PlayerEntity)null, pos.getX(), pos.getY(), pos.getZ(), NSE_Custom.SIREN_SOUND, SoundCategory.NEUTRAL, getSirenVolume(world, pos), 1f);
world.playSound((PlayerEntity)null, pos.getX(), pos.getY(), pos.getZ(), NSE_Sounds.SIREN_SOUND, SoundCategory.NEUTRAL, getSirenVolume(world, pos), 1f);
world.setBlockState(pos, (BlockState)state.cycle(ON), 2);
world.scheduleBlockTick(pos, this, 140);
}
@ -90,7 +90,7 @@ public class SirenBlock extends HorizontalFacingBlock implements Waterloggable {
if ((Boolean)state.get(ON) && !world.isReceivingRedstonePower(pos)) {
world.setBlockState(pos, (BlockState)state.cycle(ON), 2);
} else {
world.playSound((PlayerEntity)null, pos.getX(), pos.getY(), pos.getZ(), NSE_Custom.SIREN_SOUND, SoundCategory.NEUTRAL, getSirenVolume(world, pos), 1f);
world.playSound((PlayerEntity)null, pos.getX(), pos.getY(), pos.getZ(), NSE_Sounds.SIREN_SOUND, SoundCategory.NEUTRAL, getSirenVolume(world, pos), 1f);
world.scheduleBlockTick(pos, this, 140);
}
}

View file

@ -16,6 +16,7 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import org.jetbrains.annotations.Nullable;
public class StoveBlock extends BlockWithEntity {

View file

@ -9,7 +9,6 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.particle.DustParticleEffect;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.Properties;
@ -23,10 +22,9 @@ import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import net.minecraft.world.event.GameEvent;
import su.a71.new_soviet.NewSoviet;
import su.a71.new_soviet.sounds.Sounds;
import su.a71.new_soviet.registration.NSE_Sounds;
public class SwitchBlock extends LeverBlock {
public static final BooleanProperty POWERED = Properties.POWERED;
@ -86,7 +84,7 @@ public class SwitchBlock extends LeverBlock {
}
BlockState blockState = this.togglePower(state, world, pos);
float f = blockState.get(POWERED) != false ? 1f : 0.9f;
world.playSound(null, pos, Sounds.SWITCH_PRESS, SoundCategory.BLOCKS, 0.6f, f);
world.playSound(null, pos, NSE_Sounds.SWITCH_PRESS, SoundCategory.BLOCKS, 0.6f, f);
world.emitGameEvent((Entity)player, blockState.get(POWERED) != false ? GameEvent.BLOCK_ACTIVATE : GameEvent.BLOCK_DEACTIVATE, pos);
return ActionResult.CONSUME;
}

View file

@ -12,6 +12,7 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import su.a71.new_soviet.entity.TVBlockEntity;
public class TVBlock extends HorizontalFacingBlock implements BlockEntityProvider {