Add advancements, siren sounds, fix bugs

This commit is contained in:
Andrew-71 2023-09-28 17:59:23 +03:00
parent 5e60100eca
commit cabbed33cf
23 changed files with 366 additions and 23 deletions

View file

@ -46,6 +46,8 @@ public class SirenBlock extends HorizontalFacingBlock implements Waterloggable {
setDefaultState(getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.NORTH).with(ON, false).with(WATERLOGGED, false).with(SOUND_INDEX, 0));
SIREN_SOUNDS.add(new SirenSound("Air raid", NSE_Sounds.SIREN_SOUND, 140));
SIREN_SOUNDS.add(new SirenSound("Bell", NSE_Sounds.BELL_SIREN_SOUND, 100));
SIREN_SOUNDS.add(new SirenSound("Woop", NSE_Sounds.WOOP_SIREN_SOUND, 40));
}
@Override

View file

@ -3,10 +3,8 @@ package su.a71.new_soviet.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.enums.WallMountLocation;
import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.particle.DustParticleEffect;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
@ -38,7 +36,7 @@ public class SwitchBlock extends LeverBlock {
protected static final VoxelShape CEILING_X_AXIS_SHAPE = Block.createCuboidShape(5.5, 15.0, 5.5, 10.5, 16.0, 10.5);
public SwitchBlock(FabricBlockSettings fabricBlockSettings) {
super(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).notSolid().pistonBehavior(PistonBehavior.DESTROY).strength(1f, 2f).mapColor(MapColor.TERRACOTTA_WHITE).noCollision());
super(fabricBlockSettings.noCollision());
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(POWERED, false).with(FACE, WallMountLocation.WALL));
}

View file

@ -101,7 +101,7 @@ public class LightBulbLampBlock extends LampBlock {
}
static {
SHAPE = VoxelShapes.union(Block.createCuboidShape(7, 15, 7, 9, 16, 9), Block.createCuboidShape(7, 6, 7, 9, 8, 9)); //VoxelShapes.union(Block.createCuboidShape(4.0, 2.0, 4.0, 12.0, 7.0, 12.0), Block.createCuboidShape(7.0, 7.0, 7.0, 9.0, 13.0, 9.0), Block.createCuboidShape(6.0, 13.0, 6.0, 10.0, 16.0, 10.0));
SHAPE = VoxelShapes.union(Block.createCuboidShape(7, 15.5, 7, 9, 16, 9), Block.createCuboidShape(7, 6, 7, 9, 8, 9)); //VoxelShapes.union(Block.createCuboidShape(4.0, 2.0, 4.0, 12.0, 7.0, 12.0), Block.createCuboidShape(7.0, 7.0, 7.0, 9.0, 13.0, 9.0), Block.createCuboidShape(6.0, 13.0, 6.0, 10.0, 16.0, 10.0));
BROKEN = Properties.CRACKED;
}
}

View file

@ -0,0 +1,67 @@
package su.a71.new_soviet.blocks.meat;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.entity.SculkSpreadManager;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.IntProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.WorldAccess;
import org.jetbrains.annotations.Nullable;
public class MeatBlock extends Block implements SculkSpreadable {
public static final IntProperty AGE;
public final float MeatChance;
public MeatBlock(FabricBlockSettings settings, float meatChance) {
super(settings.ticksRandomly());
setDefaultState(getDefaultState().with(AGE, 0));
this.MeatChance = meatChance;
}
@Override
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
if (world.isAir(pos.up())) {
int i;
for(i = 1; world.getBlockState(pos.down(i)).isOf(this); ++i) {
}
if (i < 3) {
int j = state.get(AGE);
if (j == 25) {
world.setBlockState(pos.up(), this.getDefaultState());
world.setBlockState(pos, state.with(AGE, 0), 4);
} else {
world.setBlockState(pos, state.with(AGE, j + 1), 4);
}
}
} super.randomTick(state, world, pos, random);
}
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(AGE);
}
@Nullable
@Override
public BlockState getPlacementState(ItemPlacementContext ctx) {
return super.getPlacementState(ctx).with(AGE, 0);
}
static {
AGE = Properties.AGE_25;
}
@Override
public int spread(SculkSpreadManager.Cursor cursor, WorldAccess world, BlockPos catalystPos, Random random, SculkSpreadManager spreadManager, boolean shouldConvertToBlock) {
return 0;
}
}

View file

@ -0,0 +1,9 @@
package su.a71.new_soviet.blocks.meat;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
public class MeatEyeBlock extends MeatBlock {
public MeatEyeBlock(FabricBlockSettings settings) {
super(settings, 10);
}
}

View file

@ -0,0 +1,9 @@
package su.a71.new_soviet.blocks.meat;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
public class MeatTeethBlock extends MeatBlock {
public MeatTeethBlock(FabricBlockSettings settings) {
super(settings, 10);
}
}