Jump to content

vemerion

Members
  • Posts

    390
  • Joined

  • Last visited

  • Days Won

    15

Everything posted by vemerion

  1. I believe what you are looking for is the defaultAmbientLightWorld() method (called fillBrightnessRamp() in the official mappings) in the DimensionType class.
  2. Placement configs were changed a bit in 1.16, so CountRangeConfig doesn't exist any more. See this thread for more details.
  3. I think this is the latest: mappings channel: 'snapshot', version: '20210309-1.16.5'
  4. But that mod is for 1.12, so A Soulspark won't be able to use that for their 1.16 mod. Or do you mean that the repo is a good place to look to get inspired on how to implement something similar for their mod?
  5. Forgive me if I am wrong, but wouldn't that only work for players, since potion effects are not synched to the client for other entities?
  6. Did you update the mappings, because hardnessAndResistance() should still work in 1.16.5? I think it is called strength() in the official mappings.
  7. I have never used an obj model before, but my guess is that you can still use the 'display' field in the item json model file to change the rotation/translation/scale of the item. Take a look at the Minecraft wiki article about it. That would solve issue 1 and 3 I think.
  8. I understand that, but when you have found the target entity, what do you want to do with it? I am trying to figure out if you really need to know the target entity on the client. From one of your earlier replies, you seem to imply that you need the target on the client because you want to deal damage to it, but that won't work anyway, because you can't deal damage on the client.
  9. What exactly do you need the target entity for on the client?
  10. InputEvent.ClickInputEvent is a client-side only event, so you probably don't want to use that. The AttackEntityEvent is exactly what you are looking for, it is fired when a player attacks, and you can get the entity the player is attacking with AttackEntityEvent.getTarget().
  11. Who are you and what have you done to JoppeGames3!?! I feel like there is something strange going on here...
  12. I'd recommend checking out the PigEntity and BoatEntity classes to see how vanilla does it.
  13. Well, you can't make a texture with data generators, only blockstate and model json files. What the error is saying is that it can not find a texture (a png) with the name 'chocolate_trapdoor.png', in the 'textures/block' folder. Have you forgot to put your texture there? Another problem could be that you have to refresh the project in your IDE, since it caches resource files (Eclipse does at least).
  14. Alright, thank you again! getUseDuration() has actually been a bit of a thorn in my side for some time. When I wanted to make the cast time of the spells dependent on the equipment of the player, I couldn't, because we don't have access to the player, only the itemstack... Anyway, thank you for your help!
  15. Alright, thank you! So, I should use the world to determine the side when possible, and in the few cases where I cannot, I have to use EffectiveSide.get(), correct? Should I be worried about the possibility of getting the wrong side from EffectiveSide.get(), or are the risks negligible?
  16. Hello everyone! In one of my mods, I have a JsonReloadListener for a data-driven spell system (Magics.java). These magics are synched via packets to the client. The problem is that on single-player, the logical server and client shares the same Magics instance, which means that the client will overwrite the magics for the server when it receives the synch packet (as well as other potential problems such as race-conditions). Now I want to fix this issue, by having separate Magics instances for the server and client. The problem then is that there are some cases (for instance in the getUseDuration() method here), where I don't have access to a World, and don't know if it is called on the logical client or server, and therefore won't know which Magics instance to access. The Forge documentation on sides mentions that you can use thread groups (here) to determine if we are currently on the logical client or server, but only via an 'educated guess'. I don't know if that is reliable enough. Do you guys have any suggestions?
  17. Take a look at the vanilla screens, such as the ReadBookScreen class. All you really need to get started is to create a class that extends the Screen class, and then you can open the gui with Minecraft.displayGuiScreen() (which you can call for example in the onItemRightClick() method in your item).
  18. Besides IForgeBlock.isSlimeBlock() there is also IForgeBlock.isStickyBlock() and IForgeBlock.canStickTo() that you might need to override.
  19. You should never create a new instance of a world, the vanilla code handles that for you. In this case, you have access to the world via ItemUseContext.getWorld().
  20. You are right. I opted for the easy and wrong answer, and then tried to explain it away. I have updated my original answer, and I hope you can find it in your heart to forgive me! What you should do is change the type of your instance field to the type LazyOptional<IState>, which you should initialize to LazyOptional.of(() -> STATE_CAPABILITY.getDefaultInstance()), to avoid creating a new LazyOptional every time getCapability() is called. Note that you might have to slightly change some of your other methods to accommodate for the fact that instance now is a LazyOptional. Here is another thread which also discusses why you should cache the capability. I would also recommend taking a look at the LazyOptional class (easiest done via your IDE), since it includes a lot of documentation about why/how it is used.
  21. Of course you are right! However I wanted to provide a as simple solution as possible, which is why I left out that part.
  22. I usually do it like this: return STATE_CAPABILITY.orEmpty(capability, LazyOptional.of(() -> instance)); EDIT: This is the simple but very wrong answer! As diesieben07 points out further down in the thread, you should absolutely cache the LazyOptional in a field to avoid creating a new LazyOptional every time getCapability() is called.
  23. You don't need an interface, you could use the ChunkValue class only, without an interface.
  24. I recommend looking into the Global loot modifiers system.
  25. If it is your own custom item, you could use the renderHelmetOverlay() method instead of an event.
×
×
  • Create New...

Important Information

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