Jump to content

urbanxx001

Members
  • Posts

    200
  • Joined

  • Last visited

Everything posted by urbanxx001

  1. Right you can store that in the key... sorry for the stupid questions. All set now. Edit: Oml I just realized getItem and setItem are the built-in methods for itemstack data 🤦. I've used getItem before but it never occured to me that it was for a data key.
  2. I appreciate all your help. I've created a data key in the entity class which is being updated, but I'm not sure how to link it with the tag in the item class (responsible for the property override). Either that or the key needs to be accessed from the item class too. Alternatively I've tried an if statement in the override method, to detect when an entity is created and tell it to grab a float from the entity class instead. This works, but it updates all modItemEntities in the world as it's not an instance of the current item. ModItemEntity with Data Key https://pastebin.com/TeQMiEKf
  3. After looking at the ItemEntity class as you suggested, it seems to handle syncing with EntityDataManager. However, getShareTag and readShareTag also exist, as well as onEntityItemUpdate in the item class. Which of these would be the best option?
  4. You could do the following: Map<Effect, EffectInstance> potionMap = entityLiving.getActivePotionMap(); if (potionMap.containsKey(Effects.EFFECT_NAME)) { // Do something }
  5. Ah ok I'll take look, thanks! I figured the packet would handle it, but now I realize the one I have is only for spawning.
  6. ModItem Class: https://pastebin.com/3ZR4XkXE ModItemEntity Class: https://pastebin.com/9KywYMWr
  7. Going off of what Ash said, a soft dependency is easy to implement. Below is one way. In your build.gradle, if you add the following plugin line at the top: apply plugin: 'maven-publish' Then in the dependencies section of the same file you can add a line such as (if we were adding the JEI mod): implementation fg.deobf("curse.maven:jei:2995910") Where the string of numbers is part of the web address for the specific version of the mod on curseforge. Then when you refresh your workspace, the mod should download as an external library (if the source is available). The plugin is also used for publishing to a maven repository, but the repository function isn't necessary if you're only using it to add a soft dependency (if you want to use it in that way though, go ahead)
  8. During the tick method in an item's entity class, I'm altering the item's custom NBT tags. The tags are being updated, but the method tied to one of them that handles a property override, isn't. (no texture change is seen). The model files are correct, as the override works in a SpecialRecipe class. What could be the issue? Idk if it's related to this by chance (although that deals with capabilities).
  9. Oh no that sounds like capability stuff lol. Maybe I'll stick with separate classes then. I'll fix the map as you suggested though. Thanks!
  10. In my projectile entity class, getDefaultItem is: @Override public Item getDefaultItem() { HashMap<Float, Item> itemMap = new HashMap<>(); itemMap.put(1F, ModItems.ITEM_1); itemMap.put(1.25F, ModItems.ITEM_2); itemMap.put(1.5F, ModItems.ITEM_3); itemMap.put(1.75F, ModItems.ITEM_4); itemMap.put(2F, ModItems.ITEM_5); System.out.println("floatField: " + floatField); return itemMap.get(floatField); } Where floatField is a (non-final) field initialized in the constructor. However, floatField returns zero in this method, even though it returns the correct nonzero value in a method like onImpact, which is also an override. Is this a simple fix, or should I settle for separate entity classes for each ModItem that extend this base class?
  11. Same thing for me... I've tried with both the hotswap plugin and without, and no changes occur. I've verified everything is setup correctly. Also not sure of the difference between "Recompile" under Build, and "Reload Changed Classes" under debug actions (I assume it makes no difference in debug mode?). Or if only certain changes are detected during runtime.
  12. I'm sorry I don't know what to tell you. I can't imagine how frustrating it is. If you want to transfer your builds from the old world to a new one, you can use structure blocks.
  13. Ah ok, thank you so much! I'll create a packet and cover both events then.
  14. Ok then try that. In general, if no mods are installed and the portals still don't work, then the world is probably corrupted.
  15. It's not for interacting with another entity though, which is why I'm using PlayerInteractEvent$RightClickEmpty. Or are you recommending the other two methods as they can access ServerPlayerEntity? My main issue is getting the server player. I can already get the slot from player.getItemStackFromSlot(EquipmentSlotType.CHEST);
  16. I agree with a lot of your points Ash But not everything has to be done by brute-forcing your way through MC source code. There's no reason to suffer if there's an existing model and it's done right. The code of popular mods worked on by large teams, are usually done right. And vanilla sometimes uses practices that mods can't access. Otherwise, yes vanilla is an invaluable tool.
  17. Ok so the Nether works but not the End when you restore them from the previous version, i.e. moving those folders from pre-1.16.3 to the post-1.16.3 world. So when you tried travelling to the End in 1.16.3, there were no mods installed but you used the modded world, correct?
  18. Given your execute command didn't find the nether or end, it's safe to say they don't exist anymore. You said you tried copying the Level.dat files and nothing happened, did you try copying over the dimension folders from before the update to the new world as well?
  19. You'll want to implement custom VoxelShapes for different blockstates in your block class. It might be helpful to extend FenceBlock if you want to use some of the logic already present there. You might first want to create the block model(s) in a program like BlockBench, and then get the model coordinates from there to put in the class. I recommend TechnoVision's tutorial on custom block models. It's also helpful to look at vanilla classes.
  20. Yes but it needs to happen when the item, which is armor, is equiped, i.e. it's not in the hotbar.
  21. This post helped me when I was also tackling ItemModelProperties. You want to create a method in your item class that designates each itemstack change with a float, and register it with: DeferredWorkQueue.runLater(() -> { ItemModelsProperties.func_239418_a_( ModItems.YOUR_ITEM, new ResourceLocation(MOD_ID, "your_item"), (stack, world, entity) -> YourItemClass.yourMethod(stack)); }); And then specify the texture overrides in your item model json. Also you can find vanilla classes in External Libraries => Gradle net.minecraftforge:forge:[version]
  22. I have a RightClickEmpty event that needs to pass the server player into a method from an item class. However, event.getPlayer() only returns the client player. I heard that it should be done with packet handlers then, is that right? Alternatively, I could achieve the same thing with the onArmorTick method in the item class. But for that I would need to detect right clicking, which doesn't seem possible without an event.
  23. In terms of that, usually older versions will have more documentation (with the number of archived forum posts), but newer versions are easier to work with, such as with the new Deferred Registry system. That's probably obvious, but it's worth mentioning.
  24. A new latest.log isn't generated in run/logs, if you're referring to the separate file from the console log. Or I misunderstand. Edit: Everything is resolved after adding the cursemaven plugin: plugins { id "com.wynprice.cursemaven" version "2.1.1" } Thank you anyway though!
  25. Full gradle:
×
×
  • Create New...

Important Information

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