Jump to content

Choonster

Moderators
  • Posts

    5161
  • Joined

  • Last visited

  • Days Won

    76

Everything posted by Choonster

  1. As far as I can tell, there is no way to directly do this. Use a custom packet. That has the same problem as Minecraft.getMinecraft().thePlayer.getServer() : the server is null. It should never return null on a server-side World . GuiCommandBlock#actionPerformed sends a CPacketCustomPayload with the command and either the command block position or minecart entity ID. The server-side handler then retrieves the TileEntity or Entity from this data and saves the changes.
  2. Override Item#getAttributeModifiers to return a Multimap of AttributeModifier s that should be applied to an entity that has the item equipped in the specified slot. Use the unlocalised name of the Attribute to modify as the key.
  3. I would recommend using ModelLoader.setCustomModelResourceLocation / setCustomMeshDefinition in preInit rather than ItemModelMesher#register in init. Regardless of which method you use, this must only be done on the client; so do it from your client proxy. You can see a more generic way to register a Block and its ItemBlock here. This makes use of several Java 8 features (functional interfaces, lambdas, method references), you'd need to replace these with the corresponding Java 6/7 features (Guava's functional interfaces, anonymous classes) if you're not targeting Java 8.
  4. Send a packet to the server with the information required to execute the command. This includes the command and some way to identify the ICommandSender you want to use. On the server, get the MinecraftServer instance from the sending player's World ( World#getMinecraftServer ) and then use its ICommandManager to execute the command.
  5. Post your @Mod class.
  6. Put a breakpoint in the registerItem method and run Minecraft in debug mode. Is the breakpoint hit? Are you getting any errors in the log? Upload your item registration class and an individual item class to Gist or Pastebin with syntax highlighting and link them here. Screenshots are a terrible way to share code.
  7. The doc comments of the deprecated methods tell you which method to use now. I explain how to register items and their models in 1.9 here.
  8. The file should be called gradle.properties, not gradlew.properties.
  9. I'm not sure exactly what your issue is, but you shouldn't need to write your own loader since Forge already has one. Just call OBJLoader#addDomain with your resource domain (mod ID) and Forge will load an OBJ model from anywhere you'd normally specify a JSON model.
  10. I have a few examples of capabilities in my test mod. 1.8.9: API, implementation. 1.9: API, implementation.
  11. As the big red text at the top of the home page says, post the FML log.
  12. It would be easy enough to create your own mob spawner block, but replacing the vanilla one will be difficult. In theory you could use the substitution alias system to do this, but I don't think it actually works properly for blocks. There's no easy way to achieve what you want, but it may be possible using the work around I described previously.
  13. Unfortunately BlockEvent.HarvestDropsEvent is fired after the Block and its TileEntity have been removed from the world (unless the Block specifically delays the removal, which BlockMobSpawner doesn't). This means that you don't have access to the TileEntity from BlockEvent.HarvestDropsEvent . A possible workaround would be to cache the TileEntity in BlockEvent.BreakEvent and then use it in BlockEvent.HarvestDropsEvent to create the dropped ItemStack .
  14. In FluidUpgCActiveLava you set the fluid's name to "ActiveLava" , but in the blockstates file you use "activelava" .
  15. Look at TileEntityMobSpawner and MobSpawnerBaseLogic to see how they read from/write to NBT. ItemBlock will call TileEntity#readFromNBT with the "BlockEntityTag" sub-compound of the ItemStack when the block is placed. You can see an example of this here. The NBT structure changed slightly in 1.9, look at the 1.9 branch of the repository for the updated code.
  16. If you mouseover the line with the error, Eclipse should tell you exactly what's wrong with it. In this case, the arguments you're passing to EnumHelper.addArmorMaterial don't match its signature. Look at the EnumHelper class in your IDE to see the signature of the method.
  17. Look for the net.minecraft.item.ItemArmor class inside the forgeSrc library. If it doesn't have sources attached, you haven't set up your workspace properly. This page explains how to properly set up a ForgeGradle workspace.
  18. Use your IDE. In IntelliJ IDEA you can press Ctrl-N to bring up the Find Class window, this allows you to search for classes by name. Eclipse probably has a similar feature. You can also browse the forgeSrc library in your IDE to find the ItemArmor class and the ArmorMaterial enum inside of it.
  19. soundOnEquip is the SoundEvent to play when the armour is equipped, yes. Look at the ArmorMaterial enum itself to see which SoundEvent s are used by vanilla armour.
  20. There's no difference in this case, no. I can't think of any better way to do what you want.
  21. Minecraft will automatically load a model for each Item (the one with its registry name), but it won't actually use that model unless you tell it to with ModelLoader.setCustomModelResourceLocation / ModelLoader.setCustomMeshDefinition . I do this automatically in my mod: Every Block or Item is added to a Set as it's registered (here and here). I then register models for the Item s (including ItemBlock s) with custom model names and add these to a Set (here and here). I then iterate through the Block s and Item s that haven't had models registered and register the default model for each one (here and here).
  22. Use the one-argument constructor of CreativeTabs instead of the two-argument one and it will automatically use the next free ID for you.
  23. You'll either need to create a new TileEntitySpecialRenderer that renders signs your way and register it for TileEntitySign.class using ClientRegistry#bindTileEntitySpecialRenderer or use ASM to modify TileEntitySignRenderer . Side note: Why are you using 1.8.8? 1.8.9 has received far more updates and 1.9 is now the recommended version.
  24. I explain how to register items and their models in 1.9 here. The log should tell you exactly what went wrong with the model/texture loading process. Try following this troubleshooting guide to figure out what went wrong (though the error messages may be slightly outdated). If you still can't figure it out, upload your FML log (logs/fml-client-latest.log) and item/model registration code to Gist (with syntax highlighting) and link them here. A full repository of your code would also work instead of posting individual classes.
  25. thank you, but i guess Choonster was faster hehe. What larsgerrits said still applies to my post: Once you've created your own GUI, you need to use the IGuiHandler system to open it.
×
×
  • Create New...

Important Information

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