Resource [1.8] MoreProjectiles

Discussion in 'Plugin Help/Development/Requests' started by stirante, Sep 1, 2013.

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

    stirante

    Added runnables executed in onUpdate method mainly for cool particle trails.
     
  2. Offline

    Ultimate_n00b

    On behalf of Minecade, thanks for updating. I tried updating it myself, however it didn't work as well.. your version is far better. Good job.
     
    stirante likes this.
  3. Offline

    stirante

    Glad to help :) Tell me if you want any new features.
     
  4. Offline

    stirante

    Thanks to callunxz fixed a bug, where projectile flies through entity. If you are using Craftbukkit 1.7.2-R0.3 you should update the code.
     
    callunxz likes this.
  5. stirante Still doesn't work :p

    EDIT: Nevermind it works! Thanks!
     
  6. Offline

    Ultimate_n00b

    So I was using this, and I noticed that a lot of the time, item projectiles will just sit on the ground with no event called.

    [​IMG]
    EDIT: The event is actually called when an entity walks over it though.
     
  7. Offline

    stirante

    Ultimate_n00b I know about this issue and I tried to fix this by adding double check if entity is on the ground, but no luck :/ Also I added automatic despawn time.
     
  8. Offline

    MrMag518

    Happening to me too.

    I did some research and found out that this only happens when the mob is NOT in the water. In other words, it works fine if the hit mob is in water, not on ground.
     
  9. Offline

    Ultimate_n00b

    I actually added a check on ground and it works quite well:

    Code:java
    1. int groundTimes = 0;
    2. [...]
    3.  
    4. if (this.onGround) {
    5. f = 0.5880001F;
    6. Block i = this.world.getType(MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ));
    7.  
    8. if (i != null) {
    9. f = i.frictionFactor * 0.98F;
    10. }
    11. if(this.groundTimes++ >= 3) {
    12. CustomProjectileHitEvent event = new ItemProjectileHitEvent(this, getBukkitEntity().getLocation().getBlock().getRelative(BlockFace.DOWN), BlockFace.UP, getItem());
    13. Bukkit.getPluginManager().callEvent(event);
    14. if (!event.isCancelled()) {
    15. if (CraftItemStack.asCraftMirror(getItemStack()).getType().isBlock()) Particles.displayBlockCrack(getBukkitEntity().getLocation(), Item.b(getItemStack().getItem()), (byte) 0, 0F, 0F, 0F, 1F, 20);
    16. else Particles.displayIconCrack(getBukkitEntity().getLocation(), Item.b(getItemStack().getItem()), 0F, 0F, 0F, 0.1F, 20);
    17. die();
    18. }
    19. }
    20. }


    Not perfect, but working I suppose.
     
  10. Offline

    stirante

    Ultimate_n00b This is already there:
    Code:java
    1.  
    2.  
    3. else if (this.onGround) {
    4. CustomProjectileHitEvent event = new ItemProjectileHitEvent(this, getBukkitEntity().getLocation().getBlock().getRelative(BlockFace.DOWN), BlockFace.UP, getItem());
    5. Bukkit.getPluginManager().callEvent(event);
    6. if (!event.isCancelled()) {
    7. if (CraftItemStack.asCraftMirror(getItemStack()).getType().isBlock()) Particles.displayBlockCrack(getBukkitEntity().getLocation(), Item.b(getItemStack().getItem()), (byte) 0, 0F, 0F, 0F, 1F, 20);
    8. else Particles.displayIconCrack(getBukkitEntity().getLocation(), Item.b(getItemStack().getItem()), 0F, 0F, 0F, 0.1F, 20);
    9. die();
    10. }
    11. }

    MrMag518 Try the newest version. I fixed it.

    EDIT: Found the problem, fixing it right now.

    EDIT2: I think it's fixed :D
    Btw. What you think about not killing projectile when it hits blocks like water, grass, flowers ?
     
  11. Offline

    MrMag518

    Awesome! And that sounds good, but I would make it optional :p
     
  12. Offline

    stirante

    Added option to disable iteraction with water, crops and block like that.
     
  13. Offline

    Ultimate_n00b

    stirante changes look good. Quick question though, currently the hit event is not called if it hits the top part of a player/mob. Not sure if it's just me. Using latest code.
     
  14. Offline

    stirante

    Ultimate_n00b I used default bounding box size for every projectile. I'll add option to change size of it.
     
  15. Should work now, if you update all your code from the lib to the latest version.
     
  16. Offline

    Ultimate_n00b

    Code:
    java.lang.NullPointerException: Unexpected error
        at ani.q(SourceFile:139)
        at bmt.getTileEntityBoundingBox(RenderGlobal.java:3349)
        at bmt.a(RenderGlobal.java:745)
        at bmm.a(EntityRenderer.java:1534)
        at bmm.b(EntityRenderer.java:1294)
        at azi.ah(SourceFile:787)
        at azi.f(SourceFile:711)
        at net.minecraft.client.main.Main.main(SourceFile:152)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
        at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
    MC crashes with that error sometimes. Is it due to this?
     
  17. Offline

    stirante

    I'll look info it when i got home. School :p

    It's not my lib. ani class is TileEntity and q method returns Block at TileEntity coordinates. NPE is possible only when World object is null in TileEntity. Ofc i assume that you are using 1.7.4 version.

    Btw if you want any help with your plugins I can help :) I just like helping even when i don't have time for that xD

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  18. Offline

    Ultimate_n00b

    Nah, all my plugins are pretty tightly shut from developers outside Minecade. Thanks for offering though.
     
  19. Offline

    stirante

    Ultimate_n00b Btw what are you doing for Minecade with MoreProjectiles?
     
  20. Offline

    Ultimate_n00b

    We used to use a item throwing code that worked fine, however 1.7 broke it. As my fix didn't really.. fix it, I decided to use some code from here. I am mainly using it on a set of new minigames now.
     
  21. Offline

    stirante

    Added getBoundingBoxSize method which returns Vector of x, y and z size of bounding box used to detect entity collision. Also made collisions more precise.
     
  22. Offline

    Prelude_by_Ice

    Hello stirante, i would use our code but i get a failure
    Code:
    [00:20:01 ERROR]: Error occurred while enabling aaa v0.0.1 (Is it up to
    date?)
    java.lang.NoClassDefFoundError: com/stirante/MoreProjectiles/TypedRunnable
            at aaa.onEnable(aaa.java:9) ~[
    ?:?]
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:250) ~[c
    raftbukkit.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader
    .java:350) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage
    r.java:389) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
            at org.bukkit.craftbukkit.v1_7_R1.CraftServer.loadPlugin(CraftServer.jav
    a:439) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
            at org.bukkit.craftbukkit.v1_7_R1.CraftServer.enablePlugins(CraftServer.
    java:375) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
            at net.minecraft.server.v1_7_R1.MinecraftServer.m(MinecraftServer.java:3
    42) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
            at net.minecraft.server.v1_7_R1.MinecraftServer.g(MinecraftServer.java:3
    19) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
            at net.minecraft.server.v1_7_R1.MinecraftServer.a(MinecraftServer.java:2
    75) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
            at net.minecraft.server.v1_7_R1.DedicatedServer.init(DedicatedServer.jav
    a:175) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
            at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java
    :424) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
            at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:6
    17) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
    Caused by: java.lang.ClassNotFoundException: com.stirante.MoreProjectiles.TypedR
    unnable
            at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.7.0_45]
            at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.7.0_45]
            at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_
    45]
            at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.7.0_45]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:77) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:62) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_45]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_45]
            ... 12 more
    I have no idia what i can do.

    Sorry for my bad english. Its not my favorit language. xD
     
  23. Offline

    stirante

    Prelude_by_Ice It seems that you don't have TypedRunnable class in your project.
     
  24. Offline

    Prelude_by_Ice

    I tried too link your .jar packet in to my projekt and this dosn´t work for me.
    Now i have copy your source and its work like a charm. realy nice work. And the Particles lib is so great too.

    One Question more i have. Is it possible to make a bouncing projectile like a ball or something?
     
  25. Offline

    stirante

    Prelude_by_Ice Particles lib is not mine. It's made by DarkBladee12 and it's awesome :D
    For bouncing projectiles try to cancel hit event and add y velocity.
     
  26. Offline

    BungeeTheCookie

    stirante
    I decided to bump this thread because it's pretty awesome. It deserves to be available to the public.
     
    stirante and MisterErwin like this.
  27. Offline

    stirante

    Updated to 1.7.5
     
  28. Offline

    BungeeTheCookie

    stirante
    Could you give us a 1.6.4 version? I need it because I am making a backend 1.6.4 server that allows 1.7.2 clients to connect.
     
  29. Offline

    stirante

  30. Offline

    coco5843

    Oh I have found that [sorry i'm bad to speak english xD]
    Code:
    CustomProjectile projectile = new ItemProjectile ("nom", p ,new ItemStack(Material.FIREWORK_CHARGE) , 1.0F);
    
    for :
    bobacadodl said:
    Add the ability to set the name of the projectile in the constructor, then get its name onProjectileHit! :)

    So that you can differentiate between projectiles
    Code:
     @EventHandler
       public void onHit(CustomProjectileHitEvent e){
        World w = e.getProjectile().getEntity().getWorld();
                        Location l = e.getProjectile().getEntity().getLocation();
       if (e.getHitType() == CustomProjectileHitEvent.HitType.ENTITY || e.getHitType() == CustomProjectileHitEvent.HitType.BLOCK) {
      if (e.getProjectile().getProjectileName() == "nom") {
               w.strikeLightning(l);
    }
    }
    }
    
     
Thread Status:
Not open for further replies.

Share This Page