Jump to content

Venrob

Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by Venrob

  1. I didn't just copy the reference. I am a CS major, I have an idea of what I'm doing. I constructed a new InventoryPlayer, but for some reason that one was still affected when I cleared the original. It seems like a problem with copying a reference, yet I did not copy the reference- thus why I am confused.
  2. Okay, there were several more issues, but I seem to have it working perfectly now! For some reason, despite the InventoryPlayer being passed being just a copy of the original, it was still being cleared when the original was cleared. Don't know why, don't care anymore- I changed it so that the capability simply stores the items in 3 ItemStack[]'s (returning them in an ItemStack[][]). Best part? When dying, then returning to Title Screen before respawning, then rejoining and respawning, THE INVENTORY STILL LOADS SUCCESSFULLY! Thank you so much for your help!
  3. Is there a way to get the reference to the entity the capability is attached to?
  4. Right, okay. (Followed tutorial to a T, didn't realize that was a thing I had specified). Now when I die with the keeping medallion in my inventory, the entire inventory is just deleted. (I'm going to go through and set up some debug logging to see exactly where it is failing)
  5. Okay, that's fixed, but now there's a new crash. This one I know exactly the problem at least, but no clue how to fix it. Provider#serializeNBT returns NBTTagCompound, but the inventory is saved as an NBTTagList. How would I go about converting/changing this?
  6. I don't know what to tell you, I opened the crash report and copy/pasted. Here's a version with fixed spacing/newlines
  7. That's what the game gave me, exactly. Give me a minute, I'll try to make it more readable
  8. Well something is dreadfully wrong now... it crashed the instant I loaded a save. ...So from what I gather, it gets a NullPo when it checks if I am riding something? What is causing THAT? (I haven't updated the repo, but literally the only change made was changing the @SubscribeEvent to being static) Also, the error line is line 21 of the Storage class... that is the first line of a for loop... the only method called is inv.mainInventory.size(), which shouldn't be able to cause THIS.
  9. Oh... I forgot about the static thing AGAIN. Testing that now... The InventoryPlayer that is being passed is already a copy of the original, so it should work fine. (EventHandler.java , InventoryPlayer newInv = new InventoryPlayer(player))
  10. I've now spent an hour looking over capabilities and getting it to work, but I still have an issue. Code: https://github.com/venrob/RobsStuff-mcmod/tree/add-capabilities/main/java/com/venrob/robsstuff The relevant code is at /capabilities, as well as /utils/handlers/CapabilityHandler.java and /utils/handlers/EventHandler.java When the player dies, it should store the inventory in the capability, but the call to CapabilityHandler.getCapabilityInv(Entity entity) returns false. Should the entityPlayer not have the capability from the @SubscribeEvent method attachCapabilityEntity(AttachCapabilitiesEvent<Entity> event) ? What am I missing here?
  11. Okay, so I'm having some trouble here. I want to, under a certain condition, have the player's inventory (either the entire thing, or only certain items, depending on the condition) to be kept after death. Currently, I am just saving an InventoryPlayer variable which I store items in on LivingDeathEvent, and restore on PlayerEvent.Clone. There is an issue I have found, however- if the player disconnects from the server before clicking "Respawn", the inventory is completely lost- not just not kept through death, but does not drop either. What I have figured out is that I need to save the backup of the inventory to the player. Everything I can find online through searching tells me I should be using "IExtendedEntityProperties", though in 1.12 that doesn't appear to exist? How would I go about this in 1.12? (forge version is 14.23.4.2709 btw)
  12. Welp I'm blind. Thanks!
  13. Log: Line of my code: https://github.com/venrob/RobsStuff-mcmod/blob/master/main/java/com/venrob/robsstuff/init/ModEnchantsjava#L16 This was a server crash which happened seemingly out of nowhere, we had had 10+ hours of time on the server without any changes to my mod and without problems. I can't quite figure out what is causing this...
  14. No problem! Like I said, I literally had just coded this exact thing!
  15. Thank you! I'm still confused why the error would point toward my block registry, but that was indeed the actual issue!
  16. Conveniently, I literally just coded this into my mod. You're going to want to have a class which is an @EventBusSubscriber, with a method annotated @SubscribeEvent which takes the parameter (TickEvent.PlayerTickEvent event). Then you want to make a variable NonNullList<ItemStack> armor = event.player.inventory.armorInventory; then check if(armor.get(0).getItem()=={the boots they should be wearing, as an Item object} && armor.get(1).getItem()=={the leggings they should be wearing, as an Item object} && armor.get(2).getItem()=={the chestplate they should be wearing, as an Item object} && armor.get(3).getItem()=={the helmet they should be wearing, as an Item object}){ event.player.addPotionEffect(new PotionEffect(MobEffects.{The effect you want},{how many ticks the effect should last},{the level of the effect, -1},false,{false if you want it not to have particles, true if you do}); } Keep in mind that the effect will be re-added every tick, so you only really need to put the duration at about 5, unless you are doing Night Vision. Night Vision will flicker if it has 10 seconds or less left, so you should put a duration of 220 for that. This also won't really work for Regen or Absorption, but those are a bit complicated to do. It should work for most passive potion effects (Strength, speed, jump boost, resistance, fire resistance, etc) If you don't understand anything here, you should probably read up on some modding tutorials; they can be very helpful in grasping some of the basics here. Going through some basic online lessons on java (say Code.org) can be helpful for beginners as well.
  17. In your onModelRegistry you register block state as "inventory", in your uranium_block.json you check for block state "normal". I would change "inventory" in onModelRegistry to "normal", it should work fine then.
  18. Okay, I have been troubleshooting this for hours. I honestly have no clue what is wrong here. Code: https://github.com/venrob/RobsStuff-mcmod/tree/emeraldToolsAndArmor Crash report: The error clearly points me to my block registry of the star_block (nether star block), yet the nether star block code has not changed at all since the last time that I had it working. Also, if I comment out the Item EMERALD_AXE in ModItems, everything works again with no issues. I cannot see anything wrong with the Emerald Axe item, and honestly have no clue what could be going on here. Can anyone help?
  19. I don't quite understand why moving that to Client proxy did anything, but suddenly the texture is loading. Thank you! And yeah, I think that's a bit stupid as well, but as I'm fairly new to modding I wanted to follow the tutorial exactly for setting things up.
  20. I have done quite a bit of googling, and followed two tutorials, yet my item's texture will not render. Everything else about the item works exactly as expected, but no texture. Git repo: https://github.com/venrob/RobsStuff-mcmod That has everything, including the texture I am attempting to load (which is just a placeholder for now, I just want to get it working).
×
×
  • Create New...

Important Information

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