Solved Fixing Squid Suffocation Damage

Discussion in 'Plugin Development' started by DSH105, Apr 6, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    DSH105

    I know that this sounds a simple task, which it may be because I have simply missed how to do it, but I have not been able to successfully stop a squid from suffocating on land. I have tried listening in to all of the EntityDamage Events, but to no avail. Even cancelling the event without sending any statements for confirming if the entity in question is a squid did not work.

    So, my question is this: How does one stop a squid from suffocating on land?

    Enlighten me and make me feel incompetent for missing it :p

    Adios!
     
  2. Offline

    DSH105

    *Shameful Bump*

    It appears this may not be as easy as it looks.

    Last bump on this thread before I let it go. If anyone has any idea on how this might work, please say.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  3. Offline

    Jamie Marks

    CAn you not print a debug message when a squid takes daamge to find out that cause then cancel it?
     
  4. Offline

    CreeperShift

    _DSH105_
    Post the complete code, maybe you just did some stupid small error and it's actually working ;)
     
  5. Offline

    L33m4n123

    MAybe check for the event EntityDamageEvent (or something like that) then check if that entity is a squid. Not sure though if that will even work in that direction
     
  6. Offline

    CreeperShift

    You sir, win the award for stupidest human alive. Now read his first post and cry in shame.
     
    _DSH105_ likes this.
  7. Offline

    DSH105

    CreeperShift L33m4n123
    It's not a small error. I am 100% sure of that. I completely cancelled the EntityDamageEvent and logged messages to the console and here's what happened:

    I got the messages in the console and all other mobs were not damaged. Squids still suffocated.
     
  8. Offline

    CreeperShift

    Just tried it out myself this very minute. They are completely invincible to any kind of damage except suffocating :O weird!
     
  9. Offline

    DSH105

    Yus! Exactly my issue. And I can't think of anything else to solve it :\
     
  10. Offline

    L33m4n123

    OOps :'(
     
  11. Offline

    CreeperShift

    _DSH105_
    https://bukkit.atlassian.net/browse/BUKKIT-3684
    seems like it's already reported and no one cares.

    _DSH105_
    I know this is a really stupid idea, but:

    Code:
           
    @EventHandler
            public void entityspawn(CreatureSpawnEvent event){
               
                LivingEntity squid = event.getEntity();
                if (squid instanceof Squid){
                squid.setMaximumAir(999999999);
                squid.setRemainingAir(999999999);
                }
            }
    At 20TPS they would be able to survive 578 days on the surface.

    The ones I'm currently looking at have been for several minutes already :p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  12. Offline

    DSH105

    Hehe. If it works, that's all that matters for now :p
     
  13. Offline

    CreeperShift

    You'd have to make sure they actually do last long enough as I've only tested a couple of minutes :p
     
  14. Offline

    DSH105

    The test subjects shall be observed :p
     
    CreeperShift likes this.
  15. Offline

    danmann

    I've been having the same issue with dieing squids. Apparently squids don't trigger an EntityDamageEvent when they suffocate but they do trigger an EntityDeathEvent when they die. Unfortunately you can't cancel the EntityDeathEvent but perhaps you could just spawn in a new squid at the same location.
    On second thought I like CreeperShift's idea. Keeping the squids filled with air sounds good. If you are afraid of them running out of breath you can just scheduleSyncRepeatingTask and set the air to max every few seconds, minutes, etc.
     
  16. Offline

    CreeperShift

    You'd have to basically do it every half a year :p
     
  17. Offline

    CreeperShift

    _DSH105_

    Not sure if you still care, but the recent version of CB fixed this bug :)
     
  18. Offline

    DSH105

Thread Status:
Not open for further replies.

Share This Page