Jump to content

Choonster

Moderators
  • Posts

    5160
  • Joined

  • Last visited

  • Days Won

    76

Everything posted by Choonster

  1. You need to save the TileEntity's data to the ItemStack's NBT (or capabilities). You can do this by overriding Block#getDrops to create an ItemStack with the appropriate data and then return a List<ItemStack> containing it. By default, the TileEntity is removed from the world before Block#getDrops is called. You need to delay this like Forge's patch to BlockFlowerPot does.
  2. If it's crashing, post the code and the crash report/FML log. Override Block#getStateForPlacement(World, BlockPos, EnumFacing, float, float, float, int, EntityLivingBase, ItemStack) to do the following: Call the super method to get the state from the metadata Call IBlockState#withProperty on the IBlockState returned by the super method to get an IBlockState with the facing property set based on the placer argument Return the IBlockState Use Entity#getHorizontalFacing to get the horizontal EnumFacing of an Entity and EnumFacing#getOpposite to get its opposite. I believe it's GlStateManager.scale.
  3. The TileEntity passed to TileEntitySpecialRenderer#renderTileEntityAt will be null when it's rendered in the inventory. You need to store an instance of the TileEntity in your TESR to use when it's rendered in the inventory.
  4. Use the Simple Network Wrapper.
  5. Indeed, I didn't realise that you don't have access to the player in a @NetworkCheckHandler method. I think you'll need to send a packet from the client to the server when they connect to tell the server that the player has your mod installed.
  6. Indeed, I completely forgot about Set for a moment there.
  7. Unfortunately not, it just confirms what we already knew: something happens right after loading the Mekanism coremod to crash the game without printing anything to the log.
  8. There actually is a "Remove Format" button that I didn't notice before.
  9. I think the OP knows that they can't translate if the mod isn't on the client, they want to know how to detect this. I explained how to detect if the mod is on the server from the client here (sorry about the formatting, the forum migration broke it), it should be mostly the same in reverse. One caveat is that the server needs to store this per-payer rather than in a static field. Two possible options for this are capabilities or a Map<UUID, Boolean>.
  10. Before you start making a mod, make sure you have a solid understanding of Java and OO programming in general. Once you have that, you can look through some of the tutorials linked here and the Forge Documentation.
  11. I can now edit all of my posts again, even ones made before the migration. Thanks for the fix.
  12. If you look at the IBlockState class do you see a method called getPropertyKeys, or is it called getPropertyNames? The method was renamed from getPropertyNames to getPropertyKeys on 2016-11-17. If you see the old name, you should update your MCP mappings to stable_29 (the final mappings version for 1.10.2). If you're using an obfuscated build of EnderIO, it should be automatically deobfuscated to your current MCP mappings. This error suggests that you're using a deobfuscated build or EnderIO/EnderCore are messing with the deobfuscation.
  13. Can you post the FML log (logs/fml-client-latest.log in the game directory) rather than the console output? It may have some more useful information.
  14. ReflectionHelper.getPrivateValue gets the value of a field, EntityLiving#getLootTable is a method. Looking up a field/method via reflection is expensive, so you should use ReflectionHelper.findField/findMethod and store the Field/Method object in a static final field and use that to access/modify the field's value or call the method. You're only passing the MCP name of the method to ReflectionHelper, so it won't work outside of the development environment. You need to pass the SRG name as well as the MCP name. You can find the SRG name of a field/method using MCPBot.
  15. There doesn't seem to be any way to toggle off the tt formatting or clear formatting completely. Either this didn't work or there's some other restriction on editing. I edited a post a few time shortly after posting it, but now it's been about 8 minutes since it was posted and I can't seem to edit it any more.
  16. Would it be possible to convert the [tt] tags in all the old posts to monospace font instead of code blocks? Having the [tt] tag work in new posts would also be more convenient than having to highlight the text and click a button. Most of my old posts are borderline unreadable because each section of inline code has been replaced with a code block.
  17. If EntityLiving#getLootTable returns a non-null value, you can use LootTableManager#getLootTableFromLocation to get the LootTable from that ResourceLocation. You can then go through the table's pools and entries to build the list. If the entity doesn't use a loot table (e.g. EntityWither), you'll need to hardcode its drop list. Look at JustEnoughResources for an example of how to work with loot tables.
  18. ContainerMessage is being sent to the client, so ContainerMessageHandler will be executed on the logical client side. This means that you can't use server classes like EntityPlayerMP and NetHandlerPlayServer, you need to get the client player instead. I do this using a method in my proxy that takes the MessageContext and returns the player. In the client proxy, I override this to return Minecraft#player if MessageContext#side#isClient returns true or MessageContext#getServerHandler#player if it doesn't. In the server proxy, I override it to return MessageContext#getServerHandler#player if MessageContext#side#isServer returns true or throw an exception if it doesn't (because something has gone wrong if you're getting a client-side MessageContext on the dedicated server). To be safe, you should probably send the Container's ID (Container#windowId) in the packet and check that it matches the open Container's ID in your packet handler before you update it with the packet's data. Vanilla packets like SPacketSetSlot do this.
  19. Override it. Forge will call it when required, you don't call it yourself.
  20. You never register CapabilityHandler on the Forge event bus, so CapabiltiyHandler#attachCapability is never called and the capability is never attached to any ItemStack. What diesieben07 said also applies, though.
  21. As I said several times in my previous post, the intention was never to completely prevent my replacement from being overridden, just for it not to be overridden by resource packs that replace the vanilla model (e.g. minecraft:foobar). If a resource pack replaces the replacement model (e.g. mymod:foobar_replacement), that's fine.
  22. I'm not suggesting that you'd want to stop a texture from being overridden, just that you might want your replacement of a specific model/texture to take priority over other replacements (which isn't possible to do reliably without a lot of hackery). If my mod replaced a vanilla model, the ideal behaviour would be that this replacement takes priority over user-added resource packs replacing the vanilla file; but user-added resource packs could still override my replacement file. Although I've just remembered that you don't have to replace vanilla models using resource packs, you can simply tell Minecraft to use a different model for the Item/Block in code. This way resource packs that replace the vanilla model are ignored, but resource packs can still replace your model.
  23. It's what allows resource packs to replace files from mods, so it's useful in that respect; but if you're replacing a vanilla file you may not want that replacement overridden by a resource pack that also replaces the same file. A lot of resource packs only replace vanilla textures (but this definitely isn't always the case), so you could replace the model/blockstates file with one pointing to your own textures/models. A resource pack designed for your mod could still replace these, but a resource pack that replaces the vanilla textures wouldn't have any effect.
  24. This is true, but it's worth noting that user-added resource packs will take priority over mod resource packs. This means that if a user-added resource pack and a mod resource pack both replace the same file, the one from the user-added resource pack will be used.
×
×
  • Create New...

Important Information

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