Jump to content

Distinct Soul

Members
  • Posts

    58
  • Joined

  • Last visited

Everything posted by Distinct Soul

  1. In Cadiboo's tutorials, he says to look at Cubicoder's one for 1.12.2, and it has it there: https://cubicoder.github.io/tutorials/1-12-2/2018-06-20-first-block/
  2. Then why was I told to create it? And what am I supposed to do with it now then?
  3. I hope this is what you mean, because in all my mess of trying to fix things, I don't even remember anymore: public class BlockBase extends Block implements IHasModel { public BlockBase() { super(Material.ROCK); setCreativeTab(ModItems.SOUL_FORGERY); } @Override public void registerModels() { IProxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "inventory"); } public TileEntity createNewTileEntity(World worldIn, int meta) { return null; } } If this does not include initializing them, then I would like to know how to do it. Because I've tried looking it up, and it just makes me more confused, as it just results in me getting different errors.
  4. new ItemBlock(ModBlocks.IGRIAN_ORE).setRegistryName(ModBlocks.IGRIAN_ORE.getRegistryName()),
  5. Alright, so now that errors been fixed; however, now I have a new error: I get that it's located at line 41 of my EventSubscriber class; but I have no idea what the error means. Here is that class again: @EventBusSubscriber (modid = Main.MODID) public class EventSubscriber { @SubscribeEvent public static void registerBlocks(Register<Block> event) { final Block[] blocks = { new BlockBase(Material.ROCK).setRegistryName("igrian_ore").setTranslationKey(Main.MODID + "." + "igrian_ore"), new BlockBase(Material.ROCK).setRegistryName("shard_fuser").setTranslationKey(Main.MODID + "." + "shard_fuser"), }; event.getRegistry().registerAll(blocks); } @SubscribeEvent public static void registerItems(Register<Item> event) { final Item[] items = { new ItemBase().setRegistryName("tainted_soul").setTranslationKey(Main.MODID + "." + "tainted_soul"), new ItemBase().setRegistryName("igrian_shards").setTranslationKey(Main.MODID + "." + "igrian_shards"), new ItemBase().setRegistryName("igrian_ingot").setTranslationKey(Main.MODID + "." + "igrian_ingot"), new ItemBase().setRegistryName("igrian_sword").setTranslationKey(Main.MODID + "." + "igrian_sword"), }; final Item[] itemBlocks = { new ItemBlock(ModBlocks.IGRIAN_ORE).setRegistryName(ModBlocks.IGRIAN_ORE.getRegistryName()), new ItemBlock(ModBlocks.SHARD_FUSER).setRegistryName(ModBlocks.SHARD_FUSER.getRegistryName()), }; event.getRegistry().registerAll(items); event.getRegistry().registerAll(itemBlocks); } }
  6. Ngl; but I have no clue what that's asking for me to do. I get the example (I think); but that's about it.
  7. And how do I go about doing that @Animefan8888?
  8. Oh, I thought I had something like it; but I couldn't find it at the time, so I thought I actually didn't have it.
  9. Oh my bad, I forgot that what I had in this class: @EventBusSubscriber (modid = Main.MODID) public class EventSubscriber { @SubscribeEvent public static void registerBlocks(Register<Block> event) { final Block[] blocks = { new BlockBase(Material.ROCK).setRegistryName("igrian_ore").setTranslationKey(Main.MODID + "." + "igrian_ore"), new BlockBase(Material.ROCK).setRegistryName("shard_fuser").setTranslationKey(Main.MODID + "." + "shard_fuser"), }; event.getRegistry().registerAll(blocks); } @SubscribeEvent public static void registerItems(Register<Item> event) { final Item[] items = { new ItemBase().setRegistryName("tainted_soul").setTranslationKey(Main.MODID + "." + "tainted_soul"), new ItemBase().setRegistryName("igrian_shards").setTranslationKey(Main.MODID + "." + "igrian_shards"), new ItemBase().setRegistryName("igrian_ingot").setTranslationKey(Main.MODID + "." + "igrian_ingot"), new ItemBase().setRegistryName("igrian_sword").setTranslationKey(Main.MODID + "." + "igrian_sword"), }; final Item[] itemBlocks = { new ItemBlock(ModBlocks.IGRIAN_ORE).setRegistryName(ModBlocks.IGRIAN_ORE.getRegistryName()), new ItemBlock(ModBlocks.SHARD_FUSER).setRegistryName(ModBlocks.SHARD_FUSER.getRegistryName()), }; event.getRegistry().registerAll(items); event.getRegistry().registerAll(itemBlocks); } }
  10. So what exactly should I do? I've been following Cadiboo's example as best as I can; but I've had to edit things so much I'm completely lost on what I'm supposed to do, and the right way to do it. I feel like examples would help more.
  11. Alright, so this is the class I just updated: public class ModItems { @SubscribeEvent public void registerItems(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(TAINTED_SOUL, IGRIAN_SHARDS, IGRIAN_INGOT, IGRIAN_SWORD); } // Creative Tabs public static final CreativeTabs SOUL_FORGERY = new CreativeTabs("soul_forgery") { @Override public ItemStack createIcon() { return new ItemStack(IGRIAN_INGOT); } }; // Materials public static final ToolMaterial MATERIAL_IGRIAN = EnumHelper.addToolMaterial("material_igrian", 4, 1600, 9.0F, 5.0F, 10); // Items public static final ItemBase TAINTED_SOUL = null; public static final ItemBase IGRIAN_SHARDS = null; public static final ItemBase IGRIAN_INGOT = null; // Tools public static final ItemSword IGRIAN_SWORD = new ToolSword(MATERIAL_IGRIAN); } (Added the 'registerItems' event at the top, and removed the '@ObjectHolder' annotation that I believe was causing the previous crash) The class that I now believe relates to the current crash, which in the crash log references line 52 and 43 of: @Mod.EventBusSubscriber(modid = Main.MODID, value = CLIENT) public final class ClientEventSubscriber { private static final Logger LOGGER = LogManager.getLogger(); private static final String DEFAULT_VARIANT = "normal"; @SubscribeEvent public static void onRegisterModelsEvent(@Nonnull final ModelRegistryEvent event) { ForgeRegistries.BLOCKS.getValuesCollection().stream() .filter(block -> block.getRegistryName().getNamespace().equals(Main.MODID)) .forEach(ClientEventSubscriber::registerItemBlockModel); registerItemBlockModel(ModBlocks.IGRIAN_ORE); registerItemBlockModel(ModBlocks.SHARD_FUSER); registerItemModel(ModItems.IGRIAN_INGOT); registerItemModel(ModItems.IGRIAN_SHARDS); registerItemModel(ModItems.TAINTED_SOUL); registerItemModel(ModItems.IGRIAN_SWORD); LOGGER.debug("Registered models"); } private static void registerItemModel(@Nonnull final Item item) { Preconditions.checkNotNull(item, "Item cannot be null!"); final ResourceLocation registryName = item.getRegistryName(); Preconditions.checkNotNull(registryName, "Item Registry Name cannot be null!"); ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), DEFAULT_VARIANT)); } private static void registerItemBlockModel(@Nonnull final Block block) { Preconditions.checkNotNull(block, "Block cannot be null!"); final ResourceLocation registryName = block.getRegistryName(); Preconditions.checkNotNull(registryName, "Block Registry Name cannot be null!"); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), DEFAULT_VARIANT)); } @SubscribeEvent public static void onTextureStitchEvent(@Nonnull final TextureStitchEvent event) { // Register texture for Shard Fuser final ResourceLocation registryName = ModBlocks.SHARD_FUSER.getRegistryName(); event.getMap().registerSprite(new ResourceLocation(registryName.getNamespace(), "block/" + registryName.getPath())); } } And this is the error log: Any help would be appreciated.
  12. Now when I do that it says 'Item cannot be null'; but I thought that was part of the purpose of my EventSubscriber class. Or one of my other classes at least.
  13. I did and that's why I sent that because it had to do with registering stuff, which I thought the error was talking about, as it was talking about the registry and registry events. If I didn't I would of just said: "My game crashed. Please help." and not even send anything other than the crash report. At least now that I know that it's more specifically targeted at the @ObjectHolder annotation. From that, all I can think of that might help is sending classes which contain the '@ObjectHolder' annotation. @ObjectHolder(Main.MODID) public class ModBlocks { // Blocks public static final BlockBase IGRIAN_ORE = null; public static final BlockBase SHARD_FUSER = null; } @ObjectHolder (Main.MODID) public class ModItems { // Creative Tabs public static final CreativeTabs SOUL_FORGERY = new CreativeTabs("soul_forgery") { @Override public ItemStack createIcon() { return new ItemStack(IGRIAN_INGOT); } }; // Materials public static final ToolMaterial MATERIAL_IGRIAN = EnumHelper.addToolMaterial("material_igrian", 4, 1600, 9.0F, 5.0F, 10); // Items public static final ItemBase TAINTED_SOUL = null; public static final ItemBase IGRIAN_SHARDS = null; public static final ItemBase IGRIAN_INGOT = null; // Tools public static final ItemSword IGRIAN_SWORD = new ToolSword(MATERIAL_IGRIAN); }
  14. Ok, so I've done a few changes to my mod, and I no longer have errors for my classes. However, the problem now relates to the fact that when I run my Minecraft, it crashes and says this: java.lang.IllegalStateException: The ObjectHolder annotation cannot apply to a field that does not map to a registry. Ensure the registry was created during the RegistryEvent.NewRegistry event. (found : net.minecraft.creativetab.CreativeTabs at java.lang.reflect.Field.SOUL_FORGERY) Here's my ClientEventSubscriber if it helps: @Mod.EventBusSubscriber(modid = Main.MODID, value = CLIENT) public final class ClientEventSubscriber { private static final Logger LOGGER = LogManager.getLogger(); private static final String DEFAULT_VARIANT = "normal"; @SubscribeEvent public static void onRegisterModelsEvent(@Nonnull final ModelRegistryEvent event) { ForgeRegistries.BLOCKS.getValuesCollection().stream() .filter(block -> block.getRegistryName().getNamespace().equals(Main.MODID)) .forEach(ClientEventSubscriber::registerItemBlockModel); registerItemBlockModel(ModBlocks.IGRIAN_ORE); registerItemBlockModel(ModBlocks.SHARD_FUSER); registerItemModel(ModItems.IGRIAN_INGOT); registerItemModel(ModItems.IGRIAN_SHARDS); registerItemModel(ModItems.TAINTED_SOUL); registerItemModel(ModItems.IGRIAN_SWORD); LOGGER.debug("Registered models"); } private static void registerItemModel(@Nonnull final Item item) { Preconditions.checkNotNull(item, "Item cannot be null!"); final ResourceLocation registryName = item.getRegistryName(); Preconditions.checkNotNull(registryName, "Item Registry Name cannot be null!"); ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), DEFAULT_VARIANT)); } private static void registerItemBlockModel(@Nonnull final Block block) { Preconditions.checkNotNull(block, "Block cannot be null!"); final ResourceLocation registryName = block.getRegistryName(); Preconditions.checkNotNull(registryName, "Block Registry Name cannot be null!"); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), DEFAULT_VARIANT)); } @SubscribeEvent public static void onTextureStitchEvent(@Nonnull final TextureStitchEvent event) { // Register texture for Shard Fuser final ResourceLocation registryName = ModBlocks.SHARD_FUSER.getRegistryName(); event.getMap().registerSprite(new ResourceLocation(registryName.getNamespace(), "block/" + registryName.getPath())); } } I'm not really sure what other things to give to help solve this problem.
  15. I still need help on this problem
  16. Well now that that's done with. I really don't know what to put for ClientProxy, as the only thing I had in IHasModel was this: public interface IHasModel { public void registerModels(); }
  17. I actually happened to find out that it was TranslationKey myself by going into the Minecraft Item class. And I also fixed the CreativeTabs I believe before reading this. Also, by import of your modid, do you mean like Reference.MOD_ID?
  18. That just made things worse. Now it's telling me to create a class for it. I also now have an error for setUnlocalizedName after the mappings update. MOD_ID also still has an error.
  19. Well I now got that working; but now almost all my classes have errors. Probably because of the outdated things I'm using. For example: CreativeTabs has an error.
  20. well I just did that; but it hasn't seemed to change anything. I tried changing one of the 'getResourceDomains' to 'getNameSpace' and it said it was invalid
  21. Yep. I'm still completely lost. I don't even know where to start looking to find that.
  22. I honestly don't even remember running that the first time. Where might I find it?
  23. Interesting. So then do I run the gradlew.bat after that to update it?
  24. Ah. I should probably update the forge that I'm using thinking about it. But also, are these new mappings still found on the most recommended release for Forge on 1.12? Or only later versions? Not to mention, 'ForgeDirectories' comes up with an error stating to import it. But when I do, I then get an error for MOD_ID.
  25. So now when I try and follow Cadiboo's example mod, I now get an error for 'ForgeRegistries', an error for the 'getNameSpace' on the 'onTextureStitchEvent' constructor, and an error for 'getPath' right after that.
×
×
  • Create New...

Important Information

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