diff --git a/src/main/java/me/jonasjones/nec/NotEnoughCursedness.java b/src/main/java/me/jonasjones/nec/NotEnoughCursedness.java index cb72bb3..2a98876 100644 --- a/src/main/java/me/jonasjones/nec/NotEnoughCursedness.java +++ b/src/main/java/me/jonasjones/nec/NotEnoughCursedness.java @@ -1,5 +1,8 @@ package me.jonasjones.nec; +import me.jonasjones.nec.block.ModBlocks; +import me.jonasjones.nec.item.ModItems; +import me.jonasjones.nec.util.ModRegistries; import net.fabricmc.api.ModInitializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -8,13 +11,16 @@ public class NotEnoughCursedness implements ModInitializer { // This logger is used to write text to the console and the log file. // It is considered best practice to use your mod id as the logger's name. // That way, it's clear which mod wrote info, warnings, and errors. - public static final Logger LOGGER = LoggerFactory.getLogger("nec"); + public static String MOD_ID = "nec"; + public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); @Override public void onInitialize() { - // This code runs as soon as Minecraft is in a mod-load-ready state. - // However, some things (like resources) may still be uninitialized. - // Proceed with mild caution. + //register blocks + ModBlocks.register(); + ModItems.register(); + ModRegistries.registerModStuffs(); + LOGGER.info("Your game is now cursed!"); } diff --git a/src/main/java/me/jonasjones/nec/block/ModBlocks.java b/src/main/java/me/jonasjones/nec/block/ModBlocks.java new file mode 100644 index 0000000..423df22 --- /dev/null +++ b/src/main/java/me/jonasjones/nec/block/ModBlocks.java @@ -0,0 +1,41 @@ +package me.jonasjones.nec.block; + +import me.jonasjones.nec.util.ModRegistries; +import net.fabricmc.fabric.api.item.v1.FabricItemSettings; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; +import net.minecraft.block.Block; +import net.minecraft.block.Material; +import net.minecraft.block.PillarBlock; +import net.minecraft.item.BlockItem; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.util.Identifier; + +public class ModBlocks { + public static final Block GREEN_BIRCH_LOG = new PillarBlock(FabricBlockSettings.of(Material.WOOD).strength(4.0f)); + public static final Block BLAZE_BLOCK = new Block(FabricBlockSettings.of(Material.STONE).strength(4.0F)); + public static final Block GUN_BLOCK = new Block(FabricBlockSettings.of(Material.STONE).strength(4.0F)); + private static BlockItem GUN_BLOCK_ITEM; + private static Block GUN_BLOCK_BLOCK; + private static BlockItem BLAZE_BLOCK_ITEM; + private static Block BLAZE_BLOCK_BLOCK; + public static Block GREEEN_BIRCH_LOG_BLOCK; + public static BlockItem GREEN_BIRCH_LOG_ITEM; + //public static final Block GREEN_BIRCH_WOOD = new PillarBlock(FabricBlockSettings.of(Material.WOOD).strength(4.0f)); + //public static final Block STRIPPED_GREEN_BIRCH_LOG = new PillarBlock(FabricBlockSettings.of(Material.WOOD).strength(4.0f)); + //public static final Block STRIPPED_GREEN_BIRCH_WOOD = new PillarBlock(FabricBlockSettings.of(Material.WOOD).strength(4.0f)); + + public static void register() { + BLAZE_BLOCK_BLOCK = Registry.register(Registries.BLOCK, new Identifier("nec", "blaze_block"), BLAZE_BLOCK); + BLAZE_BLOCK_ITEM = Registry.register(Registries.ITEM, new Identifier("nec", "blaze_block"), new BlockItem(BLAZE_BLOCK, new FabricItemSettings())); + ModRegistries.register_item(BLAZE_BLOCK_ITEM); + + GREEEN_BIRCH_LOG_BLOCK = Registry.register(Registries.BLOCK, new Identifier("nec", "green_birch_log"), GREEN_BIRCH_LOG); + GREEN_BIRCH_LOG_ITEM = Registry.register(Registries.ITEM, new Identifier("nec", "green_birch_log"), new BlockItem(GREEN_BIRCH_LOG, new FabricItemSettings())); + ModRegistries.register_item(GREEN_BIRCH_LOG_ITEM); + + GUN_BLOCK_BLOCK = Registry.register(Registries.BLOCK, new Identifier("nec", "gun_block"), GUN_BLOCK); + GUN_BLOCK_ITEM = Registry.register(Registries.ITEM, new Identifier("nec", "gun_block"), new BlockItem(GUN_BLOCK, new FabricItemSettings())); + ModRegistries.register_item(GUN_BLOCK_ITEM); + } +} diff --git a/src/main/java/me/jonasjones/nec/item/ModItems.java b/src/main/java/me/jonasjones/nec/item/ModItems.java new file mode 100644 index 0000000..f0d9fd2 --- /dev/null +++ b/src/main/java/me/jonasjones/nec/item/ModItems.java @@ -0,0 +1,19 @@ +package me.jonasjones.nec.item; + +import me.jonasjones.nec.item.materials.DirtToolMaterial; +import me.jonasjones.nec.util.ModRegistries; +import net.fabricmc.fabric.api.item.v1.FabricItemSettings; +import net.minecraft.item.*; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.util.Identifier; + +public class ModItems { + private static ToolItem DIRT_SWORD_ITEM; + + public static void register() { + ToolItem DIRT_SWORD = new SwordItem(DirtToolMaterial.INSTANCE, 1, -3.0F, new Item.Settings()); + DIRT_SWORD_ITEM = Registry.register(Registries.ITEM, new Identifier("nec", "dirt_sword"), DIRT_SWORD); + ModRegistries.register_item(DIRT_SWORD_ITEM); + } +} diff --git a/src/main/java/me/jonasjones/nec/item/materials/DirtToolMaterial.java b/src/main/java/me/jonasjones/nec/item/materials/DirtToolMaterial.java new file mode 100644 index 0000000..4c51144 --- /dev/null +++ b/src/main/java/me/jonasjones/nec/item/materials/DirtToolMaterial.java @@ -0,0 +1,39 @@ +package me.jonasjones.nec.item.materials; + +import net.minecraft.item.Items; +import net.minecraft.item.ToolMaterial; +import net.minecraft.recipe.Ingredient; + +public class DirtToolMaterial implements ToolMaterial { + + public static final DirtToolMaterial INSTANCE = new DirtToolMaterial(); + @Override + public int getDurability() { + return 5; + } + + @Override + public float getMiningSpeedMultiplier() { + return 1.0F; + } + + @Override + public float getAttackDamage() { + return 2.0F; + } + + @Override + public int getMiningLevel() { + return 0; + } + + @Override + public int getEnchantability() { + return 100; + } + + @Override + public Ingredient getRepairIngredient() { + return Ingredient.ofItems(Items.DIRT, Items.COARSE_DIRT, Items.DIRT_PATH, Items.ROOTED_DIRT); + } +} diff --git a/src/main/java/me/jonasjones/nec/util/ModRegistries.java b/src/main/java/me/jonasjones/nec/util/ModRegistries.java new file mode 100644 index 0000000..39f42b1 --- /dev/null +++ b/src/main/java/me/jonasjones/nec/util/ModRegistries.java @@ -0,0 +1,58 @@ +package me.jonasjones.nec.util; + +import me.jonasjones.nec.block.ModBlocks; +import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents; +import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; +import net.fabricmc.fabric.api.registry.FlammableBlockRegistry; +import net.fabricmc.fabric.api.registry.FuelRegistry; +import net.fabricmc.fabric.api.registry.StrippableBlockRegistry; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; +import net.minecraft.util.Identifier; + +public class ModRegistries { + + static final ItemGroup ITEM_GROUP = FabricItemGroup.builder(new Identifier("nec", "not_enough_cursedness")) + .icon(() -> ModBlocks.GREEN_BIRCH_LOG_ITEM.getDefaultStack()) + .build(); + public static void registerModStuffs() { + registerFuels(); + registerCommands(); + registerEvents(); + registerStrippables(); + registerFlammableBlock(); + } + + private static void registerFuels() { + FuelRegistry registry = FuelRegistry.INSTANCE; + + //registry.add(ModItems.LILAC_FLOWER_BULB, 200); + } + + private static void registerCommands() { + //CommandRegistrationCallback.EVENT.register(SetHomeCommand::register); + //CommandRegistrationCallback.EVENT.register(ReturnHomeCommand::register); + } + + private static void registerStrippables() { + //StrippableBlockRegistry.register(ModBlocks.GREEEN_BIRCH_LOG_BLOCK, ModBlocks.STRIPPED_JACARANDA_LOG); + StrippableBlockRegistry.register(ModBlocks.GREEEN_BIRCH_LOG_BLOCK, ModBlocks.GREEEN_BIRCH_LOG_BLOCK); + } + + private static void registerFlammableBlock() { + FlammableBlockRegistry instance = FlammableBlockRegistry.getDefaultInstance(); + + instance.add(ModBlocks.GREEN_BIRCH_LOG, 5, 5); + } + + private static void registerEvents() { + //ServerPlayerEvents.COPY_FROM.register(new ModPlayerEventCopyFrom()); + } + + public static void register_item(Item CUSTOM_ITEM) { + ItemGroupEvents.modifyEntriesEvent(ITEM_GROUP).register(content -> { + content.add(CUSTOM_ITEM); + }); + } +} diff --git a/src/main/resources/assets/nec/blockstates/blaze_block.json b/src/main/resources/assets/nec/blockstates/blaze_block.json new file mode 100644 index 0000000..975f2dc --- /dev/null +++ b/src/main/resources/assets/nec/blockstates/blaze_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "nec:block/blaze_block" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/nec/blockstates/green_birch_log.json b/src/main/resources/assets/nec/blockstates/green_birch_log.json new file mode 100644 index 0000000..09e81b3 --- /dev/null +++ b/src/main/resources/assets/nec/blockstates/green_birch_log.json @@ -0,0 +1,16 @@ +{ + "variants": { + "axis=x": { + "model": "nec:block/green_birch_log_horizontal", + "x": 90, + "y": 90 + }, + "axis=y": { + "model": "nec:block/green_birch_log" + }, + "axis=z": { + "model": "nec:block/green_birch_log_horizontal", + "x": 90 + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/nec/blockstates/gun_block.json b/src/main/resources/assets/nec/blockstates/gun_block.json new file mode 100644 index 0000000..a364091 --- /dev/null +++ b/src/main/resources/assets/nec/blockstates/gun_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "nec:block/gun_block" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/nec/icon.png b/src/main/resources/assets/nec/icon.png index 047b91f..e8446d6 100644 Binary files a/src/main/resources/assets/nec/icon.png and b/src/main/resources/assets/nec/icon.png differ diff --git a/src/main/resources/assets/nec/lang/en_us.json b/src/main/resources/assets/nec/lang/en_us.json new file mode 100644 index 0000000..8d67053 --- /dev/null +++ b/src/main/resources/assets/nec/lang/en_us.json @@ -0,0 +1,10 @@ +{ + "block.nec.blaze_block": "Blaze Block", + "block.nec.cursed_dirt_stairs": "Cursed Dirt Stairs", + "block.nec.cursed_dirt_slab": "Cursed Dirt Slab", + "block.nec.cursed_dirt": "Cursed Dirt", + "block.nec.green_birch_log": "Green Birch Log", + "block.nec.gun_block": "Gun Block", + "item.nec.dirt_sword": "Dirt Sword", + "itemGroup.nec.not_enough_cursedness": "Not Enough Cursedness" +} \ No newline at end of file diff --git a/src/main/resources/assets/nec/models/block/blaze_block.json b/src/main/resources/assets/nec/models/block/blaze_block.json new file mode 100644 index 0000000..59d77f0 --- /dev/null +++ b/src/main/resources/assets/nec/models/block/blaze_block.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "nec:block/blaze_block" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/nec/models/block/green_birch_log.json b/src/main/resources/assets/nec/models/block/green_birch_log.json new file mode 100644 index 0000000..f7901e3 --- /dev/null +++ b/src/main/resources/assets/nec/models/block/green_birch_log.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "nec:block/green_birch_log_top", + "side": "nec:block/green_birch_log" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/nec/models/block/green_birch_log_horizontal.json b/src/main/resources/assets/nec/models/block/green_birch_log_horizontal.json new file mode 100644 index 0000000..5e25280 --- /dev/null +++ b/src/main/resources/assets/nec/models/block/green_birch_log_horizontal.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column_horizontal", + "textures": { + "end": "nec:block/green_birch_log_top", + "side": "nec:block/green_birch_log" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/nec/models/block/gun_block.json b/src/main/resources/assets/nec/models/block/gun_block.json new file mode 100644 index 0000000..11f39cd --- /dev/null +++ b/src/main/resources/assets/nec/models/block/gun_block.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "nec:block/gun_block" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/nec/models/item/blaze_block.json b/src/main/resources/assets/nec/models/item/blaze_block.json new file mode 100644 index 0000000..62b36d5 --- /dev/null +++ b/src/main/resources/assets/nec/models/item/blaze_block.json @@ -0,0 +1,3 @@ +{ + "parent": "nec:block/blaze_block" +} \ No newline at end of file diff --git a/src/main/resources/assets/nec/models/item/dirt_sword.json b/src/main/resources/assets/nec/models/item/dirt_sword.json new file mode 100644 index 0000000..65b5537 --- /dev/null +++ b/src/main/resources/assets/nec/models/item/dirt_sword.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "nec:item/dirt_sword" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/nec/models/item/green_birch_log.json b/src/main/resources/assets/nec/models/item/green_birch_log.json new file mode 100644 index 0000000..d524972 --- /dev/null +++ b/src/main/resources/assets/nec/models/item/green_birch_log.json @@ -0,0 +1,3 @@ +{ + "parent": "nec:block/green_birch_log" + } diff --git a/src/main/resources/assets/nec/models/item/gun_block.json b/src/main/resources/assets/nec/models/item/gun_block.json new file mode 100644 index 0000000..5ff1ad5 --- /dev/null +++ b/src/main/resources/assets/nec/models/item/gun_block.json @@ -0,0 +1,3 @@ +{ + "parent": "nec:block/gun_block" +} \ No newline at end of file diff --git a/src/main/resources/assets/nec/textures/block/blaze_block.png b/src/main/resources/assets/nec/textures/block/blaze_block.png new file mode 100644 index 0000000..904c92c Binary files /dev/null and b/src/main/resources/assets/nec/textures/block/blaze_block.png differ diff --git a/src/main/resources/assets/nec/textures/block/green_birch_log.png b/src/main/resources/assets/nec/textures/block/green_birch_log.png new file mode 100644 index 0000000..123a5c0 Binary files /dev/null and b/src/main/resources/assets/nec/textures/block/green_birch_log.png differ diff --git a/src/main/resources/assets/nec/textures/block/green_birch_log_top.png b/src/main/resources/assets/nec/textures/block/green_birch_log_top.png new file mode 100644 index 0000000..fcbdcb9 Binary files /dev/null and b/src/main/resources/assets/nec/textures/block/green_birch_log_top.png differ diff --git a/src/main/resources/assets/nec/textures/block/gun_block.png b/src/main/resources/assets/nec/textures/block/gun_block.png new file mode 100644 index 0000000..8f6ae6e Binary files /dev/null and b/src/main/resources/assets/nec/textures/block/gun_block.png differ diff --git a/src/main/resources/assets/nec/textures/item/dirt_sword.png b/src/main/resources/assets/nec/textures/item/dirt_sword.png new file mode 100644 index 0000000..e73db70 Binary files /dev/null and b/src/main/resources/assets/nec/textures/item/dirt_sword.png differ diff --git a/src/main/resources/data/minecraft/tags/blocks/axe.json b/src/main/resources/data/minecraft/tags/blocks/axe.json new file mode 100644 index 0000000..40f21c7 --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/axe.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "nec:green_birch_log" + ] + } + diff --git a/src/main/resources/data/nec/loot_tables/blocks/green_birch_log.json b/src/main/resources/data/nec/loot_tables/blocks/green_birch_log.json new file mode 100644 index 0000000..af07843 --- /dev/null +++ b/src/main/resources/data/nec/loot_tables/blocks/green_birch_log.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "nec:green_birch_log" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] + } + diff --git a/src/main/resources/data/nec/recipes/blaze_block.json b/src/main/resources/data/nec/recipes/blaze_block.json new file mode 100644 index 0000000..b7c9bac --- /dev/null +++ b/src/main/resources/data/nec/recipes/blaze_block.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "building", + "key": { + "#": { + "item": "minecraft:blaze_powder" + } + }, + "pattern": [ + "###", + "###", + "###" + ], + "result": { + "item": "nec:blaze_block" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/main/resources/data/nec/recipes/blaze_rod.json b/src/main/resources/data/nec/recipes/blaze_rod.json new file mode 100644 index 0000000..49a2931 --- /dev/null +++ b/src/main/resources/data/nec/recipes/blaze_rod.json @@ -0,0 +1,12 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "nec:blaze_block" + } + ], + "result": { + "item": "minecraft:blaze_powder", + "count": 9 + } +} diff --git a/src/main/resources/data/nec/recipes/crossbow.json b/src/main/resources/data/nec/recipes/crossbow.json new file mode 100644 index 0000000..c13c6e6 --- /dev/null +++ b/src/main/resources/data/nec/recipes/crossbow.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "ABA", + " C ", + " " + ], + "key": { + "A": { + "item": "minecraft:tripwire_hook" + }, + "B": { + "item": "minecraft:string" + }, + "C": { + "item": "minecraft:bow" + } + }, + "result": { + "item": "minecraft:crossbow" + } +} \ No newline at end of file diff --git a/src/main/resources/data/nec/recipes/diamond_ore.json b/src/main/resources/data/nec/recipes/diamond_ore.json new file mode 100644 index 0000000..563051c --- /dev/null +++ b/src/main/resources/data/nec/recipes/diamond_ore.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "AAA", + "ABA", + "AAA" + ], + "key": { + "A": { + "item": "minecraft:stone" + }, + "B": { + "item": "minecraft:diamond" + } + }, + "result": { + "item": "minecraft:diamond_ore" + } +} \ No newline at end of file diff --git a/src/main/resources/data/nec/recipes/dirt_sword.json b/src/main/resources/data/nec/recipes/dirt_sword.json new file mode 100644 index 0000000..c62dd2c --- /dev/null +++ b/src/main/resources/data/nec/recipes/dirt_sword.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " A ", + " A ", + " B " + ], + "key": { + "A": { + "item": "minecraft:dirt" + }, + "B": { + "item": "minecraft:stick" + } + }, + "result": { + "item": "nec:dirt_sword" + } +} \ No newline at end of file diff --git a/src/main/resources/data/nec/recipes/green_birch.json b/src/main/resources/data/nec/recipes/green_birch.json new file mode 100644 index 0000000..2527e78 --- /dev/null +++ b/src/main/resources/data/nec/recipes/green_birch.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "minecraft:green_dye" + }, + { + "item": "minecraft:birch_log" + } + ], + "result": { + "item": "nec:green_birch_log" + } +} diff --git a/src/main/resources/data/nec/recipes/gun_block.json b/src/main/resources/data/nec/recipes/gun_block.json new file mode 100644 index 0000000..4db63b5 --- /dev/null +++ b/src/main/resources/data/nec/recipes/gun_block.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "building", + "key": { + "#": { + "item": "minecraft:gunpowder" + } + }, + "pattern": [ + "###", + "###", + "###" + ], + "result": { + "item": "nec:gun_block" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/main/resources/data/nec/recipes/gunpowder.json b/src/main/resources/data/nec/recipes/gunpowder.json new file mode 100644 index 0000000..d54c7a8 --- /dev/null +++ b/src/main/resources/data/nec/recipes/gunpowder.json @@ -0,0 +1,12 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "nec:gun_block" + } + ], + "result": { + "item": "minecraft:gunpowder", + "count": 9 + } +} diff --git a/src/main/resources/data/nec/recipes/zombie_spawn_egg.json b/src/main/resources/data/nec/recipes/zombie_spawn_egg.json new file mode 100644 index 0000000..caf9003 --- /dev/null +++ b/src/main/resources/data/nec/recipes/zombie_spawn_egg.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "minecraft:zombie_head" + }, + { + "item": "minecraft:egg" + } + ], + "result": { + "item": "minecraft:zombie_spawn_egg" + } +}