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.

Choonster

Moderators

Everything posted by Choonster

  1. You have two classes registering entities for the same mod, each with their own ID counter. This means that you register two entities with ID 1, two entities with ID 2, etc. When you spawn an entity on the server, FML sends the ID to the client so it can spawn the entity. If you have multiple entities with the same ID, the client will spawn a different entity to the server. Either register all of your entities in the same class or use the same ID counter for both classes. Why are you maintaining your own ID to name maps? Why do you have copies of EntityRegistry.addSpawn/removeSpawn? You cannot reference client-only classes (like models) in common code, you need to use proxies. You should be registering IForgeRegistryEntry implementations (Block, Item, Biome, etc.) in the corresponding registry events rather than in preInit. Doing this will make it easier to update to 1.12.x, where GameRegistry.register is private. In future, please post one class per code block or post your code using Gist/Pastebin (one class per file in a Gist or one class per Pastebin paste). Alternatively, create a Git repository for your mod and push it to a site like GitHub.
  2. Forge's blockstates file doesn't use that format for display transformations, only Vanilla item models do. I briefly explain display transformations in Forge's blockstates format here: In addition to specifying a base TRSRTransformation in the "transform" object, you can specify a TRSRTransformation for each ItemCameraTransforms.TransformType ("thirdperson_righthand", "firstperson_lefthand", "gui", etc.). The complex example I linked in the quoted post uses this to specify a TRSRTransformation for "thirdperson" (which Forge treats as an alias of "thirdperson_righthand") and "gui".
  3. You're calling Gui#drawTexturedModalRect once when the GUI is first opened, which does nothing. You need to call it every frame (in your override of GuiScreen#drawScreen).
  4. Not supported doesn't mean that it's not possible to make mods for 1.7.10, it just means that you won't get help with it on this site.
  5. I'm not familiar with the plugin, do you not have access to the Gradle window?
  6. The damage hasn't been calculated when AttackEntityEvent is fired, use LivingHurtEvent instead.
  7. Run the build task from IDEA's Gradle window or the command line. The compiled JAR will be in build/libs.
  8. You didn't answer diesieben07's question. Did you build the JAR using IDEA's build system or did you build it using the build Gradle task? Only the latter is correct.
  9. Item#setDamage sets the ItemStack's damage to the specified amount. You call it with 1, so it sets the ItemStack's damage to 1. The method you want is ItemStack#damageItem, which increments the ItemStack's damage by the specified amount. Calling with 1 will add 1 to the damage. Side note: Don't use Item#setDamage directly, use ItemStack#setItemDamage when you want to set the ItemStack's damage instead.
  10. Then you'll need to handle each recipe class individually. For Vanilla's shaped/shapeless recipes, look for a field containing the collection of ItemStack ingredients. For Forge's ore recipes, look for a field containing the collection of Object ingredients. Each Object can be either an ItemStack or a List<ItemStack>. I strongly recommend updating to 1.12.1.
  11. Which version of Minecraft are you using? In 1.12+, use IRecipe#getIngredients to get a list of Ingredients in a recipe and Ingredient#getMatchingStacks to get a list of ItemStacks matched by an Ingredient. IRecipe#getIngredients returns an empty list for special recipes with harcoded ingredients (e.g. RecipeBookCloning, RecipeFireworks, etc.), it only returns a non-empty list for recipes that use a collection of Ingredient objects (e.g. ShapedRecipes, ShapelessRecipes, ShapedOreRecipe and ShapelessOreRecipe).
  12. The model you specified in the blockstates file doesn't exist.
  13. Items and blocks no longer have textures, they now have models. Use RenderItem#getItemModelWithOverrides to get the model for an item.
  14. Create a regular ItemStackHandler to store the inventory and use this in your Container. Create an IItemHandlerModifiable wrapper class that stores another IItemHandlerModifiable and delegates all methods to it except IItemHandler#extractItem. Implement this to always return ItemStack.EMPTY, preventing extraction from the wrapped inventory. Create an instance of this that wraps the regular ItemStackHandler and then expose this via your TileEntity's override of ICapabilityProvider#getCapability.
  15. Forge has a model animation system, but unfortunately there's not much documentation on it. It was introduced in this commit, which briefly explains the purpose of some of the classes. The grammar of the Animation State Machine files is documented here. Forge has an example here (assets), there are also some examples linked here. This can animate JSON and B3D models, but unfortunately it can't animate OBJ models.
  16. The root of the repository should be the root directory of your mod, i.e. where build.gradle and the src directory are. See my mod and its .gitignore file for an example of the repository structure to use and the files to include.
  17. The model file you've told Minecraft to use doesn't exist.
  18. Override TileEntity#shouldRefresh to return true only when the Block changes. This will allow the TileEntity to remain intact when the state changes but the Block is still the same.
  19. You need to pass the entity's ID (Entity#getEntityId) as one of the int arguments of EntityPlayer#openGUI. In your GUI handler, use World#getEntityByID to get the entity from its ID.
  20. Everything is in the source code. World generation isn't handled by the Block class, it's handled by dedicated world generation classes. If you look for usages of Blocks.DIAMOND_ORE, you'll see that it's used in BiomeDecorator#decorate to create a WorldGenMinable instance. This is later used in BiomeDecorator#generateOres to generate veins of Diamond Ore.
  21. EntityRegistry.registerModEntity has nothing to do with rendering/textures. It belongs in common code, not client-only code. The registryName argument is a registry name, not a texture path. The entityName argument should include your mod ID. The mod argument is the instance of your @Mod class, but you're passing the RenderManager instance (which is still null in preInit) instead. This isn't a mod instance, so the game crashes with a NullPointerException when Forge tries to get the mod ID to write to the log.
  22. Do you actually know Java? You can't just type an arbitrary name like that, you need to pass the method a ResourceLocation and a String. The ResourceLocation must have your mod ID as the domain. If you don't specify a domain, it defaults to minecraft. Entity registration must happen on both physical sides, so it should be done in your @Mod class or a class called from it. Render registration must be done by calling RenderingRegistry.registerEntityRenderingHandler(Class<T>, IRenderFactory<? super T>) in preInit. This must happen only on the physical client, so it should be done in your client proxy or a client-only class called from it.
  23. Create a class that extends the IRecipe class you're currently using and then override IRecipe#getRemainingItems to return the remaining item for each slot. Use ForgeHooks.defaultRecipeGetRemainingItems to get the default remaining items for every slot or ForgeHooks.getContainerItem to get the default remaining item for a single slot. Create a class that implements IRecipeFactory and parses your recipe from the provided JSON object. Specify this class in recipes/_factories.json. You can see the IRecipeFactory implementations for the Vanilla and Forge recipe classes in CraftingHelper.init. In your recipe file, set the type property to "<modid>:<recipe_name>", where <modid> is your mod ID and <recipe_name> is the name you specified in recipes/_factories.json.
  24. Passing null as an argument that isn't explicitly documented or annotated as nullable is a bad idea. You need to pass actual values for the registryName and entityName arguments. The registryName argument of EntityRegistry.registerModEntity is the registry name of the entity, which must be a unique name with your mod ID as the domain of the ResourceLocation and the entity's name as the path. The registry name is used as your entity's ID when it's being read from/written to NBT. The entityName argument of EntityRegistry.registerModEntity is a separate name for the entity, which should also be unique (i.e. you should include your mod ID in it). This is sometimes called the "old" name and is mainly used for translation/display purposes. I recommend using the registry name for this name, but it's not required to do so.

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.