Jump to content

Choonster

Moderators
  • Posts

    5170
  • Joined

  • Last visited

  • Days Won

    77

Everything posted by Choonster

  1. It looks like FMLNetworkEvent.ClientConnectedToServerEvent may be too early to send packets, so you should probably use EntityJoinWorldEvent instead. Something is sending an SPacketEntityStatus when there's no client World. Set a breakpoint in the SPacketEntityStatus(Entity, byte) constructor to see where the packet is being sent from.
  2. He said it's a side effect, not a sided effect. This has nothing to do with the client/server sides.
  3. Try using FMLNetworkEvent.ClientConnectedToServerEvent. Keep in mind that this is fired on a network thread rather than the main thread, so you need to schedule a task to run on the main thread before you can safely interact with normal Minecraft classes. I'm not entirely sure whether a SimpleNetworkWrapper can be safely used from multiple threads at once. You could check that the event's entity is the client player before sending the packet.
  4. Item capabilities are hard to sync properly, as discussed here and in the referenced issues. The best option at the moment may be overriding Item#getNBTShareTag to include the capability data required for display purposes. If you're attaching your capability to external items (from vanilla or other mods), you may have to put the capability data directly in the ItemStack's compound tag.
  5. I reported this here, cpw isn't intending to fix it. You can probably set the vanilla Item's creative tab to null before you substitute it to prevent it from showing up in the creative menu.
  6. Don't rely on numeric IDs of singletons like Block and Item, they're automatically assigned and can be different in every save. Compare the objects directly instead (e.g. state.getBlock() == Blocks.OBSIDIAN).
  7. ItemBlocks are rendered in exactly the same way as any other Item (except if they use a TESR, which the beacon item doesn't). The beacon block and item themselves use regular JSON models, the TESR is only used to render the beam. I added a regular Item that uses the beacon model here and it renders just like the vanilla beacon (as you can see in the screenshot below). @MitchB Post your model and a screenshot demonstrating how it's not working.
  8. Then iterate through the values of SoundManager#playingSounds (or use a Stream) and check if any of the ISounds match the SoundEvent you're checking for.
  9. SoundManager#playingSounds is a Map with String keys and ISound values. Printing it to the log won't help you much, since PositionedSoundRecord (an ISound implementation) doesn't override Object#toString to provide custom output. The ISound#getSoundLocation returns the name of the SoundEvent that the ISound represents, this is the smae name that's returned by SoundEvent#getSoundName, What exactly are you trying to do? Are you trying to take an action when a sound starts playing, or are you trying to detect whether a sound is playing at an arbitrary point in time?
  10. You can probably use the structure system to choose which components are generated and then use the template system to generate each component. It's entirely possible that nobody has done this before, so you'll likely have to figure it out yourself.
  11. You'd need to use an AT or reflection to access the field, yes. I'd personally recommend using reflection to avoid modifying the vanilla code, but either method should work. Another way to gain access to the SoundManager instance without ATs/reflection is by subscribing to SoundSetupEvent and storing the instance. This is probably the best option.
  12. The EventPacket no-argument constructor is private, but it needs to be public so it can be accessed by FML/Netty.
  13. You're trying to access the field through the class (SoundManager) rather than an instance of it (the one stored in the private SoundHandler#sndManager field, you can use Minecraft#getSoundHandler to get the SoundHandler instance). It's not a static field, so you can't do this.
  14. I'm not too sure. Try setting a breakpoint in the first loop in ModelLoader#loadItemModels (for(Item item : items), line 325 in my workspace) with the condition item == <your Item instance> and stepping through the code to see what's going on. If that fails, post your whole mod as a Git repository. Look at my mod and its .gitignore file for an example of the files to include. In the Referenced Libraries (Eclipse) or External Libraries (IDEA) section of the project window, there should be a library called forgeSrc-<forgeVersion>.jar that contains the code and assets from Forge and Minecraft. Eclipse can't actually open most files in JARs by default, you need to associate JSON files with the internal text editor (in Window > Preferences > General > Editors > File Associations) or install a plugin. You also need to install a plugin to view PNG files in JARs. IDEA can open JSON and PNG files in JARs by default and allows you to navigate to a file (including those in JARS) with Ctrl-Shift-N.
  15. I completely missed the fact that this is an Entity rather than a TileEntity. Still, overriding Entity#readFromNBT and Entity#writeToNBT should work (though you're meant to override Entity#readEntityFromNBT and Entity#writeEntityToNBT instead).
  16. That code should work, since TileEntity#writeToNBT writes its data to and then returns its argument.
  17. You need to override Block#isFullCube to return false. This will stop players being pushed out of the block and stop them suffocating in the block.
  18. RegistryEvent.Register and ModelRegistryEvent are both fired before preInit, so they need to be handled by static @SubscribeEvent methods in a class annotated with @Mod.EventBusSubscriber.
  19. You can read about attributes and modifiers here. You'll probably want to make a capability to manage the bonus health for each player.
  20. In 1.11+, all resource file names must be lowercase and ResourceLocation coerces both the domain and path to lowercase. 1.10.2 allows you to have mixed-case resource file names and ResourceLocations, though the domain is still coerced to lowercase. I recommend using lowercase names anyway, since it will be easier to update to 1.11.2.
  21. No, there's no ItemStack constructor that takes a String or ResourceLocation. Look at ItemMonsterPlacer.applyEntityIdToItemStack to see how it creates the required NBT structure. You can't call the method directly because it's client-only.
  22. Your models don't have to use the item's registry name as their file name, that's just the default model that's loaded when you don't specify anything else. The closing brace on line 5 of your model file closes the "textures" object, but the top-level object is never closed.
  23. I'm not sure what's causing the invisible trees, but I've submitted the PR for BonemealEvent here.
  24. It may help to read Forge's documentation on sides, which explains the difference between physical and logical sides. I'm glad you found my explanation helpful.
  25. Use ModelLoader.setCustomModelResourceLocation to register metadata-based item models. You need to call it in ModelRegistryEvent (if you're registering your Items in RegistryEvent.Register) or in preInit (if you're registering your Items in preInit). This needs to be done from a client-only class. I have an explanation of the model loading process and how ModelResourceLocations are mapped to model files here.
×
×
  • Create New...

Important Information

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