Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/04/17 in all areas

  1. The client uses an IResourceManager instance (Minecraft#mcResourceManager) to load resources from its list of IResourcePacks (this list is compiled in Minecraft#refreshResources). The server uses various mechanisms: AdvancementManager and CraftingManager use Class#getResource to find the vanilla advancements and recipes directories respectively and then uses Java 7's NIO.2 system to iterate and load them. Forge's CraftingHelper.findFiles method (used to load mod advancements and recipes) also uses NIO.2 to iterate through the directories and load the files. LootTableManager.Loader uses Guava's Files#toString to load loot tables from files on disk and Resources#toString to load loot tables from files in JARs. TemplateManager uses FileInputStream to load structure templates from files on disk and Class#getResourceAsStream to load structure templates from files in JARs. These might be unified with the addition of data packs in 1.13.
    2 points
  2. You're using Containers with a different number of Slots on the client and server. The client uses ContainerRepair; but the server uses GuiServer, which extends ContainerRepair and adds an extra Slot. The client-side Container doesn't have a Slot at this index, so the update packets throw an IndexOutOfBoundsException. You need to use Containers with the same number of slots on both sides, usually instances of the same class. GuiRepair doesn't have a constructor that lets you provide your own Container, so you'll probably need to copy rather than extend it. If you extend a class, you don't need to copy all of its fields and methods; you only need to override the methods that should have different behaviour. To access the private IInventory fields in ContainerRepair, either use reflection or get the corresponding Slots from Container#inventorySlots and get the inventory from the Slot#inventory field. GuiServer isn't a good name, since it's not a GUI and the server doesn't have GUIs. I recommend following the MCP naming conventions and naming it something like ContainerGoldenAnvil.
    1 point
×
×
  • Create New...

Important Information

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