mirror of
https://github.com/dragonruler1000/hdm-mod.git
synced 2025-06-29 08:29:33 -05:00
Working on adding a Block of Dust
This commit is contained in:
parent
5f94c642db
commit
6115aeb503
11 changed files with 79 additions and 4 deletions
|
@ -16,6 +16,7 @@ import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import us.minecraftchest2.hdm_mod.block.ModBlocks;
|
||||||
import us.minecraftchest2.hdm_mod.item.ModItems;
|
import us.minecraftchest2.hdm_mod.item.ModItems;
|
||||||
//import us.minecraftchest2.hdm_mod.init.ItemInit;
|
//import us.minecraftchest2.hdm_mod.init.ItemInit;
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@ public class Hdm_mod {
|
||||||
IEventBus modEventBus1 = FMLJavaModLoadingContext.get().getModEventBus();
|
IEventBus modEventBus1 = FMLJavaModLoadingContext.get().getModEventBus();
|
||||||
|
|
||||||
ModItems.register(modEventBus1);
|
ModItems.register(modEventBus1);
|
||||||
|
ModBlocks.register(modEventBus1);
|
||||||
|
|
||||||
modEventBus1.addListener(this::setup);
|
modEventBus1.addListener(this::setup);
|
||||||
// Register the enqueueIMC method for modloading
|
// Register the enqueueIMC method for modloading
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
package us.minecraftchest2.hdm_mod.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.AbstractBlock;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraftforge.common.ToolType;
|
||||||
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
|
import net.minecraftforge.fml.RegistryObject;
|
||||||
|
import net.minecraftforge.registries.DeferredRegister;
|
||||||
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
import us.minecraftchest2.hdm_mod.Hdm_mod;
|
||||||
|
import us.minecraftchest2.hdm_mod.item.ModItems;
|
||||||
|
import us.minecraftchest2.hdm_mod.item.ModItemGroup;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public class ModBlocks {
|
||||||
|
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, Hdm_mod.MOD_ID);
|
||||||
|
|
||||||
|
|
||||||
|
public static final RegistryObject<Block> DUST_BLOCK = registerBlcok("block_of_dust",
|
||||||
|
() -> new Block(AbstractBlock.Properties.create(Material.ROCK).doesNotBlockMovement().harvestLevel(0)
|
||||||
|
.harvestTool(ToolType.PICKAXE).setRequiresTool().hardnessAndResistance(5f)));
|
||||||
|
|
||||||
|
|
||||||
|
private static <T extends Block>RegistryObject<T> registerBlcok(String name, Supplier<T> block) {
|
||||||
|
RegistryObject<T> toReturn = BLOCKS.register(name, block);
|
||||||
|
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T extends Block> void registerBlockItem(String name, RegistryObject<T> block) {
|
||||||
|
ModItems.ITEMS.register(name, () -> new BlockItem(block.get(),
|
||||||
|
new Item.Properties().group(ModItemGroup.HDM_BLOCK_GROUP)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void register(IEventBus eventBus){
|
||||||
|
BLOCKS.register(eventBus);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,8 +2,9 @@ package us.minecraftchest2.hdm_mod.item;
|
||||||
|
|
||||||
import net.minecraft.item.ItemGroup;
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import us.minecraftchest2.hdm_mod.block.ModBlocks;
|
||||||
|
|
||||||
public class ModItenGroup {
|
public class ModItemGroup {
|
||||||
public static final ItemGroup HDM_ITEM_GROUP = new ItemGroup("hdmModItemTab") {
|
public static final ItemGroup HDM_ITEM_GROUP = new ItemGroup("hdmModItemTab") {
|
||||||
@Override
|
@Override
|
||||||
public ItemStack createIcon()
|
public ItemStack createIcon()
|
||||||
|
@ -14,7 +15,7 @@ public class ModItenGroup {
|
||||||
public static final ItemGroup HDM_BLOCK_GROUP = new ItemGroup("hdmModBlockTab") {
|
public static final ItemGroup HDM_BLOCK_GROUP = new ItemGroup("hdmModBlockTab") {
|
||||||
@Override
|
@Override
|
||||||
public ItemStack createIcon() {
|
public ItemStack createIcon() {
|
||||||
return null;
|
return new ItemStack(ModBlocks.DUST_BLOCK.get());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -13,7 +13,7 @@ public class ModItems {
|
||||||
DeferredRegister.create(ForgeRegistries.ITEMS, Hdm_mod.MOD_ID);
|
DeferredRegister.create(ForgeRegistries.ITEMS, Hdm_mod.MOD_ID);
|
||||||
|
|
||||||
public static final RegistryObject<Item> DUST = ITEMS.register("dust",
|
public static final RegistryObject<Item> DUST = ITEMS.register("dust",
|
||||||
() -> new Item(new Item.Properties().isImmuneToFire().maxStackSize(63).group(ModItenGroup.HDM_ITEM_GROUP)));
|
() -> new Item(new Item.Properties().isImmuneToFire().maxStackSize(63).group(ModItemGroup.HDM_ITEM_GROUP)));
|
||||||
|
|
||||||
// public static final RegistryObject<Item> OMELET = ITEMS.register("omelet",
|
// public static final RegistryObject<Item> OMELET = ITEMS.register("omelet",
|
||||||
// () -> new Item(new Item.Properties().food()))
|
// () -> new Item(new Item.Properties().food()))
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {"model": "hdm_mod:blocks/block_of_dust" }
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,5 +4,6 @@
|
||||||
|
|
||||||
"item.hdm_mod.knife": "Subtle Knife",
|
"item.hdm_mod.knife": "Subtle Knife",
|
||||||
"item.hdm_mod.omelet": "Omelet",
|
"item.hdm_mod.omelet": "Omelet",
|
||||||
"item.hdm_mod.dust": "Dust"
|
"item.hdm_mod.dust": "Dust",
|
||||||
|
"block.hdm_mod.block_of_dust": "Block of Dust"
|
||||||
}
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/cube_all",
|
||||||
|
"textures" : {
|
||||||
|
"all": "hdm_mod:block/block_of_dust"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "hdm_mod:block/block_of_dust"
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 307 B |
Binary file not shown.
After Width: | Height: | Size: 307 B |
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"type": "minecraft:block",
|
||||||
|
"pools": [
|
||||||
|
{
|
||||||
|
"rolls": 1,
|
||||||
|
"entries":[
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "hdm_mod:dust"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue