Jump to content

Choonster

Moderators
  • Posts

    5170
  • Joined

  • Last visited

  • Days Won

    77

Everything posted by Choonster

  1. 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.
  2. @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.
  3. 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.
  4. Upload the log to Gist and reply here with a post containing the URL.
  5. Post the FML log (logs/fml-client-latest.log in the game directory) using Gist.
  6. It's a plain text file, open it in a text editor like Notepad.
  7. In short, you don't. 1.12 isn't ready yet:
  8. 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.
  9. 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".
  10. 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.
  11. 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.
  12. There are already experimental builds of Forge for 1.12 available, but they're not ready for general use.
  13. 1.7.10 is no longer supported on this forum, update if you want help.
  14. 1.7.10 is no longer supported on this forum, update if you want help.
  15. Gradle generates the Eclipse project when you run the eclipse task. Forge's documentation explains how to set up a development environment here.
  16. 1.7.10 is no longer supported on this forum, update if you want help.
  17. 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.
  18. 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.
  19. That's not the full FML log, that's the console output. It does show that this error is happening multiple times a second: The server is sending invalid chunk data, which could be the cause of the framerate drops. I don't think there's much you can do about this, apart from telling the server to fix the issue or playing on a different server. Please post the actual FML log from a session where you experienced the issue, gave Minecraft 2 GB or RAM and didn't have any mods installed (apart from Forge).
  20. Store the World in the constructor (i.e. on the network thread), but only call World#getEntityByID in the run method (i.e. on the main thread). That looks correct, yes.
  21. It looks correct, apart from this: When you create a Slot, you pass it an inventory (IItemHandler) and a slot index (the slot in that inventory to read from/write to). Two instances of the same Container class will generally have Slots with the same inventories and slot indexes. Your villager Containers should have one Slot for slot 0 of the villager's inventory (the only slot) and 36 Slots for slots 0-35 of the player's inventory (the main inventory section).
  22. In addition to what diesieben07 said, that's not the FML log, that's the console output. There's also no crash in the log you posted. Please post the actual FML log from a session where Minecraft crashes.
  23. Do this by uploading to Gist and linking it here. Don't copy the log directly into your post.
  24. Which version of Minecraft are you using? Does this happen without any mods installed (just Forge)? Upload the FML log (logs/fml-client-latest.log in the game directory) from a session where this framerate drop occurs to Gist and link it here.
  25. You can also use the ChunkPos(BlockPos) constructor to convert a BlockPos to a ChunkPos.
×
×
  • Create New...

Important Information

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