Jump to content

EM3R50N

Members
  • Posts

    22
  • Joined

  • Last visited

Everything posted by EM3R50N

  1. Thanks. Yeah - guess that makes sense now that you say it like that. I just never know how to find out if it's worth me trying to update my mods for a newer build of Minecraft without dusting off Eclipse, having my annual rage fight with gradle, etc ... only to find out Forge isn't really ready yet for that version. Guess I'll just keep trying every once in a while.
  2. Is there a sticky thread, GitHub repo or some other location where the "completion" progress of each version of Forge is posted? I try to wait until a specific version of Forge is mostly stable with the current version of MC before I updated my mods but at the moment the only way I know how to check this is to grab the latest forge/gradle files, setup a new project and look under the hood myself. How do other folks figure out how stable/"finished" each version of Forge is? Apologies if the thread/info is right under my nose here and I'm just missing it.
  3. Just realized a version of the recipe I was trying to remove was ALREADY IN VANILLA MINECRAFT... and that was what I was interpreting as a sign my recipes weren't removed yet. /headdesk x 100 God help me. @Draco18s @Cadiboo Thanks for trying to help/replying guys. Sorry for distraction
  4. Yeah deleting the commented out lines didn't change anything (again I'm desperate - realize that's crazy person logic). I guess I'm paying for my sins of not moving to JSON recipe format back when it first came out. If anyone know more about the IForgeRegistry and how that is handled and/or if it can be cleaned out/reset somehow please chime in? I obviously know very little about it right now but am assuming that's where my recipes are stuck because all my addShapeless() calls have been going through this public static void addRecipe(RegistryEvent.Register<IRecipe> event, String name, IRecipe rec) { final IForgeRegistry<IRecipe> registry = event.getRegistry(); if(rec.getRegistryName() == null) registry.register(rec.setRegistryName(new ResourceLocation(MODID, name))); else registry.register(rec); }
  5. I've had them all commented out the whole time I've been trying to get them out of my mod. All of them look like this right now // CraftingHelper.addShapeless(event, new ItemStack(Items.APPLE,0),new Object[]{Items.COAL}); // CraftingHelper.addShapeless(event, new ItemStack(Items.IRON_INGOT,0),new Object[]{Items.COAL}); // CraftingHelper.addShapeless(event, new ItemStack(Items.BONE_MEAL,0),new Object[]{Items.COAL}); Not sure if you're joking but I'm so desperate I'll try delete the commented out lines too!... but assuming that won't change anything.
  6. I know custom recipes went to JSON format quite a while ago but when I tried to start moving to that today I found out my recipes seem stuck in the mod/game and I can't clear them? All of them were added w/one of the addShapeless() methods from the CraftingHelper class below. I've tried cleaning my project, moving to updated version of forge and few other things but even though my addShapeless() recipes are commented out they're still in the game when I debug. Anyone know how to remove these recipes? It is driving me INSANE... Example of one my recipes CraftingHelper.addShapeless(event, new ItemStack(Items.APPLE,0),new Object[]{Items.COAL}); CraftingHelper class w/the addShapeless method(s): package com.me.mymod.util; import java.util.List; import com.me.mymod.Reference; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.stats.RecipeBook; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.oredict.OreIngredient; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; import net.minecraftforge.registries.IForgeRegistry; public class CraftingHelper { private static int j = 0; private static final String MODID = Reference.MOD_ID;// Mod.MODID; private static final String MODNAME = Reference.MOD_NAME; // Mod.MODNAME; public static void addRecipe(RegistryEvent.Register<IRecipe> event, int j, IRecipe rec) { final IForgeRegistry<IRecipe> registry = event.getRegistry(); if(rec.getRegistryName() == null) registry.register(rec.setRegistryName(new ResourceLocation(MODID, "recipes" + j))); else registry.register(rec); } /* * This adds the recipe to the list of crafting recipes. Cares about names. */ public static void addRecipe(RegistryEvent.Register<IRecipe> event, String name, IRecipe rec) { final IForgeRegistry<IRecipe> registry = event.getRegistry(); if(rec.getRegistryName() == null) registry.register(rec.setRegistryName(new ResourceLocation(MODID, name))); else registry.register(rec); } /* * This adds a shaped recipe to the list of crafting recipes, using the forge format. */ public static void addOldShaped(RegistryEvent.Register<IRecipe> event, ItemStack output, Object... input) { addRecipe(event, j++, new ShapedOreRecipe(new ResourceLocation(MODID, "recipes" + j), output, input)); } /* * This adds a shaped recipe to the list of crafting recipes, using the forge format, with a custom group. */ public static void addOldShaped(RegistryEvent.Register<IRecipe> event, String group, ItemStack output, Object... input) { addRecipe(event, j++, new ShapedOreRecipe(new ResourceLocation(MODID, group), output, input)); } /* * This adds a shaped recipe to the list of crafting recipes, using the forge format, with a custom group. */ public static void addOldShaped(RegistryEvent.Register<IRecipe> event, String name, String group, ItemStack output, Object... input) { addRecipe(event, j++, new ShapedOreRecipe(new ResourceLocation(MODID, group), output, input).setRegistryName(MODID, name)); } /* * This adds a shapeless recipe to the list of crafting recipes, using the forge format. */ public static void addOldShapeless(RegistryEvent.Register<IRecipe> event, ItemStack output, Object... input) { addRecipe(event, j++, new ShapelessOreRecipe(new ResourceLocation(MODID, "recipes" + j), output, input)); } /* * This adds a shapeless recipe to the list of crafting recipes, using the forge format, with a custom group. */ public static void addOldShapeless(RegistryEvent.Register<IRecipe> event, String group, ItemStack output, Object... input) { addRecipe(event, j++, new ShapelessOreRecipe(new ResourceLocation(MODID, group), output, input)); } /* * Adds a shapeless recipe with X output using an array of inputs. Use Strings for OreDictionary support. This array is not ordered. */ public static void addShapeless(RegistryEvent.Register<IRecipe> event, ItemStack output, Object... inputs) { addRecipe(event, j++, new ShapelessRecipes(MODID + ":" + j, output, createInput(inputs))); } public static void addShapeless(int outputStackCount, RegistryEvent.Register<IRecipe> event, ItemStack output, Object... inputs) { output.setCount(outputStackCount); addRecipe(event, j++, new ShapelessRecipes(MODID + ":" + j, output, createInput(inputs))); } public static void addShapeless(RegistryEvent.Register<IRecipe> event, Item output, Object... inputs) { addShapeless(event, new ItemStack(output), inputs); } public static void addShapeless(RegistryEvent.Register<IRecipe> event, Block output, Object... inputs) { addShapeless(event, new ItemStack(output), inputs); } /* * Adds a shapeless recipe with X output using an array of inputs. Use Strings for OreDictionary support. This array is not ordered. This has a custom group. */ public static void addShapeless(RegistryEvent.Register<IRecipe> event, String group, ItemStack output, Object... inputs) { addRecipe(event, j++, new ShapelessRecipes(MODID + ":" + group, output, createInput(inputs))); } public static void addShapeless(RegistryEvent.Register<IRecipe> event, String group, Item output, Object... inputs) { addShapeless(event, group, new ItemStack(output), inputs); } public static void addShapeless(RegistryEvent.Register<IRecipe> event, String group, Block output, Object... inputs) { addShapeless(event, group, new ItemStack(output), inputs); } /* * Adds a shapeless recipe with X output on a crafting grid that is W x H, using an array of inputs. Use null for nothing, use Strings for OreDictionary support, this array must have a length of width * height. * This array is ordered, and items must follow from left to right, top to bottom of the crafting grid. */ public static void addShaped(RegistryEvent.Register<IRecipe> event, ItemStack output, int width, int height, Object... input) { addRecipe(event, j++, genShaped(output, width, height, input)); } public static void addShaped(RegistryEvent.Register<IRecipe> event, Item output, int width, int height, Object... input) { addShaped(event, new ItemStack(output), width, height, input); } public static void addShaped(RegistryEvent.Register<IRecipe> event, Block output, int width, int height, Object... input) { addShaped(event, new ItemStack(output), width, height, input); } /* * Adds a shapeless recipe with X output on a crafting grid that is W x H, using an array of inputs. Use null for nothing, use Strings for OreDictionary support, this array must have a length of width * height. * This array is ordered, and items must follow from left to right, top to bottom of the crafting grid. This has a custom group. */ public static void addShaped(RegistryEvent.Register<IRecipe> event, String group, ItemStack output, int width, int height, Object... input) { addRecipe(event, j++, genShaped(MODID + ":" + group, output, width, height, input)); } public static void addShaped(RegistryEvent.Register<IRecipe> event, String group, Item output, int width, int height, Object... input) { addShaped(event, group, new ItemStack(output), width, height, input); } public static void addShaped(RegistryEvent.Register<IRecipe> event, String group, Block output, int width, int height, Object... input) { addShaped(event, group, new ItemStack(output), width, height, input); } public static ShapedRecipes genShaped(ItemStack output, int l, int w, Object[] input) { if (input[0] instanceof Object[]) input = (Object[]) input[0]; if (l * w != input.length) throw new UnsupportedOperationException( "Attempted to add invalid shaped recipe. Complain to the author of " + MODNAME); NonNullList<Ingredient> inputL = NonNullList.create(); for (int i = 0; i < input.length; i++) { Object k = input[i]; if (k instanceof String) { inputL.add(i, new OreIngredient((String) k)); } else if (k instanceof ItemStack && !((ItemStack) k).isEmpty()) { inputL.add(i, Ingredient.fromStacks((ItemStack) k)); } else if (k instanceof Item) { inputL.add(i, Ingredient.fromStacks(new ItemStack((Item) k))); } else if (k instanceof Block) { inputL.add(i, Ingredient.fromStacks(new ItemStack((Block) k))); } else { inputL.add(i, Ingredient.EMPTY); } } return new ShapedRecipes(MODID + ":" + j, l, w, inputL, output); } public static ShapedRecipes genShaped(String group, ItemStack output, int l, int w, Object[] input) { if(input[0] instanceof List) input = ((List<?>) input[0]).toArray(); else if (input[0] instanceof Object[]) input = (Object[]) input[0]; if (l * w != input.length) throw new UnsupportedOperationException( "Attempted to add invalid shaped recipe. Complain to the author of " + MODNAME); NonNullList<Ingredient> inputL = NonNullList.create(); for (int i = 0; i < input.length; i++) { Object k = input[i]; if (k instanceof String) { inputL.add(i, new OreIngredient((String) k)); } else if (k instanceof ItemStack && !((ItemStack) k).isEmpty()) { inputL.add(i, Ingredient.fromStacks((ItemStack) k)); } else if (k instanceof Item) { inputL.add(i, Ingredient.fromStacks(new ItemStack((Item) k))); } else if (k instanceof Block) { inputL.add(i, Ingredient.fromStacks(new ItemStack((Block) k))); } else { inputL.add(i, Ingredient.EMPTY); } } return new ShapedRecipes(group, l, w, inputL, output); } public static NonNullList<Ingredient> createInput(Object[] input) { if(input[0] instanceof List) input = ((List<?>) input[0]).toArray(); else if (input[0] instanceof Object[]) input = (Object[]) input[0]; NonNullList<Ingredient> inputL = NonNullList.create(); for (int i = 0; i < input.length; i++) { Object k = input[i]; if (k instanceof String) { inputL.add(i, new OreIngredient((String) k)); } else if (k instanceof ItemStack) { inputL.add(i, Ingredient.fromStacks((ItemStack) k)); } else if (k instanceof Item) { inputL.add(i, Ingredient.fromStacks(new ItemStack((Item) k))); } else if (k instanceof Block) { inputL.add(i, Ingredient.fromStacks(new ItemStack((Block) k))); } else { throw new UnsupportedOperationException( "Attempted to add invalid shapeless recipe. Complain to the author of " + MODNAME); } } return inputL; } }
  7. Answering my own (noob) question in case anyone else out there gets stuck like I was. Basically I got it working by changing my I18n calls to this I18n.format("gui.config.category.toggles") I18n.format("gui.config.category.values") And changed my en_us.lang file to this: gui.config.category.toggles.tooltip=Toggles Tooltip text here gui.config.category.values.tooltip=Values Tooltip text here I kind of get the logic now ...
  8. I'll say first I am VERY new to using the *.lang file and have historically done the evil deed of putting my string text in my code instead. However so far I can't find a way to set the tooltips of my GuiScreen / ConfigElement category buttons any other way other than the en_us.lang file. So the good news is I can set the tooltip values of my mod config buttons now via my en_us.lang file ... but the bad news is that all the tooltips append the string ".tooltip" to the end of all of them - as seen here (or attached): https://imgur.com/lmdLATO Contents of my en_us.lang file #PARSE_ESCAPES gui.config.category.toggles=General Mod Settings gui.config.category.values=Adjust settings for Humanoid and Related Mobs gui.config.category.valuesla=Adjust settings for Large Animals gui.config.category.valuesma=Adjust settings for Medium Animals gui.config.category.valuessa=Adjust settings for Small Animals
  9. I am trying to flesh out different categories of my mod config but my code is more duplicated/non-dry than I'd prefer. I'd like to just have to define one public static class Whatever extends CategoryEntry vs having to do it for EVERY category of my mod config screens. Anyone out there know how to compress these two blocks into one, reusable, more absract/dry approach? public static class CategoryEntryToggles extends CategoryEntry{ public CategoryEntryToggles(GuiConfig owningScreen, GuiConfigEntries owningEntryList,IConfigElement configElement) { super(owningScreen, owningEntryList, configElement); } @Override protected GuiScreen buildChildScreen(){ Configuration config = Config.getConfig(); ConfigElement myCat = new ConfigElement(config.getCategory(Config.CATEGORY_TOGGLES)); List<IConfigElement> propertiesOnScreen = myCat.getChildElements(); String windowTitle = "Mod Config: Toggles"; return new GuiConfig(owningScreen, propertiesOnScreen, owningScreen.modID,this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,windowTitle); } } // THIS IS BASICALLY COPY OF ABOVE WITH JUST DIFF myCat value =/ public static class CategoryEntryValues extends CategoryEntry{ public CategoryEntryValues(GuiConfig owningScreen, GuiConfigEntries owningEntryList,IConfigElement configElement) { super(owningScreen, owningEntryList, configElement); } @Override protected GuiScreen buildChildScreen(){ Configuration config = Config.getConfig(); ConfigElement myCat = new ConfigElement(config.getCategory(Config.CATEGORY_VALUES)); List<IConfigElement> propertiesOnScreen = myCat.getChildElements(); String windowTitle = "Mod Config: Values"; return new GuiConfig(owningScreen, propertiesOnScreen, owningScreen.modID,this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,windowTitle); } }
  10. Thank you @V0idWa1k3r and @Draco18s. Much appreciated! All sorted out now. Sorry if I semi-hijacked this thread btw - I did come here trying to avoid a dup post. Again - thank you both.
  11. Yeah I'm struggling to hook into EntityJoinWorldEvent for Anvil. Admittedly I am not a MC mod/java pro so I could be doing it wrong but seems to only triggers when I place it on the ground. Ideally I'd like to find what event fires when the Anvil is "USED" to repair/upgrade something. Forge has that onAnvilUpdate() in the ForeHooks but that SEEMS to have zero information about the Anvil being used (only has cost, item left, item right etc) @Draco18s when does that falling action/chance moment fire? Is that happening inside an EntityJoinWorldEvent or another, more specific event?
  12. Thanks, @V0idWa1k3r. So would overriding those events/entity only affect new anvils or all (existing) anvils?
  13. I'm interested in altering the durability of the anvil as well but am struggling to get my head around where/what to do here. Am I right that EntityJoinWorldEvent and EntityFallingBlock events only occur when you first create/place the anvil the first time? Or does this fire every time you use the anvil?
  14. I found an old thread from WARDOGSK93 on how to give a custom player_head skull as an ItemStack but thread got locked because it was so old. Just wanted to share the method I made (updated to be 1.12.2 compatible) for this (I added giving it a custom name too). // REFERENCE: http://www.minecraftforge.net/forum/topic/24228-solved-1710-player-skulls/ private ItemStack GetCustomHead(String playerName, String headName) { ItemStack customHead = new ItemStack(Items.field_151144_bL, 1, 3); customHead.setTag(new NBTTagCompound()); customHead.getTag().setTag("SkullOwner", new NBTTagString(playerName)); customHead.getOrCreateChildTag("display").setString("Name",headName); return customHead; } @WARDOGSK93 - Thank you again if you're still out there!
  15. Awesome! Thanks!! Trying to find how to give it a custom name now (vs. "SoAndSo's Head").
  16. Thanks everyone again - I learned a lot here. If there is a FAQ or sticky that sums up some of this please do point me there so I can reference that next time. Again my thanks to all. This is very helpful to know - knowing this I can build and ship my mod file w/out worrying if it will break with forge mapping changes. Thank you!
  17. Thanks nullsection76 and Oen44. It just seemed odd those methods weren't mapped as I would consider them fairly important ones. I was thinking maybe they, as you guys said, just weren't mapped yet - but: I wasn't sure if / how we were to report these to MCP (or fork/pull request ourselves?) And also I wasn't sure if it was a good idea to ship my mod with those non-mapped/obfuscated methods or if I should wait till they are mapped. By the way for the record here are the methods before/after (so far): // 1.12.2: Unmapped methods? --> Item.setMaxStackSize, Item.setUnlocalizedName and ItemModelMesher.register // BEFORE (in 1.12): myItem = (myCustomItem) new myCustomItem(7,1.0F,false,"Custom Item Name",true).setUnlocalizedName("Custom Item Unloco Name").setMaxStackSize(8); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(...); // AFTER/NOW (non-mapped): myItem = (myCustomItem) new myCustomItem(7,1.0F,false,"Custom Item Name",true).func_77655_b("Custom Item Unloco Name").func_77625_d(8); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().func_178086_a(...);
  18. Apologies if this is in a FAQ somewhere else - point me there again if so - but how can modders find out if a forgeSrc is 100% finished for a specific Minecraft version yet or not? I ask because as I was trying to update one of my mods yesterday from 1.12 to 1.12.2, I encountered missing methods in the 1.12.2 forgeSrc jars (I tried a few different releases: 2703, 2705, 2759). If I dug down into the source I could eventually find the methods (but they had obfuscated method names like: func_178086_a(), func_77655_b() and func_77625_d() for example. Basically I'm trying to confirm if these new missing methods have been deprecated or just haven't been mapped/finished in forgeSrc yet. Thanks and again my apologies if this is in a stickied/FAQ somewhere - I did look a bit first.
  19. That Wiki didn't really help but it could be that I'm just far too "beginner" with MC mod dev to see the connection (?). In any case after more searching the web I eventually found something working. I'm not sure if it's total noob way of doing it but it is working in game now. Here's what I ended up using in case anyone else ever has the same need/question as I did: ItemStack bluePantStack new ItemStack(Items.leather_leggings, 1); ((ItemArmor) bluePantStack .getItem()).setColor(bluePantStack , 2437522); event.getEntityLiving().entityDropItem(bluePantStack , 1); Color codes found here: https://github.com/FallenMoonNetwork/CanaryLib/blob/master/src/main/java/net/canarymod/api/DyeColor.java
  20. My question is pretty simple (I think). I want to drop some armor pieces that are pre-colored ... as they'd look if a player dyed them in game. I've found sites that list the various hex color codes for dyes but so far haven't found any docs or examples on how to apply to leather armor items programatically in a Forge mod. Here's the section of code I need help expanding to make this happen (if it's even possible?): - - - - - - - - - - - - - - - - - - - - - ItemStack bluePants = new ItemStack(Items.leather_leggings, 1); // *** How can I color these pants blue before dropping? *** // event.getEntityLiving().entityDropItem(bluePants, 0); - - - - - - - - - - - - - - - - - - - - - BTW - I tried a few searches here (and general Google search) but so far haven't found an existing thread asking specifically what I'm looking for - but my apologies if this info has already been asked/documented. Either my search strings are using the wrong words or maybe this just isn't possible? Feel free to just send me to a Wiki/Documentation page if one exists ... but thanks in advance for whatever help anyone can provide!
  21. DUDE! Thank you! That was it! I changed the register call (below) and the item texture started showing up in the Inventory/Player Hand! Guess it wasn't my ItemBlock handling after all. Thank you so much again! Really appreciate it. Code Change: Screenshot:
  22. Hey everyone, First let me say that I'm fairly nervous/intimidated posting this as C# is my day job language and JAVA is just something I tinker with. That said I love Minecraft and the many brilliant mods that have come out over the years! Anyhow - my apologies if I'm posting this in the wrong area or my level of Minecraft modding skills are not sufficient enough to ask a question like this! So ... after watching some tutorials I've gotten a basic Tutorial "Custom Block" mod working in 1.9 with one problem ... the ItemBlock isn't registering correctly (if at all) because the texture doesn't map to the inventory/item in the player's hand. My assumption is that since the tutorials I've been referencing are for 1.8 they don't use what looks like a new way to register Block and ItemBlock as mentioned here: 1.8.9 to 1.9 quick primer (i.e. "Blocks and their ItemBlock forms are no longer registered together ..."). I've pasted the main java class from my tutorial below to show where it's at. Again, the custom block works great in game and the texture shows up when placed fine. However the item is not textured in the player's hand or in the inventory view. My theory is it's because my handling of ItemBlock registration below isn't working ... but if my situation sounds like something else is to blame please point me in that direction. Any help would be greatly appreciated! Java code: Screenshots:
×
×
  • Create New...

Important Information

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