Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Draco18s

Members
  • Joined

  • Last visited

Everything posted by Draco18s

  1. That sounds like your loop isn't....looping.
  2. At what point in the program are you getting that? And it is correct for some points in the program: 1xitem.dyePowder@0 is a recipe result in the recipes list.
  3. Start adding system.out lines to figure out what the program is doing and narrow down the line that isn't doing what you expect.
  4. ItemStack.areItemStacksEqual(resultStack, recipeResult) should compare the two stacks. What seems to be the problem? Keep in mind that you have to set the resultStack stackSize and ItemDamage as well, otherwise it won't see the two stacks as equal (think about crafting torches: the result isn't 1 torch, it's 4!).
  5. Config arrays are a little weird. Essentially yes, but I'd suggest having a config option you don't use that contains 3 values so there's an example of the correct syntax. I'm pretty sure the whitespace Forge adds isn't required, but it does format nicely.
  6. Config files support arrays already. config.get(String category, String key, String[] defaultValues)
  7. You're almost certainly going to have to code it yourself. List boxes aren't commonly used in Minecraft.
  8. package com.draco18s.hardlib; import java.util.ArrayList; import java.util.Map; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.item.crafting.ShapelessRecipes; public class RecipesUtil { public static void RemoveRecipe(Item resultItem, int stacksize, int meta, String modID) { ItemStack resultStack = new ItemStack(resultItem, stacksize, meta); ItemStack recipeResult = null; ArrayList recipes = (ArrayList) CraftingManager.getInstance().getRecipeList(); for (int scan = 0; scan < recipes.size(); scan++) { IRecipe tmpRecipe = (IRecipe) recipes.get(scan); if (tmpRecipe instanceof ShapedRecipes) { ShapedRecipes recipe = (ShapedRecipes)tmpRecipe; recipeResult = recipe.getRecipeOutput(); } if (tmpRecipe instanceof ShapelessRecipes) { ShapelessRecipes recipe = (ShapelessRecipes)tmpRecipe; recipeResult = recipe.getRecipeOutput(); } if (ItemStack.areItemStacksEqual(resultStack, recipeResult)) { System.out.println(modID + " Removed Recipe: " + recipes.get(scan) + " -> " + recipeResult); recipes.remove(scan); } } } public static void RemoveSmelting(Item resultItem, int stacksize, int meta, String modID) { ItemStack resultStack = new ItemStack(resultItem, stacksize, meta); ItemStack recipeResult = null; Map recipes = FurnaceRecipes.smelting().getSmeltingList(); for (int scan = 0; scan < recipes.size(); scan++) { ItemStack tmpRecipe = (ItemStack) recipes.get(scan); if (ItemStack.areItemStacksEqual(resultStack, recipeResult)) { System.out.println(modID + " Removed Smelting: " + recipes.get(scan) + " -> " + recipeResult); recipes.remove(scan); } } } } Removes a crafting or smelting recipe that has a result of the given item, stacksize, and metadata.
  9. Likely because we don't know the wheel exists.
  10. Here's a class I use to unpack some custom COG files, which is based off how COG unpacks its config files (COG is also open source). package com.draco18s.hardlib; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import cpw.mods.fml.common.Loader; public class CogConfig { private static List<String> extraModules = new ArrayList<String>(); public static void addCogModule(String name) { extraModules.add(name); } public static void unpackConfigs() { File configPath = getConfigDir(); File defaultModulesDir = new File(modulesDir, "custom"); //TODO change this if you don't need a sub-folder or want a different name if (!defaultModulesDir.exists()) { defaultModulesDir.mkdir(); } for (String module : extraModules) { File writeFile = new File(defaultModulesDir, module); if(!writeFile.exists()) { unpackConfigFile(module, writeFile); } } } private static boolean unpackConfigFile(String configName, File destination) { String resourceName = "cog_config/" + configName; //TODO: change this to point to your resource location, which is inside "src/main/resources", eg. this currently points to "src/main/resources/cog_config" try { InputStream ex = HardLib.class.getClassLoader().getResourceAsStream(resourceName); BufferedOutputStream streamOut = new BufferedOutputStream(new FileOutputStream(destination)); byte[] buffer = new byte[1024]; boolean len = false; int len1; while ((len1 = ex.read(buffer)) >= 0) { streamOut.write(buffer, 0, len1); } ex.close(); streamOut.close(); return true; } catch (Exception var6) { throw new RuntimeException("Failed to unpack resource \'" + resourceName + "\'", var6); } } private static File getConfigDir() { return new File(Loader.instance().getConfigDir(), "CustomOreGen");//TODO: change this to point to you desired config location } } It's flexible enough that you should be able to alter it to handle whatever file or files you want.
  11. For a 1.6.4 micromod that I've since misplaced the code for (no really, I was syncing everything to dropbox and somewhere along the way I deleted the folders for everything pre-1.6.4). Sure. 1.6.4.? Nein, 1.5.1. and 1.6.2 It's one I do want to remake for 1.7 though, it's very useful. I'd drop the slope support though, it was slightly buggy (the custom rail required air below it, so if you tried to connect a slope to a vanilla rail that was on the ground, it would work....until that rail received a block update).
  12. And even then you'll fuck it up once in a while. Doing this correctly took me like four hours even with a properly labeled drawing of which faces face which direction and have to be constructed in what order.
  13. oops, you're right. The badly named variable names were making me see it as "var1.stackTagCompound == null; var1.stackTagCompound.setTag(...)"
  14. if (var1.stackTagCompound == null) { var1.setTagCompound(varData); //this will crash } else { //do nothing }
  15. .

    Draco18s replied to TylerCraft10's topic in Modder Support
    You never initialize darkgem
  16. Congratulations, it's running! Unless you made a coding error, your recipe works!
  17. Or you can give it whatever texture you want, then tell shouldSideRender() to return false all the time.
  18. Primarily you need: @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { return null; }
  19. That code will always get the local player. However, that code will crash a server.
  20. These gears have no meaning unless you're trying to use keybinds to affect an object in the world. If that's the case, you need packets. If you're doing something entirely client side, you don't need a world and player reference at all and should be looking into playing client-side-only sounds.
  21. Sheep, cows, pigs, and chickens can't be tamed. They just are. "Tame" is an aspect of hostile mobs, such as the wolf, ocelot, and iron golem.
  22. Items.dye (meta 15) http://minecraft.gamepedia.com/Bonemeal (look at the panel on the right)
  23. This code literally makes no sense. Where is mgear() called from? Why does it return a string and play a sound? Why not pass it a world and player parameter when its called?
  24. Recipes don't work that way.
  25. Aside from some method renaming and a annotation renaming, 1.6.4 guides are 98% identical to 1.7 code. It's really really easy. I thought there were big changes I had to pay attention to, but as it turned out it was pretty much same-ol same-ol.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.