diff --git a/src/main/java/com/atsuishio/superbwarfare/ModUtils.java b/src/main/java/com/atsuishio/superbwarfare/ModUtils.java index bb5dab100..4b7beb2db 100644 --- a/src/main/java/com/atsuishio/superbwarfare/ModUtils.java +++ b/src/main/java/com/atsuishio/superbwarfare/ModUtils.java @@ -1,12 +1,16 @@ package com.atsuishio.superbwarfare; import com.atsuishio.superbwarfare.component.ModDataComponents; +import com.atsuishio.superbwarfare.config.ClientConfig; +import com.atsuishio.superbwarfare.config.CommonConfig; +import com.atsuishio.superbwarfare.config.ServerConfig; import com.atsuishio.superbwarfare.init.*; import net.minecraft.resources.ResourceLocation; import net.neoforged.bus.api.IEventBus; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.ModContainer; import net.neoforged.fml.common.Mod; +import net.neoforged.fml.config.ModConfig; import net.neoforged.neoforge.client.event.ClientTickEvent; import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.event.tick.ServerTickEvent; @@ -28,14 +32,14 @@ public class ModUtils { public static final Logger LOGGER = LogManager.getLogger(ModUtils.class); public ModUtils(IEventBus bus, ModContainer container) { -// container.registerConfig(ModConfig.Type.CLIENT, ClientConfig.init()); -// container.registerConfig(ModConfig.Type.COMMON, CommonConfig.init()); -// container.registerConfig(ModConfig.Type.SERVER, ServerConfig.init()); + container.registerConfig(ModConfig.Type.CLIENT, ClientConfig.init()); + container.registerConfig(ModConfig.Type.COMMON, CommonConfig.init()); + container.registerConfig(ModConfig.Type.SERVER, ServerConfig.init()); ModPerks.register(bus); // ModSerializers.REGISTRY.register(bus); ModSounds.REGISTRY.register(bus); -// ModBlocks.REGISTRY.register(bus); + ModBlocks.REGISTRY.register(bus); // ModBlockEntities.REGISTRY.register(bus); ModItems.register(bus); ModDataComponents.register(bus); @@ -45,7 +49,7 @@ public class ModUtils { ModParticleTypes.REGISTRY.register(bus); // ModPotion.POTIONS.register(bus); // ModMenuTypes.REGISTRY.register(bus); -// ModVillagers.register(bus); + ModVillagers.register(bus); // ModRecipes.RECIPE_SERIALIZERS.register(bus); // bus.addListener(this::onCommonSetup); diff --git a/src/main/java/com/atsuishio/superbwarfare/block/BarbedWireBlock.java b/src/main/java/com/atsuishio/superbwarfare/block/BarbedWireBlock.java new file mode 100644 index 000000000..44fc7886d --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/block/BarbedWireBlock.java @@ -0,0 +1,93 @@ +package com.atsuishio.superbwarfare.block; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; + +import javax.annotation.ParametersAreNonnullByDefault; + +@SuppressWarnings("deprecation") +public class BarbedWireBlock extends Block { + + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; + public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + + public BarbedWireBlock() { + super(Properties.of().ignitedByLava().instrument(NoteBlockInstrument.BASS).sound(SoundType.WOOD).strength(10f, 20f).noCollission().speedFactor(0.01f).noOcclusion().isRedstoneConductor((bs, br, bp) -> false)); + this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, false)); + } + + @Override + @ParametersAreNonnullByDefault + public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos) { + return true; + } + + @Override + @ParametersAreNonnullByDefault + public @NotNull VoxelShape getVisualShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Shapes.empty(); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(FACING, WATERLOGGED); + } + + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + boolean flag = context.getLevel().getFluidState(context.getClickedPos()).getType() == Fluids.WATER; + return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()).setValue(WATERLOGGED, flag); + } + + @Override + public @NotNull FluidState getFluidState(BlockState state) { + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + + public @NotNull BlockState rotate(BlockState state, Rotation rot) { + return state.setValue(FACING, rot.rotate(state.getValue(FACING))); + } + + public @NotNull BlockState mirror(BlockState state, Mirror mirrorIn) { + return state.rotate(mirrorIn.getRotation(state.getValue(FACING))); + } + + @Override + @ParametersAreNonnullByDefault + public @NotNull BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor world, BlockPos currentPos, BlockPos facingPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); + } + return super.updateShape(state, facing, facingState, world, currentPos, facingPos); + } + + @Override + @ParametersAreNonnullByDefault + public void entityInside(BlockState blockstate, Level world, BlockPos pos, Entity entity) { + super.entityInside(blockstate, world, pos, entity); + + // TODO vehicle process +// if (!(entity instanceof VehicleEntity)) { +// entity.makeStuckInBlock(Blocks.AIR.defaultBlockState(), new Vec3(0.15, 0.04, 0.15)); +// entity.hurt(new DamageSource(world.registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypes.CACTUS)), 2); +// } + } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/block/DragonTeethBlock.java b/src/main/java/com/atsuishio/superbwarfare/block/DragonTeethBlock.java new file mode 100644 index 000000000..8baa263d2 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/block/DragonTeethBlock.java @@ -0,0 +1,94 @@ +package com.atsuishio.superbwarfare.block; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.material.PushReaction; +import net.minecraft.world.level.pathfinder.PathType; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import javax.annotation.ParametersAreNonnullByDefault; + +@SuppressWarnings("deprecation") +public class DragonTeethBlock extends Block { + + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; + + public DragonTeethBlock() { + super(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 + @ParametersAreNonnullByDefault + public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos) { + return true; + } + + @Override + @ParametersAreNonnullByDefault + public int getLightBlock(BlockState state, BlockGetter worldIn, BlockPos pos) { + return 0; + } + + @Override + @ParametersAreNonnullByDefault + public @NotNull VoxelShape getVisualShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Shapes.empty(); + } + + @Override + @ParametersAreNonnullByDefault + public @NotNull VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Shapes.or(box(2, 0, 2, 14, 25, 14)); + } + + @Override + @ParametersAreNonnullByDefault + public @Nullable PathType getAdjacentBlockPathType(BlockState state, BlockGetter level, BlockPos pos, @Nullable Mob mob, PathType originalType) { + return PathType.LAVA; + } + + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(WATERLOGGED); + } + + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + boolean flag = context.getLevel().getFluidState(context.getClickedPos()).getType() == Fluids.WATER; + return this.defaultBlockState().setValue(WATERLOGGED, flag); + } + + @Override + public @NotNull FluidState getFluidState(BlockState state) { + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + + @Override + @ParametersAreNonnullByDefault + public @NotNull BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor world, BlockPos currentPos, BlockPos facingPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); + } + return super.updateShape(state, facing, facingState, world, currentPos, facingPos); + } +} + diff --git a/src/main/java/com/atsuishio/superbwarfare/block/JumpPadBlock.java b/src/main/java/com/atsuishio/superbwarfare/block/JumpPadBlock.java new file mode 100644 index 000000000..70d685947 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/block/JumpPadBlock.java @@ -0,0 +1,131 @@ +package com.atsuishio.superbwarfare.block; + +import com.atsuishio.superbwarfare.init.ModSounds; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; + +import javax.annotation.ParametersAreNonnullByDefault; + +@SuppressWarnings("deprecation") +public class JumpPadBlock extends Block { + + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; + public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + + public JumpPadBlock() { + super(Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(3f, 8f).noCollission().noOcclusion().isRedstoneConductor((bs, br, bp) -> false)); + this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, false)); + } + + @Override + @ParametersAreNonnullByDefault + public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos) { + return true; + } + + @Override + @ParametersAreNonnullByDefault + public @NotNull VoxelShape getVisualShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Shapes.empty(); + } + + @Override + @ParametersAreNonnullByDefault + public @NotNull VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch (state.getValue(FACING)) { + default -> + Shapes.or(box(0, 0, 0, 16, 3, 16), box(-0.25, -0.1, -0.25, 2, 3.25, 2), box(14, -0.1, -0.25, 16.25, 3.25, 2), box(14, -0.1, 14, 16.25, 3.25, 16.25), box(-0.25, -0.1, 14, 2, 3.25, 16.25), box(1, 3, 1, 15, 4, 15)); + case NORTH -> + Shapes.or(box(0, 0, 0, 16, 3, 16), box(14, -0.1, 14, 16.25, 3.25, 16.25), box(-0.25, -0.1, 14, 2, 3.25, 16.25), box(-0.25, -0.1, -0.25, 2, 3.25, 2), box(14, -0.1, -0.25, 16.25, 3.25, 2), box(1, 3, 1, 15, 4, 15)); + case EAST -> + Shapes.or(box(0, 0, 0, 16, 3, 16), box(-0.25, -0.1, 14, 2, 3.25, 16.25), box(-0.25, -0.1, -0.25, 2, 3.25, 2), box(14, -0.1, -0.25, 16.25, 3.25, 2), box(14, -0.1, 14, 16.25, 3.25, 16.25), box(1, 3, 1, 15, 4, 15)); + case WEST -> + Shapes.or(box(0, 0, 0, 16, 3, 16), box(14, -0.1, -0.25, 16.25, 3.25, 2), box(14, -0.1, 14, 16.25, 3.25, 16.25), box(-0.25, -0.1, 14, 2, 3.25, 16.25), box(-0.25, -0.1, -0.25, 2, 3.25, 2), box(1, 3, 1, 15, 4, 15)); + }; + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(FACING, WATERLOGGED); + } + + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + boolean flag = context.getLevel().getFluidState(context.getClickedPos()).getType() == Fluids.WATER; + return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()).setValue(WATERLOGGED, flag); + } + + @Override + public @NotNull FluidState getFluidState(BlockState state) { + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + + public @NotNull BlockState rotate(BlockState state, Rotation rot) { + return state.setValue(FACING, rot.rotate(state.getValue(FACING))); + } + + public @NotNull BlockState mirror(BlockState state, Mirror mirrorIn) { + return state.rotate(mirrorIn.getRotation(state.getValue(FACING))); + } + + @Override + @ParametersAreNonnullByDefault + public @NotNull BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor world, BlockPos currentPos, BlockPos facingPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); + } + return super.updateShape(state, facing, facingState, world, currentPos, facingPos); + } + + @Override + @ParametersAreNonnullByDefault + public void entityInside(BlockState blockstate, Level level, BlockPos pos, Entity entity) { + super.entityInside(blockstate, level, pos, entity); + + // 禁止套娃 + // TODO 套娃处理 +// if (entity instanceof TargetEntity || entity instanceof CannonEntity) return; + + if (entity.isShiftKeyDown()) { + if (entity.onGround()) { + entity.setDeltaMovement(new Vec3(5 * entity.getLookAngle().x, 1.5, 5 * entity.getLookAngle().z)); + } else { + entity.setDeltaMovement(new Vec3(1.8 * entity.getLookAngle().x, 1.5, 1.8 * entity.getLookAngle().z)); + } + } else { + entity.setDeltaMovement(new Vec3(0.7 * entity.getDeltaMovement().x(), 1.7, 0.7 * entity.getDeltaMovement().z())); + } + + if (!level.isClientSide()) { + level.playSound(null, BlockPos.containing(pos.getX(), pos.getY(), pos.getZ()), ModSounds.JUMP.get(), SoundSource.BLOCKS, 1, 1); + } else { + level.playLocalSound(pos.getX(), pos.getY(), pos.getZ(), ModSounds.JUMP.get(), SoundSource.BLOCKS, 1, 1, false); + } + + // TODO capability +// entity.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { +// capability.playerDoubleJump = true; +// capability.syncPlayerVariables(entity); +// }); + } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/block/ReforgingTableBlock.java b/src/main/java/com/atsuishio/superbwarfare/block/ReforgingTableBlock.java new file mode 100644 index 000000000..032c060bd --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/block/ReforgingTableBlock.java @@ -0,0 +1,128 @@ +package com.atsuishio.superbwarfare.block; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.network.chat.Component; +import net.minecraft.stats.Stats; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; + +import javax.annotation.ParametersAreNonnullByDefault; + +@SuppressWarnings("deprecation") +public class ReforgingTableBlock extends Block { + + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; + public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + private static final Component CONTAINER_TITLE = Component.translatable("container.superbwarfare.reforging_table"); + + public ReforgingTableBlock() { + super(Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(2f).lightLevel(s -> 4).hasPostProcess((bs, br, bp) -> true).emissiveRendering((bs, br, bp) -> true)); + this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, false)); + } + + @Override + @ParametersAreNonnullByDefault + protected @NotNull InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { + if (level.isClientSide) { + return InteractionResult.SUCCESS; + } else { + player.openMenu(state.getMenuProvider(level, pos)); + player.awardStat(Stats.INTERACT_WITH_ANVIL); + return InteractionResult.CONSUME; + } + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(FACING, WATERLOGGED); + } + + @Override + @ParametersAreNonnullByDefault + public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos) { + return true; + } + + @Override + @ParametersAreNonnullByDefault + public int getLightBlock(BlockState state, BlockGetter worldIn, BlockPos pos) { + return 0; + } + + + @Override + @ParametersAreNonnullByDefault + public @NotNull VoxelShape getVisualShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Shapes.empty(); + } + + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + boolean flag = context.getLevel().getFluidState(context.getClickedPos()).getType() == Fluids.WATER; + return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()).setValue(WATERLOGGED, flag); + } + + @Override + public @NotNull FluidState getFluidState(BlockState state) { + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + + public @NotNull BlockState rotate(BlockState state, Rotation rot) { + return state.setValue(FACING, rot.rotate(state.getValue(FACING))); + } + + public @NotNull BlockState mirror(BlockState state, Mirror mirrorIn) { + return state.rotate(mirrorIn.getRotation(state.getValue(FACING))); + } + + @Override + @ParametersAreNonnullByDefault + public @NotNull VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + Direction direction = state.getValue(FACING); + if (direction == Direction.NORTH || direction == Direction.SOUTH) { + return Shapes.or(box(0, 0, 0, 16, 1, 16), + box(1, 1, 1, 15, 3, 15), + box(5, 4, 6.5, 11, 16.6, 9.5)); + } else { + return Shapes.or(box(0, 0, 0, 16, 1, 16), + box(1, 1, 1, 15, 3, 15), + box(6.5, 4, 5, 9.5, 16.6, 11)); + } + } + + @Override + @ParametersAreNonnullByDefault + public @NotNull BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor world, BlockPos currentPos, BlockPos facingPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); + } + return super.updateShape(state, facing, facingState, world, currentPos, facingPos); + } + + // TODO Menu +// @Override +// @Nullable +// public MenuProvider getMenuProvider(BlockState pState, Level pLevel, BlockPos pPos) { +// return new SimpleMenuProvider((i, inventory, player) -> +// new ReforgingTableMenu(i, inventory, ContainerLevelAccess.create(pLevel, pPos)), CONTAINER_TITLE); +// } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/config/ClientConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/ClientConfig.java new file mode 100644 index 000000000..68f18ee71 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/config/ClientConfig.java @@ -0,0 +1,20 @@ +package com.atsuishio.superbwarfare.config; + +import com.atsuishio.superbwarfare.config.client.*; +import net.neoforged.neoforge.common.ModConfigSpec; + +public class ClientConfig { + + public static ModConfigSpec init() { + ModConfigSpec.Builder builder = new ModConfigSpec.Builder(); + + ReloadConfig.init(builder); + KillMessageConfig.init(builder); + DisplayConfig.init(builder); + VehicleControlConfig.init(builder); + EnvironmentChecksumConfig.init(builder); + + return builder.build(); + } + +} diff --git a/src/main/java/com/atsuishio/superbwarfare/config/CommonConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/CommonConfig.java new file mode 100644 index 000000000..ffca07812 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/config/CommonConfig.java @@ -0,0 +1,16 @@ +package com.atsuishio.superbwarfare.config; + +import com.atsuishio.superbwarfare.config.common.GameplayConfig; +import net.neoforged.neoforge.common.ModConfigSpec; + +public class CommonConfig { + + public static ModConfigSpec init() { + ModConfigSpec.Builder builder = new ModConfigSpec.Builder(); + + GameplayConfig.init(builder); + + return builder.build(); + } + +} diff --git a/src/main/java/com/atsuishio/superbwarfare/config/ServerConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/ServerConfig.java new file mode 100644 index 000000000..45cbb497c --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/config/ServerConfig.java @@ -0,0 +1,19 @@ +package com.atsuishio.superbwarfare.config; + +import com.atsuishio.superbwarfare.config.server.*; +import net.neoforged.neoforge.common.ModConfigSpec; + +public class ServerConfig { + + public static ModConfigSpec init() { + ModConfigSpec.Builder builder = new ModConfigSpec.Builder(); + + SpawnConfig.init(builder); + ProjectileConfig.init(builder); + ExplosionConfig.init(builder); + VehicleConfig.init(builder); + MiscConfig.init(builder); + + return builder.build(); + } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/config/client/DisplayConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/client/DisplayConfig.java new file mode 100644 index 000000000..c22cefcc5 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/config/client/DisplayConfig.java @@ -0,0 +1,33 @@ +package com.atsuishio.superbwarfare.config.client; + +import net.neoforged.neoforge.common.ModConfigSpec; + +public class DisplayConfig { + + public static ModConfigSpec.BooleanValue KILL_INDICATION; + public static ModConfigSpec.BooleanValue AMMO_HUD; + public static ModConfigSpec.BooleanValue FLOAT_CROSS_HAIR; + public static ModConfigSpec.BooleanValue CAMERA_ROTATE; + public static ModConfigSpec.BooleanValue ARMOR_PLATE_HUD; + + public static void init(ModConfigSpec.Builder builder) { + builder.push("display"); + + builder.comment("Set true if you want to show kill indication while killing an entity"); + KILL_INDICATION = builder.define("kill_indication", true); + + builder.comment("Set true to show ammo and gun info on HUD"); + AMMO_HUD = builder.define("ammo_hud", true); + + builder.comment("Set true to enable float cross hair"); + FLOAT_CROSS_HAIR = builder.define("float_cross_hair", true); + + builder.comment("Set true to enable camera rotate when holding a gun"); + CAMERA_ROTATE = builder.define("camera_rotate", true); + + builder.comment("Set true to enable armor plate hud"); + ARMOR_PLATE_HUD = builder.define("armor_plate_hud", true); + + builder.pop(); + } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/config/client/EnvironmentChecksumConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/client/EnvironmentChecksumConfig.java new file mode 100644 index 000000000..14337e01a --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/config/client/EnvironmentChecksumConfig.java @@ -0,0 +1,18 @@ +package com.atsuishio.superbwarfare.config.client; + +import net.neoforged.neoforge.common.ModConfigSpec; + +public class EnvironmentChecksumConfig { + + public static ModConfigSpec.ConfigValue ENVIRONMENT_CHECKSUM; + + public static void init(ModConfigSpec.Builder builder) { + builder.push("checksum"); + + builder.comment("System environment checksum, do not edit"); + ENVIRONMENT_CHECKSUM = builder.define("environment_checksum", ""); + + builder.pop(); + } + +} diff --git a/src/main/java/com/atsuishio/superbwarfare/config/client/KillMessageConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/client/KillMessageConfig.java new file mode 100644 index 000000000..bd8cb2782 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/config/client/KillMessageConfig.java @@ -0,0 +1,22 @@ +package com.atsuishio.superbwarfare.config.client; + +import net.neoforged.neoforge.common.ModConfigSpec; + +public class KillMessageConfig { + + public static ModConfigSpec.BooleanValue SHOW_KILL_MESSAGE; + public static ModConfigSpec.IntValue KILL_MESSAGE_COUNT; + + public static void init(ModConfigSpec.Builder builder) { + builder.push("kill_message"); + + builder.comment("Set true if you want to show kill message"); + SHOW_KILL_MESSAGE = builder.define("show_kill_message", true); + + builder.comment("The max count of kill messages to show concurrently"); + KILL_MESSAGE_COUNT = builder.defineInRange("kill_message_count", 5, 1, 20); + + builder.pop(); + } + +} diff --git a/src/main/java/com/atsuishio/superbwarfare/config/client/ReloadConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/client/ReloadConfig.java new file mode 100644 index 000000000..5eeb73bae --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/config/client/ReloadConfig.java @@ -0,0 +1,17 @@ +package com.atsuishio.superbwarfare.config.client; + +import net.neoforged.neoforge.common.ModConfigSpec; + +public class ReloadConfig { + + public static ModConfigSpec.BooleanValue LEFT_CLICK_RELOAD; + + public static void init(ModConfigSpec.Builder builder) { + builder.push("reload"); + + builder.comment("Set true if you want to reload guns when ammo is empty by clicking left button"); + LEFT_CLICK_RELOAD = builder.define("left_click_reload", true); + + builder.pop(); + } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/config/client/VehicleControlConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/client/VehicleControlConfig.java new file mode 100644 index 000000000..95fd38d03 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/config/client/VehicleControlConfig.java @@ -0,0 +1,17 @@ +package com.atsuishio.superbwarfare.config.client; + +import net.neoforged.neoforge.common.ModConfigSpec; + +public class VehicleControlConfig { + + public static ModConfigSpec.BooleanValue INVERT_AIRCRAFT_CONTROL; + + public static void init(ModConfigSpec.Builder builder) { + builder.push("invert_aircraft_control"); + + builder.comment("Set true to invert aircraft control"); + INVERT_AIRCRAFT_CONTROL = builder.define("invert_aircraft_control", false); + + builder.pop(); + } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/config/common/GameplayConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/common/GameplayConfig.java new file mode 100644 index 000000000..22ac08ba6 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/config/common/GameplayConfig.java @@ -0,0 +1,26 @@ +package com.atsuishio.superbwarfare.config.common; + +import net.neoforged.neoforge.common.ModConfigSpec; + +public class GameplayConfig { + + public static ModConfigSpec.BooleanValue RESPAWN_RELOAD; + public static ModConfigSpec.BooleanValue GLOBAL_INDICATION; + public static ModConfigSpec.BooleanValue RESPAWN_AUTO_ARMOR; + + public static void init(ModConfigSpec.Builder builder) { + builder.push("gameplay"); + + builder.comment("Set true if you want to reload all your guns when respawn"); + RESPAWN_RELOAD = builder.define("respawn_reload", true); + + builder.comment("Set false if you want to show kill indication ONLY while killing an entity with a gun"); + GLOBAL_INDICATION = builder.define("global_indication", true); + + builder.comment("Set true if you want to refill your armor plate when respawn"); + RESPAWN_AUTO_ARMOR = builder.define("respawn_auto_armor", true); + + builder.pop(); + } + +} diff --git a/src/main/java/com/atsuishio/superbwarfare/config/server/ExplosionConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/server/ExplosionConfig.java new file mode 100644 index 000000000..ef09fb1b3 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/config/server/ExplosionConfig.java @@ -0,0 +1,135 @@ +package com.atsuishio.superbwarfare.config.server; + +import net.neoforged.neoforge.common.ModConfigSpec; + +public class ExplosionConfig { + + public static ModConfigSpec.IntValue EXPLOSION_PENETRATION_RATIO; + public static ModConfigSpec.BooleanValue EXPLOSION_DESTROY; + + public static ModConfigSpec.IntValue RGO_GRENADE_EXPLOSION_DAMAGE; + public static ModConfigSpec.IntValue RGO_GRENADE_EXPLOSION_RADIUS; + + public static ModConfigSpec.IntValue M67_GRENADE_EXPLOSION_DAMAGE; + public static ModConfigSpec.IntValue M67_GRENADE_EXPLOSION_RADIUS; + + public static ModConfigSpec.IntValue MORTAR_SHELL_EXPLOSION_DAMAGE; + public static ModConfigSpec.IntValue MORTAR_SHELL_EXPLOSION_RADIUS; + + public static ModConfigSpec.IntValue DRONE_KAMIKAZE_HIT_DAMAGE; + public static ModConfigSpec.IntValue DRONE_KAMIKAZE_EXPLOSION_DAMAGE; + public static ModConfigSpec.IntValue DRONE_KAMIKAZE_EXPLOSION_RADIUS; + public static ModConfigSpec.IntValue DRONE_KAMIKAZE_HIT_DAMAGE_C4; + public static ModConfigSpec.IntValue DRONE_KAMIKAZE_HIT_DAMAGE_RPG; + + public static ModConfigSpec.IntValue C4_EXPLOSION_COUNTDOWN; + public static ModConfigSpec.IntValue C4_EXPLOSION_DAMAGE; + public static ModConfigSpec.IntValue C4_EXPLOSION_RADIUS; + + public static ModConfigSpec.IntValue RPG_EXPLOSION_DAMAGE; + public static ModConfigSpec.IntValue RPG_EXPLOSION_RADIUS; + + public static ModConfigSpec.IntValue WIRE_GUIDE_MISSILE_DAMAGE; + public static ModConfigSpec.IntValue WIRE_GUIDE_MISSILE_EXPLOSION_DAMAGE; + public static ModConfigSpec.IntValue WIRE_GUIDE_MISSILE_EXPLOSION_RADIUS; + + public static void init(ModConfigSpec.Builder builder) { + builder.push("explosion"); + + builder.comment("The percentage of explosion damage you take behind cover"); + EXPLOSION_PENETRATION_RATIO = builder.defineInRange("explosion_penetration_ratio", 15, 0, 100); + + builder.comment("Set true to allow Explosion to destroy blocks"); + EXPLOSION_DESTROY = builder.define("explosion_destroy", true); + + builder.push("RGO Grenade"); + + builder.comment("The explosion damage of RGO grenade"); + RGO_GRENADE_EXPLOSION_DAMAGE = builder.defineInRange("rgo_grenade_explosion_damage", 90, 1, 10000000); + + builder.comment("The explosion radius of RGO grenade"); + RGO_GRENADE_EXPLOSION_RADIUS = builder.defineInRange("rgo_grenade_explosion_radius", 5, 1, 50); + + builder.pop(); + + + builder.push("M67 Grenade"); + + builder.comment("The explosion damage of M67 grenade"); + M67_GRENADE_EXPLOSION_DAMAGE = builder.defineInRange("m67_grenade_explosion_damage", 120, 1, 10000000); + + builder.comment("The explosion radius of M67 grenade"); + M67_GRENADE_EXPLOSION_RADIUS = builder.defineInRange("m67_grenade_explosion_radius", 6, 1, 50); + + builder.pop(); + + + builder.push("Mortar Shell"); + + builder.comment("The explosion damage of Mortar shell"); + MORTAR_SHELL_EXPLOSION_DAMAGE = builder.defineInRange("mortar_shell_explosion_damage", 160, 1, 10000000); + + builder.comment("The explosion radius of Mortar shell"); + MORTAR_SHELL_EXPLOSION_RADIUS = builder.defineInRange("mortar_shell_explosion_radius", 9, 1, 50); + + builder.pop(); + + builder.push("Drone Kamikaze"); + + builder.comment("The hit damage of Drone Kamikaze"); + DRONE_KAMIKAZE_HIT_DAMAGE = builder.defineInRange("drone_kamikaze_hit_damage", 200, 1, 10000000); + + builder.comment("The hit damage of Drone Kamikaze with C4"); + DRONE_KAMIKAZE_HIT_DAMAGE_C4 = builder.defineInRange("drone_kamikaze_hit_damage_c4", 150, 1, 10000000); + + builder.comment("The hit damage of Drone Kamikaze with RPG"); + DRONE_KAMIKAZE_HIT_DAMAGE_RPG = builder.defineInRange("drone_kamikaze_hit_damage_rpg", 270, 1, 10000000); + + builder.comment("The explosion damage of Drone Kamikaze"); + DRONE_KAMIKAZE_EXPLOSION_DAMAGE = builder.defineInRange("drone_kamikaze_explosion_damage", 160, 1, 10000000); + + builder.comment("The explosion radius of Drone Kamikaze"); + DRONE_KAMIKAZE_EXPLOSION_RADIUS = builder.defineInRange("drone_kamikaze_explosion_radius", 9, 1, 50); + + + builder.pop(); + + builder.push("C4"); + + builder.comment("The explosion damage of C4"); + C4_EXPLOSION_DAMAGE = builder.defineInRange("c4_explosion_damage", 300, 1, Integer.MAX_VALUE); + + builder.comment("The explosion countdown of C4"); + C4_EXPLOSION_COUNTDOWN = builder.defineInRange("c4_explosion_countdown", 514, 1, Integer.MAX_VALUE); + + builder.comment("The explosion radius of C4"); + C4_EXPLOSION_RADIUS = builder.defineInRange("c4_explosion_radius", 10, 1, Integer.MAX_VALUE); + + builder.pop(); + + builder.push("Wire Guide Missile"); + + builder.comment("The damage of wire guide missile"); + WIRE_GUIDE_MISSILE_DAMAGE = builder.defineInRange("wire_guide_missile_damage", 700, 1, Integer.MAX_VALUE); + + builder.comment("The explosion damage of wire guide missile"); + WIRE_GUIDE_MISSILE_EXPLOSION_DAMAGE = builder.defineInRange("wire_guide_missile_explosion_damage", 60, 1, Integer.MAX_VALUE); + + builder.comment("The explosion radius of wre guide missile"); + WIRE_GUIDE_MISSILE_EXPLOSION_RADIUS = builder.defineInRange("wire_guide_missile_explosion_radius", 6, 1, Integer.MAX_VALUE); + + builder.pop(); + + builder.push("RPG"); + + builder.comment("The explosion damage of RPG"); + RPG_EXPLOSION_DAMAGE = builder.defineInRange("rpg_explosion_damage", 130, 1, Integer.MAX_VALUE); + + builder.comment("The explosion radius of RPG"); + RPG_EXPLOSION_RADIUS = builder.defineInRange("rpg_explosion_radius", 10, 1, Integer.MAX_VALUE); + + builder.pop(); + + builder.pop(); + } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/config/server/MiscConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/server/MiscConfig.java new file mode 100644 index 000000000..0d952d4c6 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/config/server/MiscConfig.java @@ -0,0 +1,21 @@ +package com.atsuishio.superbwarfare.config.server; + +import net.neoforged.neoforge.common.ModConfigSpec; + +public class MiscConfig { + + public static ModConfigSpec.BooleanValue ALLOW_TACTICAL_SPRINT; + public static ModConfigSpec.BooleanValue SEND_KILL_FEEDBACK; + + public static void init(ModConfigSpec.Builder builder) { + builder.push("misc"); + + builder.comment("Set true to enable tactical sprint"); + ALLOW_TACTICAL_SPRINT = builder.define("allow_tactical_sprint", true); + + builder.comment("Set true to enable kill feedback sending"); + SEND_KILL_FEEDBACK = builder.define("send_kill_feedback", true); + + builder.pop(); + } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/config/server/ProjectileConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/server/ProjectileConfig.java new file mode 100644 index 000000000..e8b68d6a2 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/config/server/ProjectileConfig.java @@ -0,0 +1,17 @@ +package com.atsuishio.superbwarfare.config.server; + +import net.neoforged.neoforge.common.ModConfigSpec; + +public class ProjectileConfig { + + public static ModConfigSpec.BooleanValue ALLOW_PROJECTILE_DESTROY_GLASS; + + public static void init(ModConfigSpec.Builder builder) { + builder.push("projectile"); + + builder.comment("Set true to allow projectiles to destroy glasses"); + ALLOW_PROJECTILE_DESTROY_GLASS = builder.define("allow_projectile_destroy_glass", false); + + builder.pop(); + } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/config/server/SpawnConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/server/SpawnConfig.java new file mode 100644 index 000000000..64de983ac --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/config/server/SpawnConfig.java @@ -0,0 +1,18 @@ +package com.atsuishio.superbwarfare.config.server; + +import net.neoforged.neoforge.common.ModConfigSpec; + +public class SpawnConfig { + + public static ModConfigSpec.BooleanValue SPAWN_SENPAI; + + public static void init(ModConfigSpec.Builder builder) { + builder.push("spawn"); + + builder.comment("Set true to allow Senpai to spawn naturally"); + SPAWN_SENPAI = builder.define("spawn_senpai", false); + + builder.pop(); + } + +} diff --git a/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java new file mode 100644 index 000000000..f60fb5579 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java @@ -0,0 +1,369 @@ +package com.atsuishio.superbwarfare.config.server; + +import net.neoforged.neoforge.common.ModConfigSpec; + +import java.util.List; + +public class VehicleConfig { + + public static ModConfigSpec.BooleanValue COLLISION_DESTROY_BLOCKS; + public static ModConfigSpec.BooleanValue COLLISION_DESTROY_HARD_BLOCKS; + public static ModConfigSpec.BooleanValue VEHICLE_ITEM_PICKUP; + + public static ModConfigSpec.ConfigValue> COLLISION_ENTITY_WHITELIST; + + public static final List DEFAULT_COLLISION_ENTITY_WHITELIST = List.of(); + + public static ModConfigSpec.IntValue REPAIR_COOLDOWN; + public static ModConfigSpec.DoubleValue REPAIR_AMOUNT; + + public static ModConfigSpec.IntValue MK42_HP; + public static ModConfigSpec.IntValue MK42_AP_DAMAGE; + public static ModConfigSpec.IntValue MK42_AP_EXPLOSION_DAMAGE; + public static ModConfigSpec.IntValue MK42_AP_EXPLOSION_RADIUS; + public static ModConfigSpec.IntValue MK42_HE_DAMAGE; + public static ModConfigSpec.IntValue MK42_HE_EXPLOSION_DAMAGE; + public static ModConfigSpec.IntValue MK42_HE_EXPLOSION_RADIUS; + + public static ModConfigSpec.IntValue MLE1934_HP; + public static ModConfigSpec.IntValue MLE1934_AP_DAMAGE; + public static ModConfigSpec.IntValue MLE1934_AP_EXPLOSION_DAMAGE; + public static ModConfigSpec.IntValue MLE1934_AP_EXPLOSION_RADIUS; + public static ModConfigSpec.IntValue MLE1934_HE_DAMAGE; + public static ModConfigSpec.IntValue MLE1934_HE_EXPLOSION_DAMAGE; + public static ModConfigSpec.IntValue MLE1934_HE_EXPLOSION_RADIUS; + + public static ModConfigSpec.IntValue HEAVY_MACHINE_GUN_DAMAGE; + + public static ModConfigSpec.IntValue ANNIHILATOR_HP; + public static ModConfigSpec.IntValue ANNIHILATOR_SHOOT_COST; + public static ModConfigSpec.IntValue ANNIHILATOR_MAX_ENERGY; + + public static ModConfigSpec.IntValue LASER_TOWER_HP; + public static ModConfigSpec.IntValue LASER_TOWER_COOLDOWN; + public static ModConfigSpec.IntValue LASER_TOWER_DAMAGE; + public static ModConfigSpec.IntValue LASER_TOWER_SHOOT_COST; + public static ModConfigSpec.IntValue LASER_TOWER_MAX_ENERGY; + + public static ModConfigSpec.IntValue SPEEDBOAT_HP; + public static ModConfigSpec.IntValue SPEEDBOAT_ENERGY_COST; + public static ModConfigSpec.IntValue SPEEDBOAT_MAX_ENERGY; + + public static ModConfigSpec.IntValue WHEELCHAIR_HP; + public static ModConfigSpec.IntValue WHEELCHAIR_JUMP_ENERGY_COST; + public static ModConfigSpec.IntValue WHEELCHAIR_MOVE_ENERGY_COST; + public static ModConfigSpec.IntValue WHEELCHAIR_MAX_ENERGY; + + public static ModConfigSpec.IntValue AH_6_HP; + public static ModConfigSpec.IntValue AH_6_MIN_ENERGY_COST; + public static ModConfigSpec.IntValue AH_6_MAX_ENERGY_COST; + public static ModConfigSpec.IntValue AH_6_MAX_ENERGY; + public static ModConfigSpec.IntValue AH_6_CANNON_DAMAGE; + public static ModConfigSpec.IntValue AH_6_ROCKET_DAMAGE; + public static ModConfigSpec.IntValue AH_6_ROCKET_EXPLOSION_DAMAGE; + public static ModConfigSpec.IntValue AH_6_ROCKET_EXPLOSION_RADIUS; + + public static ModConfigSpec.IntValue LAV_150_HP; + public static ModConfigSpec.IntValue LAV_150_ENERGY_COST; + public static ModConfigSpec.IntValue LAV_150_MAX_ENERGY; + public static ModConfigSpec.IntValue LAV_150_CANNON_DAMAGE; + public static ModConfigSpec.IntValue LAV_150_CANNON_EXPLOSION_DAMAGE; + public static ModConfigSpec.DoubleValue LAV_150_CANNON_EXPLOSION_RADIUS; + + public static ModConfigSpec.IntValue TOM_6_HP; + public static ModConfigSpec.IntValue TOM_6_MAX_ENERGY; + public static ModConfigSpec.IntValue TOM_6_ENERGY_COST; + public static ModConfigSpec.IntValue TOM_6_BOMB_EXPLOSION_DAMAGE; + public static ModConfigSpec.DoubleValue TOM_6_BOMB_EXPLOSION_RADIUS; + + public static ModConfigSpec.IntValue BMP_2_HP; + public static ModConfigSpec.IntValue BMP_2_ENERGY_COST; + public static ModConfigSpec.IntValue BMP_2_MAX_ENERGY; + public static ModConfigSpec.IntValue BMP_2_CANNON_DAMAGE; + public static ModConfigSpec.IntValue BMP_2_CANNON_EXPLOSION_DAMAGE; + public static ModConfigSpec.DoubleValue BMP_2_CANNON_EXPLOSION_RADIUS; + + public static ModConfigSpec.IntValue YX_100_HP; + public static ModConfigSpec.IntValue YX_100_SHOOT_COST; + public static ModConfigSpec.IntValue YX_100_ENERGY_COST; + public static ModConfigSpec.IntValue YX_100_MAX_ENERGY; + public static ModConfigSpec.IntValue YX_100_AP_CANNON_DAMAGE; + public static ModConfigSpec.IntValue YX_100_AP_CANNON_EXPLOSION_DAMAGE; + public static ModConfigSpec.DoubleValue YX_100_AP_CANNON_EXPLOSION_RADIUS; + public static ModConfigSpec.IntValue YX_100_HE_CANNON_DAMAGE; + public static ModConfigSpec.IntValue YX_100_HE_CANNON_EXPLOSION_DAMAGE; + public static ModConfigSpec.DoubleValue YX_100_HE_CANNON_EXPLOSION_RADIUS; + + public static void init(ModConfigSpec.Builder builder) { + builder.push("vehicle"); + + builder.comment("Allows vehicles to destroy blocks via collision"); + COLLISION_DESTROY_BLOCKS = builder.define("collision_destroy_blocks", false); + + builder.comment("Allows vehicles to destroy hard blocks via collision"); + COLLISION_DESTROY_HARD_BLOCKS = builder.define("collision_destroy_hard_blocks", false); + + builder.comment("Allow vehicles to pick up items"); + VEHICLE_ITEM_PICKUP = builder.define("vehicle_item_pickup", true); + + builder.comment("List of entities that can be damaged by collision"); + COLLISION_ENTITY_WHITELIST = builder.defineList("collision_entity_whitelist", + DEFAULT_COLLISION_ENTITY_WHITELIST, + e -> e instanceof String); + + builder.push("repair"); + + builder.comment("The cooldown of vehicle repair. Set a negative value to disable vehicle repair"); + REPAIR_COOLDOWN = builder.defineInRange("repair_cooldown", 200, -1, 10000000); + + builder.comment("The amount of health restored per tick when a vehicle is self-repairing"); + REPAIR_AMOUNT = builder.defineInRange("repair_amount", 0.05d, 0, 10000000); + + builder.pop(); + + builder.push("mk_42"); + + builder.comment("The health of MK-42"); + MK42_HP = builder.defineInRange("mk_42_hp", 350, 1, 10000000); + + builder.comment("The AP shell damage of MK-42"); + MK42_AP_DAMAGE = builder.defineInRange("mk_42_ap_damage", 450, 1, 10000000); + + builder.comment("The AP shell explosion damage of MK-42"); + MK42_AP_EXPLOSION_DAMAGE = builder.defineInRange("mk_42_ap_explosion_damage", 120, 1, 10000000); + + builder.comment("The AP shell explosion radius of MK-42"); + MK42_AP_EXPLOSION_RADIUS = builder.defineInRange("mk_42_ap_explosion_radius", 3, 1, 50); + + builder.comment("The HE shell damage of MK-42"); + MK42_HE_DAMAGE = builder.defineInRange("mk_42_he_damage", 150, 1, 10000000); + + builder.comment("The HE shell explosion damage of MK-42"); + MK42_HE_EXPLOSION_DAMAGE = builder.defineInRange("mk_42_he_explosion_damage", 200, 1, 10000000); + + builder.comment("The HE shell explosion radius of MK-42"); + MK42_HE_EXPLOSION_RADIUS = builder.defineInRange("mk_42_he_explosion_radius", 10, 1, 50); + + builder.pop(); + + builder.push("mle_1934"); + + builder.comment("The health of MLE-1934"); + MLE1934_HP = builder.defineInRange("mle_1934_hp", 350, 1, 10000000); + + builder.comment("The AP shell damage of MLE-1934"); + MLE1934_AP_DAMAGE = builder.defineInRange("mle_1934_ap_damage", 500, 1, 10000000); + + builder.comment("The AP shell explosion damage of MLE-1934"); + MLE1934_AP_EXPLOSION_DAMAGE = builder.defineInRange("mle_1934_ap_explosion_damage", 150, 1, 10000000); + + builder.comment("The AP shell explosion radius of MLE-1934"); + MLE1934_AP_EXPLOSION_RADIUS = builder.defineInRange("mle_1934_ap_explosion_radius", 4, 1, 50); + + builder.comment("The HE shell damage of MLE-1934"); + MLE1934_HE_DAMAGE = builder.defineInRange("mle_1934_he_damage", 180, 1, 10000000); + + builder.comment("The HE shell explosion damage of MLE-1934"); + MLE1934_HE_EXPLOSION_DAMAGE = builder.defineInRange("mle_1934_he_explosion_damage", 240, 1, 10000000); + + builder.comment("The HE shell explosion radius of MLE-1934"); + MLE1934_HE_EXPLOSION_RADIUS = builder.defineInRange("mle_1934_he_explosion_radius", 12, 1, 50); + + builder.pop(); + + builder.push("HeavyMachineGun"); + + builder.comment("The gun damage of 12.7mm HMG"); + HEAVY_MACHINE_GUN_DAMAGE = builder.defineInRange("heavy_machine_gun_damage", 25, 1, 10000000); + + builder.pop(); + + builder.push("annihilator"); + + builder.comment("The health of Annihilator"); + ANNIHILATOR_HP = builder.defineInRange("annihilator_hp", 1200, 1, 10000000); + + builder.comment("The energy cost of Annihilator per shoot"); + ANNIHILATOR_SHOOT_COST = builder.defineInRange("annihilator_shoot_cost", 2000000, 0, 2147483647); + + builder.comment("The max energy storage of Annihilator"); + ANNIHILATOR_MAX_ENERGY = builder.defineInRange("annihilator_max_energy", 20000000, 0, 2147483647); + + builder.pop(); + + builder.push("laser_tower"); + + builder.comment("The health of Laser Tower"); + LASER_TOWER_HP = builder.defineInRange("laser_tower_hp", 100, 1, 10000000); + + builder.comment("The damage of Laser Tower"); + LASER_TOWER_DAMAGE = builder.defineInRange("laser_tower_damage", 15, 1, 10000000); + + builder.comment("The cooldown time(ticks) of Laser Tower"); + LASER_TOWER_COOLDOWN = builder.defineInRange("laser_tower_cooldown", 40, 15, 10000000); + + builder.comment("The energy cost of Laser Tower per shoot"); + LASER_TOWER_SHOOT_COST = builder.defineInRange("laser_tower_shoot_cost", 5000, 0, 2147483647); + + builder.comment("The max energy storage of Laser Tower"); + LASER_TOWER_MAX_ENERGY = builder.defineInRange("laser_tower_max_energy", 500000, 0, 2147483647); + + builder.pop(); + + builder.push("speedboat"); + + builder.comment("The health of Speedboat"); + SPEEDBOAT_HP = builder.defineInRange("speedboat_hp", 200, 1, 10000000); + + builder.comment("The energy cost of Speedboat per tick"); + SPEEDBOAT_ENERGY_COST = builder.defineInRange("speedboat_energy_cost", 16, 0, 2147483647); + + builder.comment("The max energy storage of Speedboat"); + SPEEDBOAT_MAX_ENERGY = builder.defineInRange("speedboat_max_energy", 500000, 0, 2147483647); + + builder.pop(); + + builder.push("wheelchair"); + + builder.comment("The health of the wheelchair"); + WHEELCHAIR_HP = builder.defineInRange("wheelchair_hp", 30, 1, 10000000); + + builder.comment("The jump energy cost of the wheelchair"); + WHEELCHAIR_JUMP_ENERGY_COST = builder.defineInRange("wheelchair_jump_energy_cost", 400, 0, 2147483647); + + builder.comment("The move energy cost of the wheelchair"); + WHEELCHAIR_MOVE_ENERGY_COST = builder.defineInRange("wheelchair_move_energy_cost", 1, 0, 2147483647); + + builder.comment("The max energy storage of the wheelchair"); + WHEELCHAIR_MAX_ENERGY = builder.defineInRange("wheelchair_max_energy", 24000, 0, 2147483647); + + builder.pop(); + + builder.push("ah_6"); + + builder.comment("The health of AH-6"); + AH_6_HP = builder.defineInRange("ah_6_hp", 250, 1, 10000000); + + builder.comment("The min energy cost of AH-6 per tick"); + AH_6_MIN_ENERGY_COST = builder.defineInRange("ah_6_min_energy_cost", 64, 0, 2147483647); + + builder.comment("The max energy cost of AH-6 per tick"); + AH_6_MAX_ENERGY_COST = builder.defineInRange("ah_6_max_energy_cost", 128, 0, 2147483647); + + builder.comment("The max energy storage of AH-6"); + AH_6_MAX_ENERGY = builder.defineInRange("ah_6_max_energy", 5000000, 0, 2147483647); + + builder.comment("The cannon damage of AH-6"); + AH_6_CANNON_DAMAGE = builder.defineInRange("ah_6_cannon_damage", 20, 1, 10000000); + + builder.comment("The rocket damage of AH-6"); + AH_6_ROCKET_DAMAGE = builder.defineInRange("ah_6_rocket_damage", 80, 1, 10000000); + + builder.comment("The rocket explosion damage of AH-6"); + AH_6_ROCKET_EXPLOSION_DAMAGE = builder.defineInRange("ah_6_rocket_explosion_damage", 40, 1, 10000000); + + builder.comment("The rocket explosion radius of AH-6"); + AH_6_ROCKET_EXPLOSION_RADIUS = builder.defineInRange("ah_6_rocket_explosion_radius", 5, 1, 10000000); + + builder.pop(); + + builder.push("lav_150"); + + builder.comment("The health of Lav_150"); + LAV_150_HP = builder.defineInRange("lav_150_hp", 250, 1, 10000000); + + builder.comment("The energy cost of Lav_150 per tick"); + LAV_150_ENERGY_COST = builder.defineInRange("lav_150_energy_cost", 64, 0, 2147483647); + + builder.comment("The max energy storage of Lav_150"); + LAV_150_MAX_ENERGY = builder.defineInRange("lav_150_max_energy", 5000000, 0, 2147483647); + + builder.comment("The cannon damage of Lav_150"); + LAV_150_CANNON_DAMAGE = builder.defineInRange("lav_150_cannon_damage", 45, 1, 10000000); + + builder.comment("The rocket explosion damage of Lav_150"); + LAV_150_CANNON_EXPLOSION_DAMAGE = builder.defineInRange("lav_150_cannon_explosion_damage", 12, 1, 10000000); + + builder.comment("The rocket explosion radius of Lav_150"); + LAV_150_CANNON_EXPLOSION_RADIUS = builder.defineInRange("lav_150_cannon_explosion_radius", 3d, 1d, 10000000d); + + builder.pop(); + + builder.push("tom_6"); + + builder.comment("The health of Tom_6"); + TOM_6_HP = builder.defineInRange("tom_6_hp", 40, 1, 10000000); + + builder.comment("The energy cost of Tom_6 per tick"); + TOM_6_ENERGY_COST = builder.defineInRange("tom_6_energy_cost", 16, 0, 2147483647); + + builder.comment("The max energy storage of Tom_6"); + TOM_6_MAX_ENERGY = builder.defineInRange("tom_6_max_energy", 100000, 0, 2147483647); + + builder.comment("The Melon Bomb explosion damage of Tom_6"); + TOM_6_BOMB_EXPLOSION_DAMAGE = builder.defineInRange("tom_6_bomb_explosion_damage", 500, 1, 10000000); + + builder.comment("The Melon Bomb explosion radius of Tom_6"); + TOM_6_BOMB_EXPLOSION_RADIUS = builder.defineInRange("tom_6_bomb_explosion_radius", 10d, 1d, 10000000d); + + builder.pop(); + + builder.push("bmp_2"); + + builder.comment("The health of Bmp_2"); + BMP_2_HP = builder.defineInRange("bmp_2_hp", 300, 1, 10000000); + + builder.comment("The energy cost of Bmp_2 per tick"); + BMP_2_ENERGY_COST = builder.defineInRange("bmp_2_energy_cost", 64, 0, 2147483647); + + builder.comment("The max energy storage of Bmp_2"); + BMP_2_MAX_ENERGY = builder.defineInRange("bmp_2_max_energy", 5000000, 0, 2147483647); + + builder.comment("The cannon damage of Bmp_2"); + BMP_2_CANNON_DAMAGE = builder.defineInRange("bmp_2_cannon_damage", 55, 1, 10000000); + + builder.comment("The cannon explosion damage of Bmp_2"); + BMP_2_CANNON_EXPLOSION_DAMAGE = builder.defineInRange("bmp_2_cannon_explosion_damage", 15, 1, 10000000); + + builder.comment("The cannon explosion radius of Bmp_2"); + BMP_2_CANNON_EXPLOSION_RADIUS = builder.defineInRange("bmp_2_cannon_explosion_radius", 3.2d, 1d, 10000000d); + + builder.pop(); + + builder.push("yx_100"); + + builder.comment("The health of Yx_100"); + YX_100_HP = builder.defineInRange("yx_100_hp", 500, 1, 10000000); + + builder.comment("The energy cost of Yx_100 per tick"); + YX_100_ENERGY_COST = builder.defineInRange("yx_100_energy_cost", 128, 0, 2147483647); + + builder.comment("The energy cost of Yx_100 per shoot"); + YX_100_SHOOT_COST = builder.defineInRange("yx_100_shoot_cost", 24000, 0, 2147483647); + + builder.comment("The max energy storage of Yx_100"); + YX_100_MAX_ENERGY = builder.defineInRange("yx_100_max_energy", 20000000, 0, 2147483647); + + builder.comment("The cannon damage of Yx_100"); + YX_100_AP_CANNON_DAMAGE = builder.defineInRange("yx_100_ap_cannon_damage", 500, 1, 10000000); + + builder.comment("The cannon explosion damage of Yx_100"); + YX_100_AP_CANNON_EXPLOSION_DAMAGE = builder.defineInRange("yx_100_ap_cannon_explosion_damage", 100, 1, 10000000); + + builder.comment("The cannon explosion radius of Yx_100"); + YX_100_AP_CANNON_EXPLOSION_RADIUS = builder.defineInRange("yx_100_ap_cannon_explosion_radius", 4d, 1d, 10000000d); + + builder.comment("The cannon damage of Yx_100"); + YX_100_HE_CANNON_DAMAGE = builder.defineInRange("yx_100_he_cannon_damage", 150, 1, 10000000); + + builder.comment("The cannon explosion damage of Yx_100"); + YX_100_HE_CANNON_EXPLOSION_DAMAGE = builder.defineInRange("yx_100_he_cannon_explosion_damage", 150, 1, 10000000); + + builder.comment("The cannon explosion radius of Yx_100"); + YX_100_HE_CANNON_EXPLOSION_RADIUS = builder.defineInRange("yx_100_he_cannon_explosion_radius", 10d, 1d, 10000000d); + + builder.pop(); + + builder.pop(); + } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModBlocks.java b/src/main/java/com/atsuishio/superbwarfare/init/ModBlocks.java new file mode 100644 index 000000000..4453d656c --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModBlocks.java @@ -0,0 +1,54 @@ +package com.atsuishio.superbwarfare.init; + +import com.atsuishio.superbwarfare.ModUtils; +import com.atsuishio.superbwarfare.block.BarbedWireBlock; +import com.atsuishio.superbwarfare.block.DragonTeethBlock; +import com.atsuishio.superbwarfare.block.JumpPadBlock; +import com.atsuishio.superbwarfare.block.ReforgingTableBlock; +import net.minecraft.core.registries.BuiltInRegistries; +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.neoforged.neoforge.registries.DeferredHolder; +import net.neoforged.neoforge.registries.DeferredRegister; + +@SuppressWarnings("unused") +public class ModBlocks { + + public static final DeferredRegister REGISTRY = DeferredRegister.create(BuiltInRegistries.BLOCK, ModUtils.MODID); + + public static final DeferredHolder SANDBAG = REGISTRY.register("sandbag", + () -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.SNARE).sound(SoundType.SAND).strength(10f, 20f))); + public static final DeferredHolder BARBED_WIRE = REGISTRY.register("barbed_wire", BarbedWireBlock::new); + public static final DeferredHolder JUMP_PAD = REGISTRY.register("jump_pad", JumpPadBlock::new); + public static final DeferredHolder GALENA_ORE = REGISTRY.register("galena_ore", + () -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(3f, 5f).requiresCorrectToolForDrops())); + public static final DeferredHolder 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 DeferredHolder SCHEELITE_ORE = REGISTRY.register("scheelite_ore", + () -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(3f, 5f).requiresCorrectToolForDrops())); + public static final DeferredHolder 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 DeferredHolder SILVER_ORE = REGISTRY.register("silver_ore", + () -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(3f, 5f).requiresCorrectToolForDrops())); + public static final DeferredHolder 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 DeferredHolder DRAGON_TEETH = REGISTRY.register("dragon_teeth", DragonTeethBlock::new); + public static final DeferredHolder REFORGING_TABLE = REGISTRY.register("reforging_table", ReforgingTableBlock::new); + public static final DeferredHolder LEAD_BLOCK = REGISTRY.register("lead_block", + () -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops())); + public static final DeferredHolder STEEL_BLOCK = REGISTRY.register("steel_block", + () -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops())); + public static final DeferredHolder TUNGSTEN_BLOCK = REGISTRY.register("tungsten_block", + () -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops())); + public static final DeferredHolder SILVER_BLOCK = REGISTRY.register("silver_block", + () -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops())); + public static final DeferredHolder CEMENTED_CARBIDE_BLOCK = REGISTRY.register("cemented_carbide_block", + () -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops())); + // TODO blocks +// public static final DeferredHolder CONTAINER = REGISTRY.register("container", ContainerBlock::new); +// public static final DeferredHolder CHARGING_STATION = REGISTRY.register("charging_station", ChargingStationBlock::new); +// public static final DeferredHolder CREATIVE_CHARGING_STATION = REGISTRY.register("creative_charging_station", CreativeChargingStationBlock::new); +// public static final DeferredHolder FUMO_25 = REGISTRY.register("fumo_25", FuMO25Block::new); +} diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModItems.java b/src/main/java/com/atsuishio/superbwarfare/init/ModItems.java index 07f2f132d..3222a5482 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModItems.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModItems.java @@ -5,6 +5,7 @@ import com.atsuishio.superbwarfare.item.FiringParameters; import com.atsuishio.superbwarfare.item.PerkItem; import com.atsuishio.superbwarfare.item.ShortcutPack; import com.atsuishio.superbwarfare.item.common.BlueprintItem; +import com.atsuishio.superbwarfare.item.common.CannonShellItem; import com.atsuishio.superbwarfare.item.common.MaterialPack; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; @@ -83,9 +84,9 @@ public class ModItems { // public static final DeferredHolder POTION_MORTAR_SHELL = AMMO.register("potion_mortar_shell", PotionMortarShell::new); // public static final DeferredHolder ROCKET = AMMO.register("rocket", Rocket::new); // public static final DeferredHolder LUNGE_MINE = AMMO.register("lunge_mine", LungeMine::new); -// public static final DeferredHolder HE_5_INCHES = AMMO.register("he_5_inches", () -> new CannonShellItem(new Item.Properties().rarity(Rarity.RARE))); -// public static final DeferredHolder AP_5_INCHES = AMMO.register("ap_5_inches", () -> new CannonShellItem(new Item.Properties().rarity(Rarity.RARE))); -// public static final DeferredHolder HAND_GRENADE = AMMO.register("hand_grenade", HandGrenade::new); + public static final DeferredHolder HE_5_INCHES = AMMO.register("he_5_inches", () -> new CannonShellItem(new Item.Properties().rarity(Rarity.RARE))); + public static final DeferredHolder AP_5_INCHES = AMMO.register("ap_5_inches", () -> new CannonShellItem(new Item.Properties().rarity(Rarity.RARE))); + // public static final DeferredHolder HAND_GRENADE = AMMO.register("hand_grenade", HandGrenade::new); // public static final DeferredHolder RGO_GRENADE = AMMO.register("rgo_grenade", RgoGrenade::new); // public static final DeferredHolder CLAYMORE_MINE = AMMO.register("claymore_mine", ClaymoreMine::new); // public static final DeferredHolder C4_BOMB = AMMO.register("c4_bomb", C4Bomb::new); @@ -231,25 +232,25 @@ public class ModItems { */ public static final DeferredRegister BLOCKS = DeferredRegister.create(BuiltInRegistries.ITEM, ModUtils.MODID); -// public static final DeferredHolder GALENA_ORE = block(ModBlocks.GALENA_ORE); -// public static final DeferredHolder DEEPSLATE_GALENA_ORE = block(ModBlocks.DEEPSLATE_GALENA_ORE); -// public static final DeferredHolder SCHEELITE_ORE = block(ModBlocks.SCHEELITE_ORE); -// public static final DeferredHolder DEEPSLATE_SCHEELITE_ORE = block(ModBlocks.DEEPSLATE_SCHEELITE_ORE); -// public static final DeferredHolder SILVER_ORE = block(ModBlocks.SILVER_ORE); -// public static final DeferredHolder DEEPSLATE_SILVER_ORE = block(ModBlocks.DEEPSLATE_SILVER_ORE); -// public static final DeferredHolder JUMP_PAD = block(ModBlocks.JUMP_PAD); -// public static final DeferredHolder SANDBAG = block(ModBlocks.SANDBAG); -// public static final DeferredHolder BARBED_WIRE = block(ModBlocks.BARBED_WIRE); -// public static final DeferredHolder DRAGON_TEETH = block(ModBlocks.DRAGON_TEETH); -// public static final DeferredHolder REFORGING_TABLE = block(ModBlocks.REFORGING_TABLE); -// public static final DeferredHolder CHARGING_STATION = block(ModBlocks.CHARGING_STATION); + public static final DeferredHolder GALENA_ORE = block(ModBlocks.GALENA_ORE); + public static final DeferredHolder DEEPSLATE_GALENA_ORE = block(ModBlocks.DEEPSLATE_GALENA_ORE); + public static final DeferredHolder SCHEELITE_ORE = block(ModBlocks.SCHEELITE_ORE); + public static final DeferredHolder DEEPSLATE_SCHEELITE_ORE = block(ModBlocks.DEEPSLATE_SCHEELITE_ORE); + public static final DeferredHolder SILVER_ORE = block(ModBlocks.SILVER_ORE); + public static final DeferredHolder DEEPSLATE_SILVER_ORE = block(ModBlocks.DEEPSLATE_SILVER_ORE); + public static final DeferredHolder JUMP_PAD = block(ModBlocks.JUMP_PAD); + public static final DeferredHolder SANDBAG = block(ModBlocks.SANDBAG); + public static final DeferredHolder BARBED_WIRE = block(ModBlocks.BARBED_WIRE); + public static final DeferredHolder DRAGON_TEETH = block(ModBlocks.DRAGON_TEETH); + public static final DeferredHolder REFORGING_TABLE = block(ModBlocks.REFORGING_TABLE); + // public static final DeferredHolder CHARGING_STATION = block(ModBlocks.CHARGING_STATION); // public static final DeferredHolder CREATIVE_CHARGING_STATION = BLOCKS.register("creative_charging_station", // () -> new CreativeChargingStationBlockItem(ModBlocks.CREATIVE_CHARGING_STATION.get(), new Item.Properties().rarity(Rarity.EPIC))); -// public static final DeferredHolder LEAD_BLOCK = block(ModBlocks.LEAD_BLOCK); -// public static final DeferredHolder STEEL_BLOCK = block(ModBlocks.STEEL_BLOCK); -// public static final DeferredHolder TUNGSTEN_BLOCK = block(ModBlocks.TUNGSTEN_BLOCK); -// public static final DeferredHolder SILVER_BLOCK = block(ModBlocks.SILVER_BLOCK); -// public static final DeferredHolder CEMENTED_CARBIDE_BLOCK = block(ModBlocks.CEMENTED_CARBIDE_BLOCK); + public static final DeferredHolder LEAD_BLOCK = block(ModBlocks.LEAD_BLOCK); + public static final DeferredHolder STEEL_BLOCK = block(ModBlocks.STEEL_BLOCK); + public static final DeferredHolder TUNGSTEN_BLOCK = block(ModBlocks.TUNGSTEN_BLOCK); + public static final DeferredHolder SILVER_BLOCK = block(ModBlocks.SILVER_BLOCK); + public static final DeferredHolder CEMENTED_CARBIDE_BLOCK = block(ModBlocks.CEMENTED_CARBIDE_BLOCK); // public static final DeferredHolder FUMO_25 = block(ModBlocks.FUMO_25); /** diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModTabs.java b/src/main/java/com/atsuishio/superbwarfare/init/ModTabs.java index 76c0efc34..3b1f890cd 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModTabs.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModTabs.java @@ -96,13 +96,13 @@ public static final DeferredHolder AMMO_TAB = .displayItems((param, output) -> ModItems.ITEMS.getEntries().forEach(registryObject -> output.accept(registryObject.get()))) .build()); -// public static final RegistryObject BLOCK_TAB = TABS.register("block", -// () -> CreativeModeTab.builder() -// .title(Component.translatable("item_group.superbwarfare.block")) -// .icon(() -> new ItemStack(ModItems.SANDBAG.get())) -// .withTabsBefore(ITEM_TAB.getKey()) -// .displayItems((param, output) -> ModItems.BLOCKS.getEntries().forEach(registryObject -> output.accept(registryObject.get()))) -// .build()); + public static final DeferredHolder BLOCK_TAB = TABS.register("block", + () -> CreativeModeTab.builder() + .title(Component.translatable("item_group.superbwarfare.block")) + .icon(() -> new ItemStack(ModItems.SANDBAG.get())) + .withTabsBefore(ITEM_TAB.getKey()) + .displayItems((param, output) -> ModItems.BLOCKS.getEntries().forEach(registryObject -> output.accept(registryObject.get()))) + .build()); @SubscribeEvent public static void buildTabContentsVanilla(BuildCreativeModeTabContentsEvent tabData) { diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModVillagers.java b/src/main/java/com/atsuishio/superbwarfare/init/ModVillagers.java new file mode 100644 index 000000000..d9487e2a4 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModVillagers.java @@ -0,0 +1,256 @@ +package com.atsuishio.superbwarfare.init; + +import com.atsuishio.superbwarfare.ModUtils; +import com.google.common.collect.ImmutableSet; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.entity.ai.village.poi.PoiType; +import net.minecraft.world.entity.npc.VillagerProfession; +import net.minecraft.world.entity.npc.VillagerTrades; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.common.BasicItemListing; +import net.neoforged.neoforge.event.village.VillagerTradesEvent; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.neoforged.neoforge.registries.DeferredRegister; + +import java.util.List; + +@EventBusSubscriber(modid = ModUtils.MODID) +public class ModVillagers { + + public static final DeferredRegister POI_TYPES = DeferredRegister.create(BuiltInRegistries.POINT_OF_INTEREST_TYPE, ModUtils.MODID); + public static final DeferredRegister VILLAGER_PROFESSIONS = DeferredRegister.create(BuiltInRegistries.VILLAGER_PROFESSION, ModUtils.MODID); + + public static final DeferredHolder ARMORY_POI = POI_TYPES.register("armory", + () -> new PoiType(ImmutableSet.copyOf(ModBlocks.REFORGING_TABLE.get().getStateDefinition().getPossibleStates()), 1, 1)); + + public static final DeferredHolder ARMORY = VILLAGER_PROFESSIONS.register("armory", + () -> new VillagerProfession("armory", holder -> holder.value() == ARMORY_POI.get(), holder -> holder.value() == ARMORY_POI.get(), + ImmutableSet.of(), ImmutableSet.of(), null)); + + public static void register(IEventBus eventBus) { + POI_TYPES.register(eventBus); + VILLAGER_PROFESSIONS.register(eventBus); + } + + @SubscribeEvent + public static void addCustomTrades(VillagerTradesEvent event) { + if (event.getType() == ModVillagers.ARMORY.get()) { + Int2ObjectMap> trades = event.getTrades(); + + // 等级 1 交易 + trades.get(1).add(new BasicItemListing(new ItemStack(ModItems.TASER_BLUEPRINT.get()), + new ItemStack(Items.EMERALD, 2), 16, 5, 0.05f)); + +// trades.get(1).add(new BasicItemListing(new ItemStack(Items.EMERALD, 1), +// new ItemStack(ModItems.HANDGUN_AMMO.get(), 20), 16, 1, 0.05f)); +// trades.get(1).add(new BasicItemListing(new ItemStack(Items.EMERALD, 1), +// new ItemStack(ModItems.RIFLE_AMMO.get(), 15), 16, 1, 0.05f)); +// trades.get(1).add(new BasicItemListing(new ItemStack(Items.EMERALD, 1), +// new ItemStack(ModItems.SNIPER_AMMO.get(), 8), 16, 1, 0.05f)); +// trades.get(1).add(new BasicItemListing(new ItemStack(Items.EMERALD, 1), +// new ItemStack(ModItems.SHOTGUN_AMMO.get(), 8), 16, 1, 0.05f)); +// trades.get(1).add(new BasicItemListing(new ItemStack(Items.EMERALD, 1), +// new ItemStack(ModItems.HEAVY_AMMO.get(), 6), 32, 1, 0.05f)); + trades.get(1).add(new BasicItemListing(new ItemStack(Items.EMERALD, 1), + new ItemStack(ModItems.SMALL_SHELL.get(), 4), 32, 1, 0.05f)); + +// trades.get(1).add(new BasicItemListing(new ItemStack(ModItems.HANDGUN_AMMO.get(), 40), +// new ItemStack(Items.EMERALD, 1), 32, 2, 0.05f)); +// trades.get(1).add(new BasicItemListing(new ItemStack(ModItems.RIFLE_AMMO.get(), 30), +// new ItemStack(Items.EMERALD, 1), 32, 2, 0.05f)); +// trades.get(1).add(new BasicItemListing(new ItemStack(ModItems.SNIPER_AMMO.get(), 16), +// new ItemStack(Items.EMERALD, 1), 32, 2, 0.05f)); +// trades.get(1).add(new BasicItemListing(new ItemStack(ModItems.SHOTGUN_AMMO.get(), 16), +// new ItemStack(Items.EMERALD, 1), 32, 2, 0.05f)); +// trades.get(1).add(new BasicItemListing(new ItemStack(ModItems.HEAVY_AMMO.get(), 12), +// new ItemStack(Items.EMERALD, 1), 64, 2, 0.05f)); + trades.get(1).add(new BasicItemListing(new ItemStack(ModItems.SMALL_SHELL.get(), 8), + new ItemStack(Items.EMERALD, 1), 64, 2, 0.05f)); + + // 等级 2 交易 + trades.get(2).add(new BasicItemListing(new ItemStack(Items.EMERALD, 10), + new ItemStack(ModItems.STEEL_ACTION.get()), 12, 5, 0.05f)); + trades.get(2).add(new BasicItemListing(new ItemStack(Items.EMERALD, 8), + new ItemStack(ModItems.STEEL_BARREL.get()), 12, 5, 0.05f)); + trades.get(2).add(new BasicItemListing(new ItemStack(Items.EMERALD, 6), + new ItemStack(ModItems.STEEL_TRIGGER.get()), 12, 5, 0.05f)); + trades.get(2).add(new BasicItemListing(new ItemStack(Items.EMERALD, 8), + new ItemStack(ModItems.STEEL_SPRING.get()), 12, 5, 0.05f)); + + trades.get(2).add(new BasicItemListing(new ItemStack(Items.EMERALD, 16), + new ItemStack(ModItems.MARLIN_BLUEPRINT.get()), 8, 25, 0.05f)); + trades.get(2).add(new BasicItemListing(new ItemStack(Items.EMERALD, 16), + new ItemStack(ModItems.GLOCK_17_BLUEPRINT.get()), 8, 15, 0.05f)); + trades.get(2).add(new BasicItemListing(new ItemStack(Items.EMERALD, 16), + new ItemStack(ModItems.M_1911_BLUEPRINT.get()), 8, 15, 0.05f)); + trades.get(2).add(new BasicItemListing(new ItemStack(Items.EMERALD, 16), + new ItemStack(ModItems.MP_443_BLUEPRINT.get()), 8, 15, 0.05f)); + trades.get(2).add(new BasicItemListing(new ItemStack(Items.EMERALD, 16), + new ItemStack(ModItems.TASER_BLUEPRINT.get()), 8, 15, 0.05f)); + + // 等级 3 交易 +// trades.get(3).add(new BasicItemListing(new ItemStack(Items.EMERALD, 3), +// new ItemStack(ModItems.HANDGUN_AMMO_BOX.get(), 2), 8, 5, 0.05f)); +// trades.get(3).add(new BasicItemListing(new ItemStack(Items.EMERALD, 2), +// new ItemStack(ModItems.RIFLE_AMMO_BOX.get(), 1), 8, 5, 0.05f)); +// trades.get(3).add(new BasicItemListing(new ItemStack(Items.EMERALD, 3), +// new ItemStack(ModItems.SNIPER_AMMO_BOX.get(), 1), 8, 5, 0.05f)); +// trades.get(3).add(new BasicItemListing(new ItemStack(Items.EMERALD, 3), +// new ItemStack(ModItems.SHOTGUN_AMMO_BOX.get(), 1), 8, 5, 0.05f)); + +// trades.get(3).add(new BasicItemListing(new ItemStack(ModItems.HANDGUN_AMMO_BOX.get(), 4), +// new ItemStack(Items.EMERALD, 3), 16, 5, 0.05f)); +// trades.get(3).add(new BasicItemListing(new ItemStack(ModItems.RIFLE_AMMO_BOX.get(), 1), +// new ItemStack(Items.EMERALD, 1), 16, 5, 0.05f)); +// trades.get(3).add(new BasicItemListing(new ItemStack(ModItems.SNIPER_AMMO_BOX.get(), 2), +// new ItemStack(Items.EMERALD, 3), 16, 5, 0.05f)); +// trades.get(3).add(new BasicItemListing(new ItemStack(ModItems.SHOTGUN_AMMO_BOX.get(), 2), +// new ItemStack(Items.EMERALD, 3), 16, 5, 0.05f)); + + trades.get(3).add(new BasicItemListing(new ItemStack(Items.EMERALD, 16), + new ItemStack(ModItems.CEMENTED_CARBIDE_BARREL.get()), 12, 10, 0.05f)); + trades.get(3).add(new BasicItemListing(new ItemStack(Items.EMERALD, 20), + new ItemStack(ModItems.CEMENTED_CARBIDE_ACTION.get()), 10, 10, 0.05f)); + trades.get(3).add(new BasicItemListing(new ItemStack(Items.EMERALD, 16), + new ItemStack(ModItems.CEMENTED_CARBIDE_SPRING.get()), 10, 10, 0.05f)); + trades.get(3).add(new BasicItemListing(new ItemStack(Items.EMERALD, 12), + new ItemStack(ModItems.CEMENTED_CARBIDE_TRIGGER.get()), 10, 10, 0.05f)); + + trades.get(3).add(new BasicItemListing(new ItemStack(Items.EMERALD, 32), + new ItemStack(ModItems.M_4_BLUEPRINT.get()), 10, 25, 0.05f)); + trades.get(3).add(new BasicItemListing(new ItemStack(Items.EMERALD, 32), + new ItemStack(ModItems.M_79_BLUEPRINT.get()), 10, 25, 0.05f)); + trades.get(3).add(new BasicItemListing(new ItemStack(Items.EMERALD, 32), + new ItemStack(ModItems.AK_47_BLUEPRINT.get()), 10, 25, 0.05f)); + trades.get(3).add(new BasicItemListing(new ItemStack(Items.EMERALD, 32), + new ItemStack(ModItems.GLOCK_18_BLUEPRINT.get()), 10, 25, 0.05f)); + trades.get(3).add(new BasicItemListing(new ItemStack(Items.EMERALD, 32), + new ItemStack(ModItems.SKS_BLUEPRINT.get()), 10, 25, 0.05f)); + trades.get(3).add(new BasicItemListing(new ItemStack(Items.EMERALD, 32), + new ItemStack(ModItems.M_870_BLUEPRINT.get()), 10, 25, 0.05f)); + trades.get(3).add(new BasicItemListing(new ItemStack(Items.EMERALD, 32), + new ItemStack(ModItems.K_98_BLUEPRINT.get()), 10, 25, 0.05f)); + trades.get(3).add(new BasicItemListing(new ItemStack(Items.EMERALD, 40), + new ItemStack(ModItems.MOSIN_NAGANT_BLUEPRINT.get()), 10, 25, 0.05f)); + + // 等级 4 交易 + trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 2), + new ItemStack(ModItems.GRENADE_40MM.get(), 1), 16, 5, 0.05f)); +// trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 2) +// new ItemStack(ModItems.HAND_GRENADE.get(), 1), 16, 5, 0.05f)); +// trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 2), +// new ItemStack(ModItems.RGO_GRENADE.get(), 1), 16, 5, 0.05f)); +// trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 3), +// new ItemStack(ModItems.MORTAR_SHELL.get(), 1), 16, 5, 0.05f)); +// trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 4), +// new ItemStack(ModItems.CLAYMORE_MINE.get(), 1), 16, 5, 0.05f)); +// trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 4), +// new ItemStack(ModItems.C4_BOMB.get(), 1), 16, 5, 0.05f)); +// trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 4), +// new ItemStack(ModItems.ROCKET.get(), 1), 16, 5, 0.05f)); + + trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.GRENADE_40MM.get(), 1), + new ItemStack(Items.EMERALD, 1), 32, 5, 0.05f)); +// trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.HAND_GRENADE.get(), 1), +// new ItemStack(Items.EMERALD, 1), 32, 5, 0.05f)); +// trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.RGO_GRENADE.get(), 1), +// new ItemStack(Items.EMERALD, 1), 32, 5, 0.05f)); +// trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.MORTAR_SHELL.get(), 3), +// new ItemStack(Items.EMERALD, 2), 32, 5, 0.05f)); +// trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.CLAYMORE_MINE.get(), 1), +// new ItemStack(Items.EMERALD, 2), 32, 5, 0.05f)); +// trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.C4_BOMB.get(), 1), +// new ItemStack(Items.EMERALD, 2), 32, 5, 0.05f)); +// trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.ROCKET.get(), 1), +// new ItemStack(Items.EMERALD, 2), 32, 5, 0.05f)); + + trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 22), + new ItemStack(getItemHolder("poisonous_bullet"), 1), 4, 10, 0.05f)); + trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 24), + new ItemStack(getItemHolder("subsistence"), 1), 4, 10, 0.05f)); + trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 25), + new ItemStack(getItemHolder("kill_clip"), 1), 4, 10, 0.05f)); + trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 26), + new ItemStack(getItemHolder("gutshot_straight"), 1), 4, 10, 0.05f)); + trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 22), + new ItemStack(getItemHolder("head_seeker"), 1), 4, 10, 0.05f)); + + // 等级 5 交易 + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 34), + new ItemStack(getItemHolder("silver_bullet"), 1), 4, 15, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 30), + new ItemStack(getItemHolder("field_doctor"), 1), 4, 15, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 34), + new ItemStack(getItemHolder("heal_clip"), 1), 4, 15, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 30), + new ItemStack(getItemHolder("killing_tally"), 1), 4, 15, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 34), + new ItemStack(getItemHolder("fourth_times_charm"), 1), 4, 15, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 48), + new ItemStack(getItemHolder("monster_hunter"), 1), 4, 25, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 40), + new ItemStack(getItemHolder("vorpal_weapon"), 1), 4, 25, 0.05f)); + + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 64), + new ItemStack(ModItems.HUNTING_RIFLE_BLUEPRINT.get()), 10, 30, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 64), + new ItemStack(ModItems.RPG_BLUEPRINT.get()), 10, 30, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 64), + new ItemStack(ModItems.HK_416_BLUEPRINT.get()), 10, 30, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 64), + new ItemStack(ModItems.RPK_BLUEPRINT.get()), 10, 30, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 64), + new ItemStack(ModItems.VECTOR_BLUEPRINT.get()), 10, 30, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 64), + new ItemStack(ModItems.MK_14_BLUEPRINT.get()), 10, 30, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 64), + new ItemStack(ModItems.M_60_BLUEPRINT.get()), 10, 30, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 64), + new ItemStack(ModItems.SVD_BLUEPRINT.get()), 10, 30, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 64), + new ItemStack(ModItems.M_98B_BLUEPRINT.get()), 10, 30, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 64), + new ItemStack(ModItems.DEVOTION_BLUEPRINT.get()), 10, 30, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 64), + new ItemStack(ModItems.QBZ_95_BLUEPRINT.get()), 10, 30, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 64), + new ItemStack(ModItems.AK_12_BLUEPRINT.get()), 10, 30, 0.05f)); + +// trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 16), +// new ItemStack(ModItems.HE_5_INCHES.get(), 1), 8, 10, 0.05f)); +// trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 14), +// new ItemStack(ModItems.AP_5_INCHES.get(), 1), 8, 10, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 24), + new ItemStack(ModItems.JAVELIN_MISSILE.get(), 1), 8, 10, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(Items.EMERALD, 24), + new ItemStack(ModItems.WIRE_GUIDE_MISSILE.get(), 1), 8, 10, 0.05f)); + + trades.get(5).add(new BasicItemListing(new ItemStack(ModItems.HE_5_INCHES.get(), 1), + new ItemStack(Items.EMERALD, 8), 32, 4, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(ModItems.AP_5_INCHES.get(), 1), + new ItemStack(Items.EMERALD, 7), 32, 4, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(ModItems.JAVELIN_MISSILE.get(), 1), + new ItemStack(Items.EMERALD, 12), 32, 4, 0.05f)); + trades.get(5).add(new BasicItemListing(new ItemStack(ModItems.WIRE_GUIDE_MISSILE.get(), 1), + new ItemStack(Items.EMERALD, 12), 32, 4, 0.05f)); + } + } + + private static Holder getItemHolder(String name) { + var item = BuiltInRegistries.ITEM.getHolder(ModUtils.loc(name)); + if (item.isEmpty()) { + ModUtils.LOGGER.error("Item {} not found", name); + return Holder.direct(Items.AIR); + } + + return item.get(); + } + +} diff --git a/src/main/java/com/atsuishio/superbwarfare/item/common/CannonShellItem.java b/src/main/java/com/atsuishio/superbwarfare/item/common/CannonShellItem.java new file mode 100644 index 000000000..5b4b037c1 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/item/common/CannonShellItem.java @@ -0,0 +1,10 @@ +package com.atsuishio.superbwarfare.item.common; + +import net.minecraft.world.item.Item; + +public class CannonShellItem extends Item { + + public CannonShellItem(Properties properties) { + super(properties); + } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/item/common/CreativeAmmoBox.java b/src/main/java/com/atsuishio/superbwarfare/item/common/CreativeAmmoBox.java new file mode 100644 index 000000000..fa360a713 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/item/common/CreativeAmmoBox.java @@ -0,0 +1,24 @@ +package com.atsuishio.superbwarfare.item.common; + +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Rarity; +import net.minecraft.world.item.TooltipFlag; + +import javax.annotation.ParametersAreNonnullByDefault; +import java.util.List; + +public class CreativeAmmoBox extends Item { + + public CreativeAmmoBox() { + super(new Properties().rarity(Rarity.EPIC).stacksTo(1)); + } + + @Override + @ParametersAreNonnullByDefault + public void appendHoverText(ItemStack stack, TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { + tooltipComponents.add(Component.translatable("des.superbwarfare.creative_ammo_box").withStyle(ChatFormatting.GRAY)); + } +}