Minecraft Mods

ParticleProjectileApi

  • 2,994 views, 2 today
  • 63 downloads, 0 today
  • 3
  • 1
  • 2
coltonj96's Avatar coltonj96
Level 39 : Artisan Unicorn
16
Description
This API is designed to allow plugin developers to easily add customized particle projectiles, hence the name. ParticleProjectileApi comes with its own event classes giving the developer a way to cancel an effect when a particle hits, this is quite useful in say mini-games to prevent friendly-fire. It is completely possible to create multiple projectile classes and is encouraged too. When extending the ParticleProjectile class, the developer will be met with five methods: OnHit, OnHitBlock, and OnHitEntity, OnPenetrateBlock, OnPenetrateEntity. These methods allow for adding code to run when a projectile hits or passes through something.
Features
  • method to launch colored particles (No packets used)
  • Custom events that can be canceled
  • Create multiple projectile classes for different effects
  • More to come!

Usage
MyProjectile.class

package com.aim.coltonjgriswold.projectiles;

import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Damageable;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;

import com.aim.coltonjgriswold.api.ParticleProjectile;

public class MyProjectile extends ParticleProjectile {

public MyProjectile() {
super(ParticleColor.fromRGB(255, 0, 0), 7.5, 20.0 , 128.0);
//Initialize a projectile with a color of red, Mass of 7.5 grams, speed of 20.0 meters/second, max distance of 128 meters
}

@Override
public void OnHit(Player who, Location where) {
//Do something when reach max distance
}

@Override
public void OnHitBlock(Player who, Location where, Block what) {
//Do something when hit block
}

@Override
public void OnHitEntity(Player who, Location where, Entity what) {
//Do something when hit entity
}

@Override
public void OnPenetrateBlock(Player who, Location where, Block what) {
//Do something when passing through a block
}

@Override
public void OnPenetrateEntity(Player who, Location where, Entity what) {
//Do something when passing through an entity
}
}
MyPlugin.class

package com.aim.coltonjgriswold;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;

import com.aim.coltonjgriswold.api.utilities.ParticleColor;
import com.aim.coltonjgriswold.projectiles.MyProjectile;

public class MyPlugin extends JavaPlugin implements Listener {

MyProjectile projectile;

public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
projectile = new MyProjectile();
}

public void onDisable() {

}

@EventHandler
public void oninteract(PlayerInteractEvent event) {
Material item = event.getPlayer().getInventory().getItemInMainHand().getType();
if (item == Material.STICK) {
//launch MyProjectile with physics turned on
projectile.launch(event.getPlayer(), true);
}
}
}


Javadocs
Javadocs: ParticleProjectileApi Documentation
Progress100% complete
Game VersionMinecraft 1.13
Tags

Create an account or sign in to comment.

1
10/28/2017 12:14 am
Level 4 : Apprentice Hunter
crazy1gamer2000
crazy1gamer2000's Avatar
cool man dis mod is okay!
1
10/28/2017 8:47 am
Level 39 : Artisan Unicorn
coltonj96
coltonj96's Avatar
<3
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome