Skip 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. Config files support arrays already. config.get(String category, String key, String[] defaultValues)
  2. You're almost certainly going to have to code it yourself. List boxes aren't commonly used in Minecraft.
  3. 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.
  4. Likely because we don't know the wheel exists.
  5. 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.
  6. 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).
  7. 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.
  8. oops, you're right. The badly named variable names were making me see it as "var1.stackTagCompound == null; var1.stackTagCompound.setTag(...)"
  9. if (var1.stackTagCompound == null) { var1.setTagCompound(varData); //this will crash } else { //do nothing }
  10. .

    Draco18s replied to TylerCraft10's topic in Modder Support
    You never initialize darkgem
  11. Congratulations, it's running! Unless you made a coding error, your recipe works!
  12. Or you can give it whatever texture you want, then tell shouldSideRender() to return false all the time.
  13. Primarily you need: @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { return null; }
  14. That code will always get the local player. However, that code will crash a server.
  15. 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.
  16. 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.
  17. Items.dye (meta 15) http://minecraft.gamepedia.com/Bonemeal (look at the panel on the right)
  18. 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?
  19. Recipes don't work that way.
  20. 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.
  21. You mean http://www.minecraftforge.net/wiki/ ? The wiki has all kinds of things http://www.minecraftforge.net/forum/index.php/board,120.0.html ? This board has tutorials, though dominated by 1.8 things, but there's still 1.7 stuff in the archives http://www.minecraftforge.net/forum/index.php/board,118.0.html ? This board has everything to do with Forge Gradle, the "replacement" to MCP
  22. This is basic stuff dude. The block and the renderer are separate and distinct classes. To register the renderer, you need to do this (from my own project): TileEntitySpecialRenderer render = new TESRWindvane(); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityWindvane.class, render); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(OresBase.blockvane), new ItemModelRenderer(render, new TileEntityWindvane()));
  23. I noticed something: ticket.getModData().setInteger("coreX",xCoord);//set X to X ticket.getModData().setInteger("coreX",yCoord);//set X to Y ticket.getModData().setInteger("coreX",zCoord);//set X to Z Uh?
  24. Also, your TileEntity's constructor MUST take NO parameters or things will go weird, fast.

Important Information

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

Account

Navigation

Search

Search

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.