Skip to content

Commit

Permalink
Add block and blockitem
Browse files Browse the repository at this point in the history
  • Loading branch information
jiink committed Apr 15, 2024
1 parent 96b8556 commit 96ae6f4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
9 changes: 6 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ org.gradle.parallel=true
# check these on https://fabricmc.net/develop
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.9
loader_version=0.15.10

#Fabric api
fabric_version=0.97.0+1.20.4

# Mod Properties
mod_version=1.0.0
maven_group=com.example
archives_base_name=modid
maven_group=com.jiink
archives_base_name=smelting-in-a-pinch

# Dependencies
fabric_version=0.96.11+1.20.4
13 changes: 11 additions & 2 deletions src/main/java/com/example/ExampleMod.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
package com.example;

import net.fabricmc.api.ModInitializer;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.minecraft.util.Identifier;

public class ExampleMod 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("modid");
public static final Logger LOGGER = LoggerFactory.getLogger("modid");

public static final Block WOODEN_FURNACE = new Block(Block.Settings.create().strength(1.0f));

@Override
public void onInitialize() {
Expand All @@ -18,5 +25,7 @@ public void onInitialize() {
// Proceed with mild caution.

LOGGER.info("Hello Fabric world!");
Registry.register(Registries.BLOCK, new Identifier("smelting-in-a-pinch", "wooden_furnace"), WOODEN_FURNACE);
Registry.register(Registries.ITEM, new Identifier("smelting-in-a-pinch", "wooden_furnace"), new BlockItem(WOODEN_FURNACE, new Item.Settings()));
}
}

0 comments on commit 96ae6f4

Please sign in to comment.