Jump to content

BaconBombing

Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by BaconBombing

  1. He means your actual code not just the errors
  2. This isn't quite global variables, but the way I cut down on code was writing a function with a switch case that uses a prefix to cut down on string length for every string that was applicable. The "modifyLoot" functions probably won't be useful to you in this case because you're not modifying original Loot Pools but you can modify it to your liking. So your prefix in this case would use "entities" instead, and you would just have to write every monster name once. https://github.com/EricHedengren/StandardMaterials/blob/master/com/baconbombing/standardmaterials/loot/ModLoot.java Hope this helps!
  3. I love it when easy fixes come along Thanks!
  4. So I already created an Armor class and Item Tier class for my new set of Mod tools and armor, but I can't figure out how to set the repair material as my Mod Item. The Item I would like to use is declared as a Registry Object because that's the new way forge does it, however "fromItems" takes IItemProvider and I'm not sure how to properly declare that. Can someone help me figure this out please? Enum Class for Armor public enum ModArmorMaterial implements IArmorMaterial { TUNGSTEN("tungsten", 33, new int[]{3, 6, 8, 3}, 10, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 2.0F, () -> { return Ingredient.fromItems(ModItems.TUNGSTEN_INGOT); // Error }); Mod Repair Item public static final RegistryObject<Item> TUNGSTEN_INGOT = ITEMS.register("tungsten_ingot", ItemBase::new); Thanks for any help!
  5. So this is my current update json file, and currently when an update appears the /n don't give a new line, and it's a block of messy change log. Can someone please tell me how to do a new line or give me an example of their's? { "homepage": "https://www.curseforge.com/minecraft/mc-mods/standardmaterials/files", "promos": { "1.15.2-latest" : "1.2.0", "1.15.2-recomended" : "1.1.3" }, "1.15.2": { "1.2.0" : "Added obsidian and emerald armor/nAdded pure obsidian block/nAdded emerald horse armor/nAdded custom game achievements/nAdded recipe advancements for obtaining obsidian gem and emerald/nAdded random spawn for mod items in chests in normal structures", "1.1.3" : "Changed obsidian class repair material to obsidian gem/nCreated json updater functionality", "1.1.2" : "Rebalanced obsidian and emerald tool stats/nObsidian(3, 2000, 5.0F, 2.0F, 15)/nEmerald(2, 500, 7.0F, 3.0F, 20)/nFixed tool visual models", "1.1.1" : "Added emerald tools, emerald stats(2, 500, 10.0F, 4.0F, 25)/nChanged obsidian tool stats(3, 3000, 6.0F, 2.0F, 15)/nAdded additional obsidian tools/nRecreated textures for previous obsidian tools", "1.0.0" : "Adds obsidian sword, pickaxe, and gem" } } Thanks for your help!
  6. Guys I promise I know some Java. This is my fix public static final RegistryObject<Item> EMERALD_HORSE_ARMOR = ITEMS.register("emerald_horse_armor", ()-> new HorseArmorItem(9, new ResourceLocation("standardmaterials", "textures/entity/horse/armor/horse_armor_emerald.png"), (new Item.Properties()).maxStackSize(1).group(ItemGroup.MISC)));
  7. Well regardless of what I have for my path right now, using ("string one", "string two") gives me a syntax error. Do you mean I have to add ResourceLocation("String","String") when calling HorseArmorItem? Or would it just be something like this? ("standardmaterials", "textures/entity/horse/armor/horse_armor_emerald.png")
  8. So I'm making horse armor, and in the HorseArmorItem class public static final RegistryObject<Item> EMERALD_HORSE_ARMOR = ITEMS.register("emerald_horse_armor", ()-> new HorseArmorItem(9, ("standardmaterials", "emerald"), (new Item.Properties()).maxStackSize(1).group(ItemGroup.MISC))); The second parameter is the minecraft ResourceLocation class, public HorseArmorItem(int p_i50042_1_, ResourceLocation texture, Item.Properties p_i50042_3_) public ResourceLocation(String namespaceIn, String pathIn) Which can take two parameters. What is the correct syntax to give two strings to call HorseArmorItem so it can find my textures? Thanks for any help!
  9. Thanks so much!! That makes sense I only called ModItems.init(); in my main class and not ModBlocks.init()! I definitely won't make the same mistake. So all these replies are just a simple error on my part. Sorry for the spam, but I hope it helps someone else learn. Thanks for everyone's help!
  10. This is in a separate class named ModBlocks: public class ModBlocks { public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, StandardMaterials.MOD_ID); public static void init() { BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); } //Blocks public static final RegistryObject<Block> PURE_OBSIDIAN = BLOCKS.register("pure_obsidian", ()-> new Block(Block.Properties.create(Material.ROCK, MaterialColor.BLACK).hardnessAndResistance(50.0F, 1200.0F))); }
  11. I also found these that could give hints to what the problem is. I'm completely new to blocks, can someone please help me out? [Render thread/FATAL] [ne.mi.fm.ModLoader/LOADING]: Failed to complete lifecycle event LOAD_REGISTRIES, 1 errors found [Render thread/ERROR] [ne.mi.fm.ja.FMLModContainer/LOADING]: Caught exception during event RegistryEvent.Register<minecraft:item> dispatch for modid standardmaterials
  12. I posted it above. Does it have something to do with my block registry? I clicked on the log for at net.minecraftforge.fml.RegistryObject.get(RegistryObject.java:91) And it brought me to the method that throws the "Registry Object not present" public T get() { T ret = this.value; Objects.requireNonNull(ret, "Registry Object not present"); return ret; } So it does it not interpret ModBlocks.PURE_OBSIDIAN.get() properly? Or is it because I initialized the event bus for Items but not BlockItems? I tried to create one, but ForgeRegistries doesn't have a .BLOCKITEMS method. In their documentation they also say blockitems is a sub class to items so I shouldn't have to make another one for this to work. public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, StandardMaterials.MOD_ID); public static void init() { ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); } Alright that's plenty of thinking for one post, can someone help me out please?
  13. Thanks so much! Yeah you're right I was using the wrong parameters. "BlockItem.Properties" also works but I think it's the same thing, because the class BlockItem extends Item. Code: public static final RegistryObject<BlockItem> PURE_OBSIDIAN = ITEMS.register("pure_obsidian", ()-> new BlockItem(ModBlocks.PURE_OBSIDIAN.get(), (new Item.Properties()).group(ItemGroup.BUILDING_BLOCKS))); But it still gives an error on startup the log puts directly to the line where I initialized the Block Item. Here's a few lines from the log: java.lang.NullPointerException: Registry Object not present at net.minecraftforge.fml.RegistryObject.get(RegistryObject.java:91) at com.baconbombing.standardmaterials.items.ModItems.lambda$19(ModItems.java:56) ~[main/:?] Here's the full log:
  14. I've done a lot of searches on this forum, looked at online tutorials, etc, but all of them assume you know the right syntax for creating a Block Item using Deferred Registry, or use deprecated registering methods. The method "new BlockItem" is also apparently deprecated and the code below doesn't even work, it says constructor for blockitem is undefined, but if you go to the BlockItem class, there clearly is one. public static final RegistryObject<BlockItem> PURE_OBSIDIAN = ITEMS.register("pure_obsidian", ()-> new BlockItem(ModBlocks.PURE_OBSIDIAN.get(), ItemGroup.BUILDING_BLOCKS)); BlockItem class constructor public BlockItem(Block blockIn, Item.Properties builder) So if someone knows a thread that already went over this please tell me, or help this guy out because it isn't obvious to me on how to create block items. Thanks for any help!
  15. The only difference I can see between mine and yours is the format of the mods.toml file. I'm not sure if that makes any difference, but it's worth a shot. Mine doesn't have any tabs at all. Not any good at this stuff, just trying to help out. modLoader="javafml" #mandatory loaderVersion="[31,)" #mandatory issueTrackerURL="https://github.com/EricHedengren/StandardMaterials/issues" #optional [[mods]] #mandatory modId="standardmaterials" #mandatory version="1.1.3" #mandatory displayName="Standard Materials" #mandatory updateJSONURL="https://gist.githubusercontent.com/EricHedengren/f7d07eea9072592838f24d2889713e6f/raw" #optional displayURL="https://www.curseforge.com/minecraft/mc-mods/standardmaterials" #optional logoFile="icon.png" #optional credits="Isaac, Michael, Curseforge commenters, and the Internet" #optional authors="BaconBombingDeveloper" #optional description=''' This mod adds obsidian and emerald tools to the game. Obsidian tools are extremely durable, and emerald tools have high efficiency and attack damage. ''' [[dependencies.standardmaterials]] #optional modId="forge" #mandatory mandatory=true #mandatory versionRange="[31,)" #mandatory ordering="NONE" side="BOTH" [[dependencies.standardmaterials]] modId="minecraft" mandatory=true versionRange="[1.15.2]" ordering="NONE" side="BOTH"
  16. Okay that kind of makes sense. I only added emerald sword to "has the recipe" condition and it now adds recipes to the crafting book when they get the corresponding materials, like it's supposed to. Thanks! Does it make a difference to have all of the tools added instead? When I copy lines for the other items it gives the error "duplicate statement" on the statement "recipe". I checked your other files in the link to the GitHub, and it looks like you did separate files for each one. So if it does make a difference, how do I add multiple items to the "has the recipe" condition in the same file or should I do it separately? "has_the_recipe": { "trigger": "minecraft:recipe_unlocked", "conditions": { "recipe": "standardmaterials:emerald_sword" } } }
  17. Thank you so much!! This worked super well! I read a bunch of both of your other replies on other topics and they really help. I also found this https://github.com/skylinerw/guides/blob/master/java/advancements.md for documentation on advancements. Also, in my case do I still need the "has item recipe" condition? Emeralds don't really have a crafting recipe, if that's what that condition does. Here is my code for others who want to add this same feature: { "parent": "minecraft:recipes/root", "requirements": [ [ "has_item" ] ], "criteria": { "has_item": { "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { "item": "minecraft:emerald" } ] } } }, "rewards": { "recipes": [ "standardmaterials:emerald_sword", "standardmaterials:emerald_pickaxe", "standardmaterials:emerald_axe", "standardmaterials:emerald_shovel", "standardmaterials:emerald_hoe" ] } }
  18. I've searched far and wide, but I can't find an existing thread for this or a solution online. Can someone help me? I'm new to modding and making a new item tier. When you collect certain resources, for example diamonds, it pops up that recipes have been unlocked and it shows all recipes that use diamonds. They also appear in the crafting book helper. Can I create this for custom items? For example, pick up emeralds and new items pop up for emerald tools and the recipes show in the crafting table. Thanks for your help!
×
×
  • Create New...

Important Information

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