Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.sforzando.firesandforges;
- public class FiresAndForgesItems {
- public static final Item SOUL_FORGE = register(Identifier.of("fires_and_forges", "soul_forge"), new BlockItem(FiresAndForgesBlocks.SOUL_FORGE, new Item.Settings().rarity(Rarity.UNCOMMON)));
- public static final Item CURSED_FORGE = register(Identifier.of("fires_and_forges", "cursed_forge"), new BlockItem(FiresAndForgesBlocks.CURSED_FORGE, new Item.Settings().rarity(Rarity.RARE)));
- public static final Item STAR_FORGE = register(Identifier.of("fires_and_forges", "star_forge"), new BlockItem(FiresAndForgesBlocks.STAR_FORGE, new Item.Settings().rarity(Rarity.EPIC)));
- }
- public class FiresAndForgesBlocks {
- public static final Block SOUL_FORGE = register(Identifier.of("fires_and_forges", "soul_forge"), new SoulForgeBlock(AbstractBlock.Settings.of().sounds(BlockSoundGroup.STONE).strength(10.0F, 20.0F).dynamicShape()));
- public static final Block CURSED_FORGE = register(Identifier.of("fires_and_forges", "cursed_forge"), new CursedForgeBlock(AbstractBlock.Settings.of().sounds(BlockSoundGroup.METAL).strength(17.5F, 35.0F).dynamicShape()));
- public static final Block STAR_FORGE = register(Identifier.of("fires_and_forges", "star_forge"), new StarForgeBlock(AbstractBlock.Settings.of().sounds(BlockSoundGroup.NETHERITE).strength(25.0F, 50.0F).dynamicShape()));
- }
- public class SoulForgeBlock extends BlockWithEntity implements LandingBlock {
- public SoulForgeBlock (AbstractBlock.Settings settings) {
- super (settings);
- }
- public MapCodec<SoulForgeBlock> getCodec () {
- return AbstractBlock.simpleCodec(SoulForgeBlock::new);
- }
- public NamedScreenHandlerFactory createScreenHandlerFactory (BlockState state, World world, BlockPos pos) {
- return this.getOrCreateBlockEntity(world, pos);
- }
- public ActionResult onUse (BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
- if (world.isClientSide())
- MinecraftClient.getInstance().setScreen(new GenericContainerScreen(this.createScreenHandlerFactory(state, world, pos).createMenu(0, player.getInventory(), player), player.getInventory(), Component.translatable("fires_and_forges:menu.soul_forge.name")));
- }
- public SoulForgeBlockEntity newBlockEntity (BlockState state, BlockPos pos) {
- return new SoulForgeBlockEntity (state, pos);
- }
- public SoulForgeBlockEntity getOrCreateBlockEntity (World world, BlockPos pos) {
- if (world.getBlockEntity(pos) instanceof SoulForgeBlockEntity e) {
- return e;
- } else {
- SoulForgeBlockEntity e = this.newBlockEntity(world.getBlockState(pos), pos);
- e.setWorld(world);
- return e;
- }
- }
- }
- public class SoulForgeBlockEntity extends BlockEntity implements NamedScreenHandlerFactory {
- public SoulForgeBlockEntity (BlockState state, BlockPos pos) {
- super(FiresAndForgesBlockEntities.SOUL_FORGE, state, pos);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement