优化方块注册类

This commit is contained in:
17146 2025-01-07 01:22:23 +08:00
parent 3179510627
commit 76983785f3
17 changed files with 31 additions and 152 deletions

View file

@ -33,6 +33,7 @@ import java.util.List;
@SuppressWarnings("deprecation")
public class BarbedWireBlock extends Block {
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;

View file

@ -1,11 +0,0 @@
package com.atsuishio.superbwarfare.block;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
public class CementedCarbideBlock extends Block {
public CementedCarbideBlock() {
super(Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops());
}
}

View file

@ -1,12 +0,0 @@
package com.atsuishio.superbwarfare.block;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
public class DeepslateGalenaOreBlock extends Block {
public DeepslateGalenaOreBlock() {
super(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(3f, 8f).requiresCorrectToolForDrops());
}
}

View file

@ -1,12 +0,0 @@
package com.atsuishio.superbwarfare.block;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
public class DeepslateScheeliteOreBlock extends Block {
public DeepslateScheeliteOreBlock() {
super(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(3f, 8f).requiresCorrectToolForDrops());
}
}

View file

@ -1,11 +0,0 @@
package com.atsuishio.superbwarfare.block;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
public class DeepslateSilverOreBlock extends Block {
public DeepslateSilverOreBlock() {
super(Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(3f, 8f).requiresCorrectToolForDrops());
}
}

View file

@ -24,11 +24,12 @@ import net.minecraft.world.phys.shapes.VoxelShape;
@SuppressWarnings("deprecation")
public class DragonTeethBlock extends Block {
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
public DragonTeethBlock() {
super(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(25f, 500f).requiresCorrectToolForDrops().pushReaction(PushReaction.BLOCK).noOcclusion().isRedstoneConductor((bs, br, bp) -> false));
this.registerDefaultState(this.stateDefinition.any().setValue(WATERLOGGED, false));
}
@Override
@ -79,6 +80,5 @@ public class DragonTeethBlock extends Block {
}
return super.updateShape(state, facing, facingState, world, currentPos, facingPos);
}
}

View file

@ -1,12 +0,0 @@
package com.atsuishio.superbwarfare.block;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
public class GalenaOreBlock extends Block {
public GalenaOreBlock() {
super(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(3f, 5f).requiresCorrectToolForDrops());
}
}

View file

@ -29,6 +29,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
@SuppressWarnings("deprecation")
public class JumpPadBlock extends Block {
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;

View file

@ -1,11 +0,0 @@
package com.atsuishio.superbwarfare.block;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
public class LeadBlock extends Block {
public LeadBlock() {
super(Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops());
}
}

View file

@ -122,5 +122,4 @@ public class ReforgingTableBlock extends Block {
return new SimpleMenuProvider((i, inventory, player) ->
new ReforgingTableMenu(i, inventory, ContainerLevelAccess.create(pLevel, pPos)), CONTAINER_TITLE);
}
}

View file

@ -1,12 +0,0 @@
package com.atsuishio.superbwarfare.block;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
public class SandbagBlock extends Block {
public SandbagBlock() {
super(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.SNARE).sound(SoundType.SAND).strength(10f, 20f));
}
}

View file

@ -1,12 +0,0 @@
package com.atsuishio.superbwarfare.block;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
public class ScheeliteOreBlock extends Block {
public ScheeliteOreBlock() {
super(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(3f, 5f).requiresCorrectToolForDrops());
}
}

View file

@ -1,11 +0,0 @@
package com.atsuishio.superbwarfare.block;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
public class SilverBlock extends Block {
public SilverBlock() {
super(Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops());
}
}

View file

@ -1,11 +0,0 @@
package com.atsuishio.superbwarfare.block;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
public class SilverOreBlock extends Block {
public SilverOreBlock() {
super(Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(3f, 5f).requiresCorrectToolForDrops());
}
}

View file

@ -1,11 +0,0 @@
package com.atsuishio.superbwarfare.block;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
public class SteelBlock extends Block {
public SteelBlock() {
super(Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops());
}
}

View file

@ -1,11 +0,0 @@
package com.atsuishio.superbwarfare.block;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
public class TungstenBlock extends Block {
public TungstenBlock() {
super(Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops());
}
}

View file

@ -3,6 +3,9 @@ package com.atsuishio.superbwarfare.init;
import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.block.*;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
@ -11,22 +14,34 @@ public class ModBlocks {
public static final DeferredRegister<Block> REGISTRY = DeferredRegister.create(ForgeRegistries.BLOCKS, ModUtils.MODID);
public static final RegistryObject<Block> SANDBAG = REGISTRY.register("sandbag", SandbagBlock::new);
public static final RegistryObject<Block> SANDBAG = REGISTRY.register("sandbag",
() -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.SNARE).sound(SoundType.SAND).strength(10f, 20f)));
public static final RegistryObject<Block> BARBED_WIRE = REGISTRY.register("barbed_wire", BarbedWireBlock::new);
public static final RegistryObject<Block> JUMP_PAD = REGISTRY.register("jump_pad", JumpPadBlock::new);
public static final RegistryObject<Block> GALENA_ORE = REGISTRY.register("galena_ore", GalenaOreBlock::new);
public static final RegistryObject<Block> DEEPSLATE_GALENA_ORE = REGISTRY.register("deepslate_galena_ore", DeepslateGalenaOreBlock::new);
public static final RegistryObject<Block> SCHEELITE_ORE = REGISTRY.register("scheelite_ore", ScheeliteOreBlock::new);
public static final RegistryObject<Block> DEEPSLATE_SCHEELITE_ORE = REGISTRY.register("deepslate_scheelite_ore", DeepslateScheeliteOreBlock::new);
public static final RegistryObject<Block> SILVER_ORE = REGISTRY.register("silver_ore", SilverOreBlock::new);
public static final RegistryObject<Block> DEEPSLATE_SILVER_ORE = REGISTRY.register("deepslate_silver_ore", DeepslateSilverOreBlock::new);
public static final RegistryObject<Block> GALENA_ORE = REGISTRY.register("galena_ore",
() -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(3f, 5f).requiresCorrectToolForDrops()));
public static final RegistryObject<Block> DEEPSLATE_GALENA_ORE = REGISTRY.register("deepslate_galena_ore",
() -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(3f, 8f).requiresCorrectToolForDrops()));
public static final RegistryObject<Block> SCHEELITE_ORE = REGISTRY.register("scheelite_ore",
() -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(3f, 5f).requiresCorrectToolForDrops()));
public static final RegistryObject<Block> DEEPSLATE_SCHEELITE_ORE = REGISTRY.register("deepslate_scheelite_ore",
() -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(3f, 8f).requiresCorrectToolForDrops()));
public static final RegistryObject<Block> SILVER_ORE = REGISTRY.register("silver_ore",
() -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(3f, 5f).requiresCorrectToolForDrops()));
public static final RegistryObject<Block> DEEPSLATE_SILVER_ORE = REGISTRY.register("deepslate_silver_ore",
() -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(3f, 8f).requiresCorrectToolForDrops()));
public static final RegistryObject<Block> DRAGON_TEETH = REGISTRY.register("dragon_teeth", DragonTeethBlock::new);
public static final RegistryObject<Block> REFORGING_TABLE = REGISTRY.register("reforging_table", ReforgingTableBlock::new);
public static final RegistryObject<Block> LEAD_BLOCK = REGISTRY.register("lead_block", LeadBlock::new);
public static final RegistryObject<Block> STEEL_BLOCK = REGISTRY.register("steel_block", SteelBlock::new);
public static final RegistryObject<Block> TUNGSTEN_BLOCK = REGISTRY.register("tungsten_block", TungstenBlock::new);
public static final RegistryObject<Block> SILVER_BLOCK = REGISTRY.register("silver_block", SilverBlock::new);
public static final RegistryObject<Block> CEMENTED_CARBIDE_BLOCK = REGISTRY.register("cemented_carbide_block", CementedCarbideBlock::new);
public static final RegistryObject<Block> LEAD_BLOCK = REGISTRY.register("lead_block",
() -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops()));
public static final RegistryObject<Block> STEEL_BLOCK = REGISTRY.register("steel_block",
() -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops()));
public static final RegistryObject<Block> TUNGSTEN_BLOCK = REGISTRY.register("tungsten_block",
() -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops()));
public static final RegistryObject<Block> SILVER_BLOCK = REGISTRY.register("silver_block",
() -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops()));
public static final RegistryObject<Block> CEMENTED_CARBIDE_BLOCK = REGISTRY.register("cemented_carbide_block",
() -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops()));
public static final RegistryObject<Block> CONTAINER = REGISTRY.register("container", ContainerBlock::new);
public static final RegistryObject<Block> CHARGING_STATION = REGISTRY.register("charging_station", ChargingStationBlock::new);
public static final RegistryObject<Block> FUMO_25 = REGISTRY.register("fumo_25", FuMO25Block::new);