Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

LordSaad

Members
  • Joined

  • Last visited

Everything posted by LordSaad

  1. No no no... My display is updating properly. Getting the cap seems to return the proper one as well. So it's definitely working CLIENT side. But the clone event returns the default cap, so it's not changing on the SERVER. So i have to send the packet from client to server, right? You said it exists on the server, but I'm updating the value from the client.
  2. So basically make a packet that sends from client to server that acts on the cap. Right? That's what I'm getting here. That should be easy.
  3. How is it not updating though? I have a hud thing that renders the int on my hud, running the command (which sends a sync packet) updates it on my hud as well, therefore I can only assume it's being sent and read properly. Is the packet insufficient? What would I have to do?
  4. Ignore the purse for a sec. I was trying a lot of things and didn't update everything per solution. https://github.com/LordSaad44/Cash-Shop/blob/master/src/main/java/me/lordsaad/cashshop/common/command/CommandWallet.java#L49 I'm updating the cap here server side and it works perfectly. It's clone copying that's dysfunctional...
  5. I just uploaded a new commit with the fix you suggested, you have a point, i should be setting it. But that actually didn't work. It failed with the same result. https://github.com/LordSaad44/Cash-Shop/blob/master/src/main/java/me/lordsaad/cashshop/common/core/EventHandler.java
  6. I made a capability that saves 1 int in the player. It acts as the amount of money they have in their account. Upon death or relog, the cap resets back to it's default value. It works PERFECTLY otherwise. I've asked multiple people. 5/6 don't know how caps work, the remaining 1/6 couldn't figure out the issue because my cap is basically a carbon copy of his, yet his persists. Anyways, capability package: https://github.com/LordSaad44/Cash-Shop/tree/master/src/main/java/me/lordsaad/cashshop/api/capability Class that's hooking the cap to the player: https://github.com/LordSaad44/Cash-Shop/blob/master/src/main/java/me/lordsaad/cashshop/api/ModCapabilities.java Packet: https://github.com/LordSaad44/Cash-Shop/tree/master/src/main/java/me/lordsaad/cashshop/common/network Registering the cap: https://github.com/LordSaad44/Cash-Shop/blob/master/src/main/java/me/lordsaad/cashshop/common/CommonProxy.java#L26 (registering the event down in postInit) (works perfectly, i breakpointed) I tried the respawn event (PlayerEvent.Clone), but the original entity in the event had it's cap reset as well, so i was copying the default reset value from the original entity over to the new entity. Respawn(clone) event: https://github.com/LordSaad44/Cash-Shop/blob/master/src/main/java/me/lordsaad/cashshop/common/core/EventHandler.java
  7. That worked perfectly. Thank you I was registering them in common because I assumed that's how they worked. How the hell are Elucent's mods working properly? https://github.com/RootsTeam/Roots/blob/master/src/main/java/elucent/roots/proxy/CommonProxy.java#L28 I'm just really curious. He doesn't even register these in the main mod file.
  8. http://i.imgur.com/kcbTBi5.png A fatal error? LOG: http://pastebin.com/wVZxmgem What am i doing wrong in my packet handler?
  9. I'll do that later. What should I do to fix the registration of the caps right now?
  10. Should I call the same line: CapabilityManager.INSTANCE.register(IWizardryCapability.class, new WizardryCapabilityStorage(), DefaultWizardryCapability.class); In the clientProxy's preInit as well? or in the main class's preInit or what? I just tried registering the cap in clientproxy and that crashed, then tried the main class's preinit and that crashed as well. I'm assuming I shouldn't be registering it like that. What must I do?
  11. It is. CommonProxy -> preInit() { } http://i.imgur.com/I5y3cSb.png
  12. My apologize, Intellij must've reformatted and removed redundant imports. I just pushed a new commit, and here's the new log: http://pastebin.com/YuifF4q8
  13. I did paste the error, it's a above... http://pastebin.com/1mq5KEXZ That's the null pointer I get from getCapability(player).
  14. So what should I do? I assumed that was the perfect event to attach a capability, but if I cant even get the entity, what am I supposed to do?
  15. http://i.imgur.com/3ZiYUcY.png Breakpointed. Why is the player entity null?! the capability: http://i.imgur.com/9Qo16az.png That's correct, but the entityPlayer does NOT look promising... Why is it null?! http://i.imgur.com/cpNHNig.png
  16. Because I need that same capability for blocks (haven't coded that part yet) And players can hold capabilities, so it's a perfect solution/usage.
  17. Yes it does. but I temporarily prevented that with a null check. I'm fairly certain I'm sending the packets.
  18. Here's a fun redundant log for anyone who wants it: http://pastebin.com/1mq5KEXZ This was after removing "if (data == null) return;" (which just stopped the entire event there) That's one example usage of getting the cap. I've used it in a lot more places and it's just the same result.
  19. It really is redundant to post. It's a null pointer on that get method anywhere and everywhere I call it. Nothing else about it. It's IWizardryCapability being returned null from that get method.
  20. If you read the post, I get a null pointer every single time i do CapabilityProvider.get(player)
  21. Hey there! So I was trying to make my first ever capability, but it gives a null pointer exception every time I try to get the capability of a player ANYWHERE in the mod at ANY time. I even tried to copy the capabilities from another mod byte for byte with no luck. Calling "WizardryCapabilityProvider.get(playerIn);" always returns null anywhere and I try to call it, and yes, I DO register it and attach the capability in the attachCapability event. First off: This is my capability package in my project. https://github.com/TeamWizardry/Wizardry/tree/master/src/main/java/com/teamwizardry/wizardry/api/capability (Ignore the bloods package) Second: My registration and attachment of the capabilities to players: https://github.com/TeamWizardry/Wizardry/blob/master/src/main/java/com/teamwizardry/wizardry/init/ModCapabilities.java I want to make something clear here, the if statement `if (!e.getEntity().hasCapability(WizardryCapabilityProvider.wizardryCapability, null)) {` is passing successfully here. Third: My commonProxy registeration: https://github.com/TeamWizardry/Wizardry/blob/master/src/main/java/com/teamwizardry/wizardry/common/proxy/CommonProxy.java#L22 Fourth: Registration of the eventHandler that attaches the capabilities from the second point: https://github.com/TeamWizardry/Wizardry/blob/master/src/main/java/com/teamwizardry/wizardry/Wizardry.java#L106 And finally, fifth: The packet handler for the message. It is registered in commonProxy in the third point: https://github.com/TeamWizardry/Wizardry/tree/master/src/main/java/com/teamwizardry/wizardry/common/network I've had 5 of my (dev) friends check thoroughly over my code, all of them, including myself, failed to find an error as to why the capabilities always return null anywhere and everywhere. It's a simple null pointer. If anyone can find any error in the code, please tell me.
  22. My pitches and yaws are messed up. I have the pitch and yaw of the pad but the beam's pitch and yaw are messed up. How do i calculate the normal vector for the pad's pitch and yaw? I tried a crap load of math off of stackoverflow but they all failed so far. What I first tried was adding 90 to the pitch of the pad but the yaw stayed messed up: And this is what happens when I used to the pad's pitch and yaw as is to calculate the direction vector: What I tried doing next was split the beam's pitch and yaw from the pad's pitch and yaw and have them both separately calculated. That mostly worked but the yaw was still completely messed up. What I used to calculate the direction vector from yaw and pitch of the beams was a util minecraft uses to do so for mobs: [embed=425,349] public static Vec3d getVectorForRotation3d(float pitch, float yaw) { float f = MathHelper.cos(-yaw * 0.017453292F - (float) Math.PI); float f1 = MathHelper.sin(-yaw * 0.017453292F - (float) Math.PI); float f2 = -MathHelper.cos(-pitch * 0.017453292F); float f3 = MathHelper.sin(-pitch * 0.017453292F); return new Vec3d((double) (f1 * f2), (double) f3, (double) (f * f2)); }[/embed] the pitch and yaw are both calculated in the way the player head rotates. The pad's pitch and yaw are 100% correct when I use them on the pad itself but mess up when I use them on the beam. How do i calculate the normal vector or a vector that's perpendicular to the pad properly from the pitch and yaw of the pad?
  23. My pitches and yaws are messed up. I have the pitch and yaw of the pad but the beam's pitch and yaw are messed up. How do i calculate the normal vector for the pad's pitch and yaw? I tried a crap load of math off of stackoverflow but they all failed so far. What I first tried was adding 90 to the pitch of the pad but the yaw stayed messed up: And this is what happens when I used to the pad's pitch and yaw as is to calculate the direction vector: What I tried doing next was split the beam's pitch and yaw from the pad's pitch and yaw and have them both separately calculated. That mostly worked but the yaw was still completely messed up. What I used to calculate the direction vector from yaw and pitch of the beams was a util minecraft uses to do so for mobs: [embed=425,349] public static Vec3d getVectorForRotation3d(float pitch, float yaw) { float f = MathHelper.cos(-yaw * 0.017453292F - (float) Math.PI); float f1 = MathHelper.sin(-yaw * 0.017453292F - (float) Math.PI); float f2 = -MathHelper.cos(-pitch * 0.017453292F); float f3 = MathHelper.sin(-pitch * 0.017453292F); return new Vec3d((double) (f1 * f2), (double) f3, (double) (f * f2)); }[/embed] the pitch and yaw are both calculated in the way the player head rotates. The pad's pitch and yaw are 100% correct when I use them on the pad itself but mess up when I use them on the beam. How do i calculate the normal vector or a vector that's perpendicular to the pad properly from the pitch and yaw of the pad?

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.