-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
664 additions
and
617 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,36 @@ | ||
package fr.hugman.mubble; | ||
|
||
import fr.hugman.dawn.Registrar; | ||
import fr.hugman.mubble.registry.MubbleSounds; | ||
import fr.hugman.mubble.registry.SuperMario; | ||
import com.google.common.reflect.Reflection; | ||
import fr.hugman.mubble.block.MubbleBlockEntityTypes; | ||
import fr.hugman.mubble.block.MubbleBlocks; | ||
import fr.hugman.mubble.item.MubbleItemGroups; | ||
import fr.hugman.mubble.item.MubbleItems; | ||
import fr.hugman.mubble.screen.MubbleScreenHandlerTypes; | ||
import fr.hugman.mubble.sound.MubbleSounds; | ||
import fr.hugman.mubble.world.MubbleGamerules; | ||
import net.fabricmc.api.ModInitializer; | ||
import net.minecraft.util.Identifier; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
public class Mubble implements ModInitializer { | ||
public static final Registrar REGISTRAR = new Registrar("mubble"); | ||
public static final Logger LOGGER = LogManager.getLogger(); | ||
public static final String MOD_ID = "mubble"; | ||
public static final Logger LOGGER = LogManager.getLogger(); | ||
|
||
@Override | ||
public void onInitialize() { | ||
MubbleGamerules.init(); | ||
MubbleSounds.init(); | ||
@Override | ||
public void onInitialize() { | ||
Reflection.initialize(MubbleBlocks.class); | ||
Reflection.initialize(MubbleBlockEntityTypes.class); | ||
Reflection.initialize(MubbleItems.class); | ||
Reflection.initialize(MubbleSounds.class); | ||
Reflection.initialize(MubbleScreenHandlerTypes.class); | ||
|
||
SuperMario.init(REGISTRAR); | ||
} | ||
MubbleItemGroups.appendItemGroups(); | ||
|
||
public static Identifier id(String path) { | ||
return REGISTRAR.id(path); | ||
} | ||
MubbleGamerules.init(); | ||
} | ||
|
||
public static Identifier id(String path) { | ||
return Identifier.of(MOD_ID, path); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/fr/hugman/mubble/block/MubbleBlockEntityTypes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package fr.hugman.mubble.block; | ||
|
||
import com.mojang.datafixers.types.Type; | ||
import fr.hugman.mubble.Mubble; | ||
import fr.hugman.mubble.block.entity.BumpableBlockEntity; | ||
import net.minecraft.block.entity.BlockEntity; | ||
import net.minecraft.block.entity.BlockEntityType; | ||
import net.minecraft.datafixer.TypeReferences; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.Registry; | ||
import net.minecraft.util.Util; | ||
|
||
public class MubbleBlockEntityTypes { | ||
// SUPER MARIO | ||
public static final BlockEntityType<BumpableBlockEntity> BUMPABLE_BLOCK = of("bumpable_block", BlockEntityType.Builder.create(BumpableBlockEntity::new, MubbleBlocks.QUESTION_BLOCK, MubbleBlocks.BRICK_BLOCK, MubbleBlocks.GOLD_BLOCK, MubbleBlocks.NOTE_BLOCK, MubbleBlocks.EXCLAMATION_BLOCK)); | ||
|
||
private static <T extends BlockEntity> BlockEntityType<T> of(String path, BlockEntityType.Builder<T> blockEntityType) { | ||
Type<?> type = Util.getChoiceType(TypeReferences.BLOCK_ENTITY, path); | ||
return Registry.register(Registries.BLOCK_ENTITY_TYPE, Mubble.id(path), blockEntityType.build(type)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package fr.hugman.mubble.block; | ||
|
||
import fr.hugman.mubble.Mubble; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.registry.RegistryKey; | ||
import net.minecraft.registry.RegistryKeys; | ||
|
||
public class MubbleBlockKeys { | ||
// SUPER MARIO | ||
public static final RegistryKey<Block> EMPTY_BLOCK = of("empty_block"); | ||
public static final RegistryKey<Block> QUESTION_BLOCK = of("question_block"); | ||
public static final RegistryKey<Block> BRICK_BLOCK = of("brick_block"); | ||
public static final RegistryKey<Block> GOLD_BLOCK = of("gold_block"); | ||
public static final RegistryKey<Block> NOTE_BLOCK = of("note_block"); | ||
public static final RegistryKey<Block> EXCLAMATION_BLOCK = of("exclamation_block"); | ||
public static final RegistryKey<Block> SNAKE_BLOCK = of("snake_block"); | ||
public static final RegistryKey<Block> FAST_SNAKE_BLOCK = of("fast_snake_block"); | ||
public static final RegistryKey<Block> SLOW_SNAKE_BLOCK = of("slow_snake_block"); | ||
public static final RegistryKey<Block> RED_BEEP_BLOCK = of("red_beep_block"); | ||
public static final RegistryKey<Block> BLUE_BEEP_BLOCK = of("blue_beep_block"); | ||
|
||
private static RegistryKey<Block> of(String path) { | ||
return RegistryKey.of(RegistryKeys.BLOCK, Mubble.id(path)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package fr.hugman.mubble.block; | ||
|
||
import fr.hugman.mubble.sound.MubbleSounds; | ||
import net.minecraft.block.AbstractBlock; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.Blocks; | ||
import net.minecraft.block.MapColor; | ||
import net.minecraft.component.DataComponentTypes; | ||
import net.minecraft.component.type.ContainerComponent; | ||
import net.minecraft.item.BlockItem; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.Registry; | ||
import net.minecraft.registry.RegistryKey; | ||
|
||
public class MubbleBlocks { | ||
// SUPER MARIO | ||
public static final EmptyBlock EMPTY_BLOCK = ofWithItem(MubbleBlockKeys.EMPTY_BLOCK, new EmptyBlock(AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).mapColor(MapColor.BROWN))); | ||
public static final DecoratedBumpableBlock QUESTION_BLOCK = ofWithItem(MubbleBlockKeys.QUESTION_BLOCK, new DecoratedBumpableBlock(EMPTY_BLOCK.getDefaultState(), AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).mapColor(MapColor.YELLOW)), new Item.Settings().component(DataComponentTypes.CONTAINER, ContainerComponent.DEFAULT)); | ||
public static final DecoratedBumpableBlock BRICK_BLOCK = ofWithItem(MubbleBlockKeys.BRICK_BLOCK, new DecoratedBumpableBlock(Blocks.AIR.getDefaultState(), AbstractBlock.Settings.copy(Blocks.BRICKS).mapColor(MapColor.BROWN)),new Item.Settings().component(DataComponentTypes.CONTAINER, ContainerComponent.DEFAULT)); | ||
public static final DecoratedBumpableBlock GOLD_BLOCK = ofWithItem(MubbleBlockKeys.GOLD_BLOCK, new DecoratedBumpableBlock(Blocks.AIR.getDefaultState(), AbstractBlock.Settings.copy(Blocks.BRICKS).mapColor(MapColor.GOLD)), new Item.Settings().component(DataComponentTypes.CONTAINER, ContainerComponent.DEFAULT)); | ||
public static final NoteBlock NOTE_BLOCK = ofWithItem(MubbleBlockKeys.NOTE_BLOCK, new NoteBlock(MubbleSounds.NOTE_BLOCK_JUMP_LOW, MubbleSounds.NOTE_BLOCK_JUMP_HIGH, AbstractBlock.Settings.copy(Blocks.QUARTZ_BLOCK).mapColor(MapColor.WHITE)), new Item.Settings().component(DataComponentTypes.CONTAINER, ContainerComponent.DEFAULT)); | ||
public static final DecoratedBumpableBlock EXCLAMATION_BLOCK = ofWithItem(MubbleBlockKeys.EXCLAMATION_BLOCK, new DecoratedBumpableBlock(null, AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).mapColor(MapColor.BLUE)), new Item.Settings().component(DataComponentTypes.CONTAINER, ContainerComponent.DEFAULT)); | ||
public static final SnakeBlock SNAKE_BLOCK = ofWithItem(MubbleBlockKeys.SNAKE_BLOCK, new SnakeBlock(AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).mapColor(MapColor.LIME))); | ||
public static final SnakeBlock FAST_SNAKE_BLOCK = ofWithItem(MubbleBlockKeys.FAST_SNAKE_BLOCK, new SnakeBlock(AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).mapColor(MapColor.LAPIS_BLUE))); | ||
public static final SnakeBlock SLOW_SNAKE_BLOCK = ofWithItem(MubbleBlockKeys.SLOW_SNAKE_BLOCK, new SnakeBlock(AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).mapColor(MapColor.RED))); | ||
public static final BeepBlock RED_BEEP_BLOCK = ofWithItem(MubbleBlockKeys.RED_BEEP_BLOCK, new BeepBlock(BeepBlock.settings(MapColor.RED), false)); | ||
public static final BeepBlock BLUE_BEEP_BLOCK = ofWithItem(MubbleBlockKeys.BLUE_BEEP_BLOCK, new BeepBlock(BeepBlock.settings(MapColor.BLUE), true)); | ||
|
||
private static <O extends Block> O of(RegistryKey<Block> key, O block) { | ||
return Registry.register(Registries.BLOCK, key, block); | ||
} | ||
|
||
private static <O extends Block> O ofWithItem(RegistryKey<Block> key, O block, Item.Settings settings) { | ||
of(key, block); | ||
Registry.register(Registries.ITEM, key.getValue(), new BlockItem(block, settings)); | ||
return block; | ||
} | ||
|
||
private static <O extends Block> O ofWithItem(RegistryKey<Block> key, O block) { | ||
return ofWithItem(key, block, new Item.Settings()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,22 @@ | ||
package fr.hugman.mubble.block; | ||
|
||
import fr.hugman.mubble.registry.SuperMario; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.sound.SoundCategory; | ||
import net.minecraft.sound.SoundEvents; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Direction; | ||
import net.minecraft.world.World; | ||
|
||
/** | ||
* @author komerish | ||
* @since v4.0.0 | ||
*/ | ||
public class SnakeBlock extends Block { | ||
public SnakeBlock(Settings settings) { | ||
super(settings); | ||
} | ||
public SnakeBlock(Settings settings) { | ||
super(settings); | ||
} | ||
|
||
@Override | ||
public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) { | ||
super.onSteppedOn(world, pos, state, entity); | ||
} | ||
@Override | ||
public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) { | ||
super.onSteppedOn(world, pos, state, entity); | ||
} | ||
} |
Oops, something went wrong.