Everything posted by Himself12794
-
Get extact MovingObjectPoition from the Player
Try this. I pulled it from one of Jabelar's turorials, who pulled it from Minecraft's mouse over code:
-
Get extact MovingObjectPoition from the Player
I had to do something similar with my PowersAPI mod. This website has a good method for getting the MovingObjectPosition client side. (At any distance as well!) http://jabelarminecraft.blogspot.com/p/minecraft-modding-extending-reach-of.html Of course, this is only client side, so you'll have to send the position over in a message to the server.
-
[1.8] Gravity and transformers
Perhaps it's not as complicated as you might think. Have you taken note of IExtendedEntityProperties ? I just learned about that recently. Very helpful for modifying existing entity classes. You should take a look into that and see if it fits your needs.
-
[1.8] [SOLVED] Server and Client alternating between ticks
Oh hell yes. I now love the IEEP interface. It makes all of my intricate and complicated code unnecessary. Thanks a lot! Any time I can remove that much code from my project and still have it work the same, even better, is always awesome.
-
[1.8] [SOLVED] Server and Client alternating between ticks
That bad, huh? When I realized what was happening, I knew I must have been doing something horrific. The inability run things on the netty thread really answers a lot of things for me. Also, I actually did learn about IExtendedEntityProperties, but they don't appear to persist on death, so that's why I have not been using them. Athough the revelation of SimpleImpl use should allow me to now synchronize that information correctly with that interface. On a not completely unrelated note, is there a way to receive a response from message back onto the stack from where it was sent? For me to do that, I've been doing something that I can't help but think is a terrible travesty. I've never stopped looking for a better way, but for me this is all I've been able to come up with. I send a message to the server here: https://github.com/Himself12794/powersAPI/blob/develop/src/main/java/com/himself12794/powersapi/power/PowerInstant.java#L35 And require feedback here: https://github.com/Himself12794/powersAPI/blob/develop/src/main/java/com/himself12794/powersapi/power/PowerInstant.java#L42 To try to send a message I handle this way: https://github.com/Himself12794/powersAPI/blob/develop/src/main/java/com/himself12794/powersapi/network/CastPowerInstantServer.java And then try to not think about what I've just done. Running my responses as a Runnable task will break that little process, I imagine. Is there a simple way to do that, or do I need to restructure my entire way of casting powers?
-
[1.8] [SOLVED] Server and Client alternating between ticks
So, I'm making a powers mod, adding timers to the player for cooldowns, power effects, use times, etc. I found that on death, many of these stats I will want to perserve, such as learned powers. The only problem is that when I copy the data over on a PlayerEvent.CloneEvent, and send the refreshed data back to the client, my message to synchronize arrives before the client receives notice of the clone event, which means my data quickly gets reset. To avoid having to constantly send synchronizing data to the client, I tried to make a central data center that holds this extra NBT data for both sides. My problem is that is works too well, and both sides are sharing the same object, making both sides use the same cooldowns. I tried separating them, but it seems impossible. On integrated server, it's always the client data center that exists, and on dedicated server, it's using the server side one. Either way, it's weird and undesirable. Is there a way I can fix this, or at least get around it? Here's the DataWrapper I made that has the extra data: https://github.com/Himself12794/powersAPI/blob/develop/src/main/java/com/himself12794/powersapi/util/DataWrapper.java Here's my data center: https://github.com/Himself12794/powersAPI/blob/develop/src/main/java/com/himself12794/powersapi/util/DataHandler.java And my proxies: https://github.com/Himself12794/powersAPI/tree/develop/src/main/java/com/himself12794/powersapi/proxy Any advice or help is appreciated, thanks in advance!
-
[1.8] [SOLVED] Explosion Particles Don't show
Perhaps I was overthinking it. Adding this: https://github.com/Himself12794/Heroes-Mod/blob/additional-powers/src/main/java/com/himself12794/heroesmod/network/SpawnParticlesClient.java Seems to have fixed it. The other things I'd done should have fixed it as well, but I guess I can't be picky since it's working.
-
[1.8] [SOLVED] Explosion Particles Don't show
I know, but my problem is getting that to happen. It was my understanding that calling it this way IS spawning them on the client.
-
[1.8] [SOLVED] Explosion Particles Don't show
In my code I'm writing, I'm making a power effect triggered by LivingUpdateEvent, as seen here: https://github.com/Himself12794/powersAPI/blob/develop/src/main/java/com/himself12794/powersapi/event/UpdatesHandler.java and here: https://github.com/Himself12794/powersAPI/blob/develop/src/main/java/com/himself12794/powersapi/util/DataWrapper.java#L226 The only problem is that when I try to make my power effect use explosion particles, it doesn't display, neither on integrated server or dedicated server. Using this: https://github.com/Himself12794/powersAPI/blob/develop/src/main/java/com/himself12794/powersapi/network/PowerEffectsClient.java Makes it work on the integrated server, but I can't seem to get it to work on the integrated server. I'm trying to call the effect from this class: https://github.com/Himself12794/Heroes-Mod/blob/master/src/main/java/com/himself12794/heroesmod/powerfx/Slam.java I'm know it's some sort of networking issue, but because I still have a vague understanding of the difference between server side, client side, integrated server and dedicated server I'm unsure of the solution. Any help I can get is appreciated. Thanks! P.S. As a side note, player NBT data doesn't seem like it's being saved on world exit. Likely related to the above issue, I'm sure.
-
[SOLVED] Preventing 1st-person item change animation?
I'm curious if this will also remove the bobbing animation that happens when you modify the NBT tags of an item stack that is in use. I had that problem awhile back, but decided the information I needed stored was better tied to the entity instead of the stack. Still, I must test this.
-
[SOLVED] Having Trouble Adding API to Eclipse Workspace
It seems that using "gradle jar" instead of "gradle build" gives me the correct version.
-
[SOLVED] Having Trouble Adding API to Eclipse Workspace
I did not. How would I do that?
-
[SOLVED] Having Trouble Adding API to Eclipse Workspace
I'm trying to make an API that I can use in various other modding projects, but when I try to add it to my workspace and compile, I get this error: I'm pretty sure I have an idea of what is happening, to a certain extent, but I don't know how to prevent. I believe it's running the compiled code, not before adding it to the mods. I followed the adding an external API forge guide, but I still get this error. It must be I am compiling it incorrectly, or setting up the API incorrectly. Anyone have advice on how to fix this? The mod I'm attempting to use as an API is here: https://github.com/Himself12794/Powers-API And the mod I'm trying to run using this API is here: https://github.com/Himself12794/Heroes-Mod
-
[1.7.10] When running on dedicated server I get no such method error
Since they are not actually players, have you tried just using World.getEntityById()? Every time an entity is created, it is assigned an id that stays the same until it dies. You might could use that. Instead of saving the UUID, you can just save the regular ID. I'm not sure if entity IDs persist over world saves, though. I never really tested that. Edit: Looking at the code, I don't think they are saved. So, logging out and logging back in would reload all entities with new IDs. If you want them to be remembered over world saves, just keep using what you were.
-
[1.7.10] When running on dedicated server I get no such method error
It seems just the accessor method is client only. Have you tried using World.loadedEntityList directly? i.e.: public static Entity getMob(World world, EntityPlayer player) { PlayerParty ppp = PlayerParty.get(player); for (Object object : world.loadedEntityList) { if (object instanceof EntityPartyMember) { EntityPartyMember entity = (EntityPartyMember) object; long uuidMost = ppp.getEntityPartyMemberNBTFromSlot(ppp.getSpawnedSlot()).getLong("UUIDMost"); long uuidLeast =ppp.getEntityPartyMemberNBTFromSlot(ppp.getSpawnedSlot()).getLong("UUIDLeast"); if (entity.getUniqueID().getMostSignificantBits() == uuidMost && entity.getUniqueID().getLeastSignificantBits() == uuidLeast) { return entity; } } } System.out.println("DID NOT FIND ENTITY: Entity is Null"); return null; That may work, I'm not 100% sure if loadedEntityList is set to public in 1.7.10
-
[1.7.10] When running on dedicated server I get no such method error
That function will still work for that. It is not limited to the client entity player, it searches through every single instance of an EntityPlayer in the world, by using the list World.playerEntities. This means that if you are on a server, it checks every single player that is currently logged into that world, and returns them if they match the UUID. Edit: I just noticed you said that the function does not exist in 1.7.10. Does the field World.entityPlayers exist?
-
[1.7.10] When running on dedicated server I get no such method error
Oh, if that's what you're doing, the function already exists. Use World.getPlayerEntityByUUID(); It's not restricted to either side. That way, you don't have to loop through all the entities.
-
[1.7.10] [SOLVED] Call onItemRightClick of another Item.class
I do know that the blocking animation is determined by Item.getUseAction(), and doesn't have anything to do with Item.onItemRightClick(). Perhaps it has something to do with that?
-
[1.7.10] When running on dedicated server I get no such method error
World#getLoadedEntityList() is for client side only, and you're trying to call it on server side. I'm not the best person with determining Sided things, but I do know that client only means it cannot be run on a dedicated server. You should use your proxy to make sure that it is the client side, and not the server. I've had to do that with several things.
-
[1.8] [SOLVED] Invalid Packet string size error
I just noticed that as well. Shrunk it and it worked. Thanks!
-
[1.8] [SOLVED] Invalid Packet string size error
I'm trying to send information to the server about location information from casting a spell client side. I'm getting the entity the player is looking at, casting the spell on that target, then telling the server to do the same. The only problem is that when the server (dedicated) receives the packet, I get a String exceeds maximum string size 22 > 20. However I am not sending any Strings. Here's my packet handler and message code on github: https://github.com/Himself12794/powersAPI/blob/master/src/main/java/com/himself12794/powersapi/network/CastSpellInstantServer.java and here's the SpellInstant class: https://github.com/Himself12794/powersAPI/blob/master/src/main/java/com/himself12794/powersapi/spell/SpellInstant.java I only get this error on a dedicated server, otherwise it works as it should. Perhaps I'm sending the packet incorrectly?
-
[1.8] [SOLVED] LivingDeathEvent not canceling
I tried that, and it did not work. I tried set the hp to max as well, but that did not work either. Edit: Although looking back, EntityLivingBase#heal() only works if the health is above 0.0. So I'd assume using setHealth() instead would work.
-
[1.8] [SOLVED] LivingDeathEvent not canceling
I suppose that's an acceptable compromise, since it still has the same effect. Thanks!
-
[1.8] [SOLVED] LivingDeathEvent not canceling
For my spells mod, I'm making spells effects which are similar to Potion effects, but also remember the person who cast them. I'm trying to make an immortality spell, but I can't get the death event to be canceled. I'm setting it canceled and it is confirming that it is canceled, but the player still dies. Here's my code: @SubscribeEvent public void preventDeath(LivingDeathEvent event) { System.out.println(SpellEffect.getActiveEffects(event.entityLiving)); //if (SpellEffects.hasEffect(event.entityLiving, SpellEffects.spontaneousRegeneration.getId())) { // System.out.println("death event by " + event.source.toString()); // System.out.println("You're immortal, so you're good"); System.out.println("Was the event canceled?: " + event.isCanceled()); if (event.isCancelable()) event.setCanceled(true); //} } My code for the spell effect handler is here: public void spellEffectsHandler(LivingUpdateEvent event) { EntityLivingBase target = event.entityLiving; NBTTagCompound activeEffects = SpellEffect.getActiveEffects(target); if (activeEffects != null) { Object[] activeEffectKeys = activeEffects.getKeySet().toArray(); //PowersAPI.print(activeEffects); for (Object i : activeEffectKeys ) { int id = Integer.parseInt((String)i); int timeRemaining = activeEffects.getIntArray((String) i)[0]; EntityLivingBase caster = (EntityLivingBase) target.worldObj.getEntityByID(activeEffects.getIntArray((String) i)[1]); SpellEffect spfx = SpellEffect.getEffectById(id); //UsefulThings.print(spfx); if (spfx != null) { //UsefulThings.print(spfx); if (timeRemaining > 0) { spfx.onUpdate(target, timeRemaining, caster); spfx.addTo(target, --timeRemaining, caster); } else if (timeRemaining == 0) spfx.clearFrom(target); else if (timeRemaining < 0) spfx.onUpdate(target, timeRemaining, caster); } } } } The events are registered correctly, and strategic print statements confirms this registration. Even though the event is claiming it is canceled, entities are still dying. Perhaps my code is conflicting with itself and that causes this? The rest of my code is at https://github.com/Himself12794/powersAPI
-
[1.8] [SOLVED] Spawning Particle Trail Along a Vector
That would work, but I've been trying to keep the code tied to the entity spell, and not to the player, so perhaps I could fire the spells without there necessarily being a caster. I found a code that works for me, taking into account your and coolAlias'scode. I posted it at the end, if you're interested.
IPS spam blocked by CleanTalk.