Jump to content

Somonestolemyusername

Members
  • Posts

    70
  • Joined

  • Last visited

Everything posted by Somonestolemyusername

  1. im trying to add the blockitem to ModItemGroup but its not letting me
  2. wait but i mean what do i use in it to connect it to the block like for netherite_block would i use netherite_block_item?
  3. so as you see in this code i am making it spawn randomly across the map. just to tell u this is for 1.15 the code in 1.16 is something similar to this this code is just to demonstrate how you would write it. also make a separate java class in ModFolder.world.gen.OreGeneration.java and type in code something like this but dont copy, it wont work in 1.16 and replace RegistryHandler.NETHERITE_ORE with the path to the ore you want to generate thats in your registry handler also then in your main.java class where it has your mod id and stuff in the private void setup(final FMLCommonSetupEvent event) u will write OreGeneration.generate(); in the brackets private static void setupOreGeneration() { for (Biome biome : ForgeRegistries.BIOMES) { biome.addFeature(Decoration.UNDERGROUND_ORES, Feature.ORE .withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, RegistryHandler.NETHERITE_ORE.get().getDefaultState(), 10)) .withPlacement(Placement.COUNT_RANGE.configure(new CountRangeConfig(20, 5, 0, 128)))); } } public static void generate() { setupOreGeneration(); }
  4. so that when i right click the item on the ground it appears as the block and when i middle click it it appears in my inv
  5. but I mean how do i make it connect to the block?
  6. i did say it was for the ore because i also added that to it but then acedently undoed all of it which made me lose everything i wrote there
  7. well i made the DeferredRegistry Block but how do i do the DeferredRegistry BlockItem so it appears in my inv
  8. what you mean by that?? u mean like this? public static final RegistryObject<BlockItem> NETHERITE_BLOCK = BLOCKS.register("netherite_block", () -> new Item.Properties().group(RegistryHandler.ModItemGroup.instance)))
  9. well i want to do it with DeferredRegister but I dont know how im going to add it in with that. I was gonna watch the technovison tut but he made his vids unlisted so idk how im gonna make the block item with deferred register
  10. the ore isint broken it works perfectly its just like the netherite block(the ore did not get deleted) it did not appear in the inv. but when i add block items to the ore it gives an error for OreGeneration.java because its supposed to be RegistryHandler.NETHERITE_ORE.get().getDefaultState(), 10)) and I dont know what i would change it to if i make it with the ItemList.netherite_ore method
  11. I did not delete the OreGeneration.java file i just deleted the BlockItem part of the ore. also i do not understand what u meant to say here
  12. well mainly this topic was about the netherite block but i also included the netherite ore because if i figure out how to fix the netherite block i can fix the netherite ore
  13. i added the ore thing but then it messed up my ore generation so i deleted it until i figure out how to id it into the ore gen
  14. package com.vicken.mod3.util; import com.vicken.mod3.items.ItemBase; import com.vicken.mod3.items.TeleportStaff; import com.vicken.mod3.list.BlockList; import com.vicken.mod3.list.ItemList; import com.vicken.mod3.list.SoundList; import com.vicken.mod3.my_mod; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.OreBlock; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.entity.layers.ArmorLayer; import net.minecraft.item.*; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.ToolType; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import static com.vicken.mod3.my_mod.Mod_ID; public class RegistryHandler<name> { public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, Mod_ID); public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, 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); public static final RegistryObject<Item> NETHERITE_INGOT = ITEMS.register("netherite_ingot", ItemBase::new); public static final RegistryObject<Item> FRUIT = ITEMS.register("fruit", () -> new Item(new Item.Properties().group(ModItemGroup.instance) .food(new Food.Builder().hunger(4).saturation(2).build()))); public static final RegistryObject<Item> TELEPORT_STAFF = ITEMS.register("teleport_staff", () -> new TeleportStaff(new Item.Properties().group(ModItemGroup.instance).maxDamage(50))); // Blocks public static final RegistryObject<OreBlock> NETHERITE_ORE = BLOCKS.register("netherite_ore", () -> new OreBlock(Block.Properties.from(Blocks.IRON_ORE))); @SubscribeEvent public static void registerBlock(final RegistryEvent.Register<Block> event) { event.getRegistry().registerAll ( BlockList.netherite_block = new Block(Block.Properties.create(Material.IRON).sound(SoundType.METAL)).setRegistryName(location("netherite_block")) ); } @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll ( ItemList.netherite_block = new BlockItem(BlockList.netherite_block, new Item.Properties().group(RegistryHandler.ModItemGroup.instance)).setRegistryName(BlockList.netherite_block.getRegistryName()) ); } public static ResourceLocation location(String name) { return new ResourceLocation(Mod_ID, name); } //Discs public static final RegistryObject<Item> BEN10_MUSIC_DISC = ITEMS.register("ben10_disc", () -> new MusicDiscItem(1, SoundList.BEN10_DISC_LAZY, new Item.Properties().maxStackSize(1).group(ModItemGroup.instance))); //Armor // a new creative tab public static class ModItemGroup extends ItemGroup { public static final ModItemGroup instance = new ModItemGroup(ItemGroup.GROUPS.length, "ExtrasMod"); private ModItemGroup(int index, String label) { super(index, label); } @Override public ItemStack createIcon() { return new ItemStack(RUBY.get()); } } }
  15. how can I fix the Block to get into the game and be a Block item without deleting it from the game?
  16. yes I added the ore to it too but i think i deleted the code by acident
  17. also it not even did not let you put the block in your inv but it got deleted from the game
  18. the code is.down below. Also since I changed the code my Ore generation.java has errors. @SubscribeEvent public static void registerBlock(final RegistryEvent.Register<Block> event) { event.getRegistry().registerAll ( BlockList.netherite_block = new Block(Block.Properties.create(Material.IRON).sound(SoundType.METAL)).setRegistryName(location("netherite_block")) ); } @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll ( ItemList.netherite_block = new BlockItem(BlockList.netherite_block, new Item.Properties().group(RegistryHandler.ModItemGroup.instance)).setRegistryName(
  19. ok well i added the BlockItem but then it still did not add the block in the game as and item
  20. i tried but it gave me and error saying Required Type: block Provided: RegistryObject <net.minecraft.block.Block> @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { { event.getRegistry().registerAll ( ItemList.netherite_block = new BlockItem(RegistryHandler.NETHERITE_BLOCK, new Item.Properties().group(RegistryHandler.ModItemGroup.instance)).setRegistryName(RegistryHandler.NETHERITE_BLOCK.getRegistryName()) ); }
  21. well i registered the block (line:47) but when i middle clicked it to get the ore. in the console it said, my_mod:netherite_ore gave null item
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.