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. Block#breakBlock is called when a block is replaced by another block, regardless of what caused the replacement.
  2. Override GuiButton#drawButton to set GuiButton#displayString based on the villager's following state and then call the super method.
  3. That looks correct, but you should use NBTTagCompound#getCompoundTag rather than NBTTagCompoundTag#getTag in readEntityFromNBT. There's no need to read/write values that are already handled by the parent class, e.g. the Forge profession.
  4. In writeEntityToNBT, call INBTSerializable#serializeNBT to serialise the ItemStackHandler to a compound tag and then call NBTTagCompound#setTag on the compound tag argument, passing the serialised ItemStackHandler compound tag as the second argument. In readEntityFromNBT, call NBTTagCompound#getCompoundTag on the compound tag argument to get the serialised ItemStackHandler compound tag, then pass it to INBTSerializable#deserializeNBT to deserialise the ItemStackHandler. That's not an error, that's someone printing a UUID to stdout. I don't think Vanilla or Forge do this, so it's probably your code.
  5. That's correct. @Mod#acceptableRemoteVerions expects a version range, not just a single version. It's parsed using VersionRange.createFromVersionSpec, which has a doc comment explaining the format.
  6. That's the right method, but you actually need to store the compound tag returned by it in the compound tag you receive as an argument to writeEntityToNBT. Currently you're just discarding it. You also need to do the reverse with INBTSerializable#deserializeNBT in the readEntityFromNBT method. Why are you checking World#isRemote? It's not necessary in these methods and may break things.
  7. You never write the IItemHandler to or read it from NBT, so it's not persisted when the entity is unloaded/reloaded. Do this using the INBTSerialializable methods implemented by ItemStackHandler.
  8. You're registering the Class with the event bus, but your event handler method isn't static. If you register the Class, you need to use a static method. If you register an instance, you need to use an instance method. The documentation explains this. There's no reason to create a new object of a known class and immediately call Object#getClass on it, just use a class literal.
  9. @Mod.EventHandler is only for FML lifecycle events that extend net.minecraftforge.fml.common.event.FMLEvent, e.g. FMLPreInitializationEvent or FMLServerStartedEvent and only works in your @Mod class. @SubscribeEvent is used for gameplay events that extend net.minecraftforge.fml.common.eventhandler.Event, e.g. PlayerInteractEvent.RightClickItem or TickEvent.ServerTickEvent. Forge's documentation explains events in more detail here. The ItemStack returned by PlayerInteractEvent#getItemStack will never be reference equal to an ItemStack you've just created, because they're not the same object (which is what the == operator checks). To compare ItemStacks, either get the Item, metadata, etc. and compare those or use the static equality methods in the ItemStack class. Since you're only checking the Item, use ItemStack#getItem to get the Item and check if it's equal to (==) Items.GLASS_BOTTLE.
  10. Forge tries to load the item model first and only tries to load the model from the blockstates file if that fails. I have a more detailed explanation of the model loading process here. If it's not loading your item models, the FML log should have an error message explaining why.
  11. Upload the log to Gist and reply here with a post containing the URL.
  12. Post the FML log (logs/fml-client-latest.log in the game directory) using Gist.
  13. It's a plain text file, open it in a text editor like Notepad.
  14. In short, you don't. 1.12 isn't ready yet:
  15. If you update to the latest MCP mappings, DamageSource#getSourceOfDamage/getEntity have been renamed to DamageSource#getImmediateSource/getTrueSource respectively. This makes it clearer which entity is which.
  16. I encountered several issues with your code: You're registering two different IMessageHandlers (HireVillagerPacket and ChangeFollowPacket) for the same IMessage class (MessageSendEntityId), which doesn't work. Each IMessage class can only have a single IMessageHandler. These classes are poorly named. HireVillagerPacket and ChangeFollowPacket are packet handlers, not packets. MessageSendEntityId tells me what the packet sends, but it doesn't tell me the most important piece of information: why the packet is sent, i.e. what action does it perform? You use Packet in the handler names but you use Message in the packet name, pick one and stick with it. GuiHandler#getClientGuiElement incorrectly returns a Container instead of a GuiScreen for the Hauler ID. GuiIvVillagerHauler uses ContainerIvVillagerHireNitwit instead of ContainerIvVillagerHauler. ContainerIvVillagerHauler adds 15 Slots for the villager's inventory, but the IItemHandler created in IvVillager only has one slot. The Button_Hire and Button_Follow classes no longer serve a purpose, you can replace their usages with regular GuiButtons. When you have an if statement that does nothing but set the value of a boolean variable (like in GuiIvVillagerHireNitwit#actionPerformed), you can move the expression used as the condition of the if statement directly to the initialisation of the boolean variable and remove the if statement. When you have a boolean variable declared directly before and only used in the condition of the if statement, you can move the expression used to initialise it directly into the condition of the if statement and remove the boolean variable. If the condition of an if statement is particularly complex, it can be clearer to keep some parts of it as variables. I've fixed these issues and pushed the changes to GitHub. You can view and/or merge the changes here. You appear to be using GitHub's web UI to upload changes to your repository, I highly recommend using a proper local Git client instead. This will allow you to create more fine-grained commits with descriptive messages rather than lumping all your changes into a single commit with a message like "Add files via upload".
  17. You don't create the RenderManager or RenderItem instances yourself, you use the instances Minecraft has already created. To register a Render for an Entity class, call RenderingRegistry.registerEntityRenderingHandler(Class<T>, IRenderFactory<? super T>) in preInit. In the IRenderFactory#createRenderFor implementation, create and return the Render instance. You receive the RenderManager instance as an argument of IRenderFactory#createRenderFor and you can get the RenderItem instance using Minecraft#getRenderItem. This advice applies to all versions from 1.8.9 onwards. 1.7.10 and earlier are still available for download, but they're not supported on this forum. I believe 1.8.9 is still supported, but you should really update.
  18. I'm assuming you mean "still" rather than "steel". If it's not working, describe exactly what the problem is. Did you follow the instructions I linked? What happened when you did so? Also post any error messages you're getting.
  19. There are already experimental builds of Forge for 1.12 available, but they're not ready for general use.
  20. 1.7.10 is no longer supported on this forum, update if you want help.
  21. 1.7.10 is no longer supported on this forum, update if you want help.
  22. Gradle generates the Eclipse project when you run the eclipse task. Forge's documentation explains how to set up a development environment here.
  23. 1.7.10 is no longer supported on this forum, update if you want help.
  24. World Saved Data lets you store data per-dimension or per-map. World Capabilities are just a nicer wrapper around per-dimension WorldSavedData. For a public API, I recommend using Capabilities rather than World Saved Data. I helped someone with a similar system and created my own implementation of it in this thread. You can see the API here and the implementation here.
  25. The getBiomeSpecificBlockState method fires the BiomeEvent.GetVillageBlockID event, which allows you to change the IBlockState returned by it based on the Biome. To change the IBlockState: Subscribe to the event. Note that it's fired on MinecraftForge.TERRAIN_GEN_BUS rather than MinecraftForge.EVENT_BUS. Check that the Biome is Ice Plains. Use BiomeEvent.GetVillageBlockID#getOriginal to get the original IBlockState. Set the replacement IBlockState with BiomeEvent.GetVillageBlockID#setReplacement. Set the event's result to Event.Result.DENY with Event#setResult to use the replacement IBlockState instead of the original.

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.