init commit
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package net.parsell.cherry;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.parsell.cherry.core.*;
|
||||
|
||||
public class Cherry implements ModInitializer {
|
||||
|
||||
@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.
|
||||
|
||||
System.out.println("Cherry Initilizating...");
|
||||
CherryBlocks.init();
|
||||
CherryItems.init();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package net.parsell.cherry.core;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.LeavesBlock;
|
||||
import net.minecraft.block.PillarBlock;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class CherryBlocks {
|
||||
public static final Block CHERRYLOG = new PillarBlock(FabricBlockSettings.copyOf(Blocks.OAK_LOG));
|
||||
public static final Block CHERRYLEAVES = new LeavesBlock(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES));
|
||||
|
||||
private static void registerBlocks(){
|
||||
System.out.println("Adding blocks...");
|
||||
Registry.register(Registry.BLOCK, new Identifier("cherry", "cherry_log"), CHERRYLOG);
|
||||
Registry.register(Registry.BLOCK, new Identifier("cherry", "cherry_leaves"), CHERRYLEAVES);
|
||||
System.out.println("Successfully added blocks!");
|
||||
}
|
||||
|
||||
public static void init(){
|
||||
registerBlocks();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package net.parsell.cherry.core;
|
||||
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class CherryItems {
|
||||
private static void registerBlockItems(){
|
||||
System.out.println("Adding items...");
|
||||
Registry.register(Registry.ITEM, new Identifier("cherry", "cherry_log"), new BlockItem(CherryBlocks.CHERRYLOG, new FabricItemSettings().group(ItemGroup.BUILDING_BLOCKS)));
|
||||
Registry.register(Registry.ITEM, new Identifier("cherry", "cherry_leaves"), new BlockItem(CherryBlocks.CHERRYLEAVES, new FabricItemSettings().group(ItemGroup.BUILDING_BLOCKS)));
|
||||
System.out.println("Successfully added items!");
|
||||
}
|
||||
|
||||
public static void init(){
|
||||
registerBlockItems();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package net.parsell.cherry.mixin;
|
||||
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(TitleScreen.class)
|
||||
public class CherryMixin {
|
||||
@Inject(at = @At("HEAD"), method = "init()V")
|
||||
private void init(CallbackInfo info) {
|
||||
System.out.println("This line is printed by an example mod mixin!");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user