Compare commits

..

No commits in common. "e19141804c58eab4b1d06c43a48c8e4352be1a52" and "0c93573d818935e59f458cd2ab0eb08e6f170dd3" have entirely different histories.

17 changed files with 57 additions and 135 deletions

View File

@ -1,10 +1,10 @@
package net.parsell.cherry; package net.parsell.cherry;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.parsell.cherry.core.CherryBlocks; import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
import net.parsell.cherry.core.CherryFeatures; import net.minecraft.block.Block;
import net.parsell.cherry.core.CherryItems; import net.minecraft.block.Blocks;
import net.parsell.cherry.core.*;
public class Cherry implements ModInitializer { public class Cherry implements ModInitializer {
@Override @Override

View File

@ -11,34 +11,23 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
public class CherryBlocks { public class CherryBlocks {
public static final Block CHERRYLOG = registerPillar("cherry_log", FabricBlockSettings.copyOf(Blocks.OAK_LOG), 5, 5); public static final Block CHERRYLOG = new PillarBlock(FabricBlockSettings.copyOf(Blocks.OAK_LOG));
public static final Block CHERRYLEAVES = registerLeaves("cherry_leaves", FabricBlockSettings.copyOf(Blocks.OAK_LEAVES), 30, 60, 6649929); public static final Block CHERRYLEAVES = new LeavesBlock(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES));
public static final Block CHERRYPLANKS = registerBlock("cherry_planks", FabricBlockSettings.copyOf(Blocks.OAK_PLANKS), 5, 20);
private static Block registerBlock(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread){ private static void registerBlocks() {
Block block = new Block(settings); System.out.println("Adding blocks...");
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block); Registry.register(Registry.BLOCK, new Identifier("cherry", "cherry_log"), CHERRYLOG);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread); Registry.register(Registry.BLOCK, new Identifier("cherry", "cherry_leaves"), CHERRYLEAVES);
return block; System.out.println("Successfully added blocks!");
} System.out.println("Setting flammability...");
FlammableBlockRegistry.getDefaultInstance().add(CHERRYLOG, 5, 5);
private static Block registerPillar(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread){ FlammableBlockRegistry.getDefaultInstance().add(CHERRYLEAVES, 30, 60);
Block block = new PillarBlock(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
return block;
}
private static Block registerLeaves(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread, int color){
Block block = new LeavesBlock(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> { ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> {
return color; return 6649929;
}, block); }, CHERRYLEAVES);
return block;
} }
public static void init(){ public static void init(){
registerBlocks();
} }
} }

View File

@ -2,31 +2,22 @@ package net.parsell.cherry.core;
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry; import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
public class CherryItems { public class CherryItems {
public static BlockItem CHERRYLEAVES_I = new BlockItem(CherryBlocks.CHERRYLEAVES, new FabricItemSettings().group(ItemGroup.BUILDING_BLOCKS));
private static void registerBlockItems(){ private static void registerBlockItems(){
registerBlockItem("cherry_log", CherryBlocks.CHERRYLOG, ItemGroup.BUILDING_BLOCKS); System.out.println("Adding items...");
registerBlockItem("cherry_leaves", CherryBlocks.CHERRYLEAVES, ItemGroup.BUILDING_BLOCKS, 6649929); Registry.register(Registry.ITEM, new Identifier("cherry", "cherry_log"), new BlockItem(CherryBlocks.CHERRYLOG, new FabricItemSettings().group(ItemGroup.BUILDING_BLOCKS)));
registerBlockItem("cherry_planks", CherryBlocks.CHERRYPLANKS, ItemGroup.BUILDING_BLOCKS); Registry.register(Registry.ITEM, new Identifier("cherry", "cherry_leaves"), CHERRYLEAVES_I);
} System.out.println("Successfully added items!");
// Register a standard blockItem
private static void registerBlockItem(String itemID, Block block, ItemGroup group){
Registry.register(Registry.ITEM, new Identifier("cherry", itemID), new BlockItem(block, new FabricItemSettings().group(group)));
}
// Register a blockItem that require in-game color (leaves)
private static void registerBlockItem(String itemID, Block block, ItemGroup group, int color){
BlockItem blockItem = new BlockItem(block, new FabricItemSettings().group(group));
Registry.register(Registry.ITEM, new Identifier("cherry", itemID), blockItem);
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> { ColorProviderRegistry.ITEM.register((stack, tintIndex) -> {
return color; return 6649929;
}, block }, CherryBlocks.CHERRYLEAVES
); );
} }

View File

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "cherry:block/cherry_planks" }
}
}

View File

@ -1,5 +1,4 @@
{ {
"block.cherry.cherry_log": "Cherry Log", "block.cherry.cherry_log": "Cherry Log",
"block.cherry.cherry_leaves": "Cherry Leaves", "block.cherry.cherry_leaves": "Cherry Leaves"
"block.cherry.cherry_planks": "Cherry Planks"
} }

View File

@ -1,6 +0,0 @@
{
"parent": "block/cube_all",
"textures": {
"all": "cherry:block/cherry_planks"
}
}

View File

@ -1,3 +0,0 @@
{
"parent": "cherry:block/cherry_planks"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,13 +0,0 @@
{
"type": "minecraft:crafting_shapeless",
"group": "planks",
"ingredients": [
{
"tag": "cherry:cherry_logs"
}
],
"result": {
"item": "cherry:cherry_planks",
"count": 4
}
}

View File

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"cherry:cherry_log"
]
}

View File

@ -1,6 +1,6 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"#cherry:cherry_logs" "#cherry:cherry_wood"
] ]
} }

View File

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"cherry:cherry_planks"
]
}

View File

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"cherry:cherry_leaves"
]
}

View File

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"#cherry:cherry_logs"
]
}

View File

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"cherry:cherry_planks"
]
}