mirror of
https://github.com/TechnoVisionDev/Forge-Modding-Tutorial-1.16
synced 2024-10-27 20:34:04 +00:00
Add custom blocks
This commit is contained in:
parent
cdb7c91668
commit
45421184b7
@ -0,0 +1,13 @@
|
||||
package com.technovision.tutorial.blocks;
|
||||
|
||||
import com.technovision.tutorial.Tutorial;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class BlockItemBase extends BlockItem {
|
||||
|
||||
public BlockItemBase(Block block) {
|
||||
super(block, new Item.Properties().group(Tutorial.TAB));
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.technovision.tutorial.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class RubyBlock extends Block {
|
||||
|
||||
public RubyBlock() {
|
||||
super(Block.Properties.create(Material.IRON)
|
||||
.hardnessAndResistance(5.0f, 6.0f)
|
||||
.sound(SoundType.METAL)
|
||||
.harvestLevel(3) //1 - wood, 2 - stone, 3 - iron, 4 - diamond
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
);
|
||||
}
|
||||
}
|
@ -1,7 +1,10 @@
|
||||
package com.technovision.tutorial.util;
|
||||
|
||||
import com.technovision.tutorial.Tutorial;
|
||||
import com.technovision.tutorial.blocks.BlockItemBase;
|
||||
import com.technovision.tutorial.blocks.RubyBlock;
|
||||
import com.technovision.tutorial.items.ItemBase;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
@ -11,12 +14,20 @@ import net.minecraftforge.registries.ForgeRegistries;
|
||||
public class RegistryHandler {
|
||||
|
||||
public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, Tutorial.MOD_ID);
|
||||
public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, Tutorial.MOD_ID);
|
||||
|
||||
public static void init() {
|
||||
ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
||||
BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
||||
}
|
||||
|
||||
// Items
|
||||
public static final RegistryObject<Item> RUBY = ITEMS.register("ruby", ItemBase::new);
|
||||
|
||||
// Blocks
|
||||
public static final RegistryObject<Block> RUBY_BLOCK = BLOCKS.register("ruby_block", RubyBlock::new);
|
||||
|
||||
// Block Items
|
||||
public static final RegistryObject<Item> RUBY_BLOCK_ITEM = ITEMS.register("ruby_block", () -> new BlockItemBase(RUBY_BLOCK.get()));
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"variants": {
|
||||
"": { "model": "tutorial:block/ruby_block" }
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"item.tutorial.ruby": "Ruby",
|
||||
"block.tutorial.ruby_block": "Block of Ruby",
|
||||
"itemGroup.tutorialTab": "Tutorial"
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "tutorial:blocks/ruby_block"
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"parent": "tutorial:block/ruby_block"
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 431 B |
Loading…
Reference in New Issue
Block a user