Jump to content

Choonster

Moderators
  • Posts

    5161
  • Joined

  • Last visited

  • Days Won

    76

Everything posted by Choonster

  1. 90% of the code in SummontheRawk is pointless, there's no need to override a super method to do exactly the same thing. All you need to override is getRecordResource . When you do override a method, you should add the @Override annotation to it. You can print text to the log/console using the standard System.out (for quick and dirty debugging) or FMLLog (for properly formatted output). You can also use a wrapper around FMLLog , like this. You can also set breakpoints and launch Minecraft in debug mode. Do you get any warnings from SoundManager earlier in the log?
  2. The file paths in sounds.json are relative to assets/<modid>/sounds, so your path is invalid unless your sound file is located at assets/themoneymod/sounds/audio/test.ogg. There should be a warning from SoundHandler earlier in the log saying that the file doesn't exist and can't be added to the sound event.
  3. If you've set up a ForgeGradle workspace, you'll have a copy of Minecraft's assets in ~/.gradle/caches/minecraft/assets (replace ~ with %USERPROFILE% on Windows).
  4. The ResourceLocation returned from ItemRecord#getRecordResource is used as the name of a sound event, not a file. You need to create a sounds.json file in assets/themoneymod in this format. Your sound files need to go in assets/themoneymod/sounds. If you name the sound event records.<recordname> (where <recordname> is the argument you passed to the ItemRecord constructor), you can just use the name argument of getRecordResource directly. I have an example implementation of a record here and a sounds.json file here.
  5. Override the method and add a String to the List for each tooltip line. You should add the lines to your lang files and use StatCollector.translateToLocal to translate them to the client's language.
  6. Create your own class that extends ItemBlock and overrides Item#addInformation . This method has an ItemStack argument, which has a metadata value. Register your Block using GameRegistry#registerBlock(Block, Class<? extends ItemBlock>, String) instead of GameRegistry#registerBlock(Block, String) .
  7. It looks like you've used the U+201C LEFT DOUBLE QUOTATION MARK (a.k.a smart quote) character instead of the U+0022 QUOTATION MARK character.
  8. You can use InventoryPlayer#addItemStackToInventory to add an item to a player's inventory (stored in the EntityPlayer#inventory field). Where you call this from depends on when you want the item to be given to the player.
  9. EntityPlayer#getItemInUse is marked as @SideOnly(Side.CLIENT) , which means that it doesn't exist on the server. To access the EntityPlayer#itemInUse field on the server, you'll need to use reflection or an access transformer.
  10. I think the error is caused by returning null from Item#onItemRightClick . ItemInWorldManager#tryUseItem expects a non-null ItemStack to be returned, even if its stackSize is 0 (which it explicitly checks for). Oddly enough, it does check if the returned ItemStack is null; but only after checking that the returned ItemStack is equal to the original ItemStack (which can't possibly be null at that point).
  11. In 1.7.10 and 1.8, the stack size is drawn in RenderItem#renderItemOverlayIntoGUI .
  12. You should override Block#getBlockLayer to return the appropriate layer (explained in TGG's post) and Block#isFullCube to return false .
  13. You need to override Block#isOpaqueCube to return false if your Block isn't a full cube. This way the adjacent Block s will still be rendered. The Grey Ghost has a post on transparent blocks here.
  14. BlockContainer overrides Block#getRenderType to return -1 (no renderer) so you can use a TESR to render the Block . If you want to use a JSON model, override it to return 3.
  15. Use World#getTileEntity to get the TileEntity at the specified position and then cast it to your TileEntity class.
  16. You're instantiating BlockOBBaseFluid before you register your Fluid s, which is invalid. You should instantiate your Fluid s and Block s inside methods called during preInit rather than in field initialisers.
  17. You made fuse and ignited static, so they're shared between all instances of your TileEntity class.
  18. Use EntityPlayer#addChatComponentMessage .
  19. Ah, I missed that. onBlockHarvested should work. This is only called server-side by vanilla, so send the message when World#isRemote is false .
  20. Got it. So I should write @SideOnly(Side.CLIENT) and then below override onBlockDestroyedByPlayer. Makes sense. No. Never use @SideOnly unless the method you're overriding uses it. This method is called on both sides. Instead, check the value of the World#isRemote field ( true on the client, false on the server). I usually send chat messages from the server side, but I don't think it matters as long as you only do it from one.
  21. There's no such thing as "the player" outside of client-only code. There may be any number of players in a World . You should override Block#onBlockDestroyedByPlayer instead, making sure to only send the message on one side.
  22. That won't work. Only one instance of the class exists, so any fields are shared between all stacks of that item type. You need to store all data in the NBT, read from and write to the stack's tag compound directly rather than storing data in fields.
  23. Item s are singletons, only one instance of the class exists for each type. If you want to store data for individual items, you need to use the NBTTagCompound of the ItemStack that you receive as an argument of various Item methods. If you don't have an ItemStack argument, you don't have access to the data.
  24. I've trouble with sending a packet from server side to client side It's my first time with packet sending Have you searched for a tutorial? I believe diesieben07 has one on this forum.
  25. Each possible state of a Block is assigned an ID based on the Block 's ID (automatically assigned) and the metadata value of that state (returned from Block#getMetaFromState ). These IDs are used by ExtendedBlockStorage to store the contents of each chunk. If two states share a metadata value, ExtendedBlockStorage won't distinguish between them. If you want a property's value to be saved with the world, you need to store it in the metadata (just like 1.7.10 and earlier).
×
×
  • Create New...

Important Information

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