use of net.glowstone.dispenser.ProjectileDispenseBehavior in project Glowstone by GlowstoneMC.
the class GlowDispenser method register.
/**
* Registers all vanilla dispense behaviors.
*/
public static void register() {
// register all dispense behaviors
DefaultDispenseBehavior bucketDispenseBehavior = new BucketDispenseBehavior();
DispenseBehaviorRegistry registry = getDispenseBehaviorRegistry();
registry.putBehavior(Material.WATER_BUCKET, bucketDispenseBehavior);
registry.putBehavior(Material.LAVA_BUCKET, bucketDispenseBehavior);
registry.putBehavior(Material.BUCKET, new EmptyBucketDispenseBehavior());
registry.putBehavior(Material.FLINT_AND_STEEL, new FlintAndSteelDispenseBehavior());
registry.putBehavior(Material.TNT, new TntDispenseBehavior());
ArmorDispenseBehavior armorDispenseBehavior = new ArmorDispenseBehavior();
registry.putBehavior(Material.LEATHER_BOOTS, armorDispenseBehavior);
registry.putBehavior(Material.LEATHER_LEGGINGS, armorDispenseBehavior);
registry.putBehavior(Material.LEATHER_CHESTPLATE, armorDispenseBehavior);
registry.putBehavior(Material.LEATHER_HELMET, armorDispenseBehavior);
registry.putBehavior(Material.GOLDEN_BOOTS, armorDispenseBehavior);
registry.putBehavior(Material.GOLDEN_LEGGINGS, armorDispenseBehavior);
registry.putBehavior(Material.GOLDEN_CHESTPLATE, armorDispenseBehavior);
registry.putBehavior(Material.GOLDEN_HELMET, armorDispenseBehavior);
registry.putBehavior(Material.IRON_BOOTS, armorDispenseBehavior);
registry.putBehavior(Material.IRON_LEGGINGS, armorDispenseBehavior);
registry.putBehavior(Material.IRON_CHESTPLATE, armorDispenseBehavior);
registry.putBehavior(Material.IRON_HELMET, armorDispenseBehavior);
registry.putBehavior(Material.CHAINMAIL_BOOTS, armorDispenseBehavior);
registry.putBehavior(Material.CHAINMAIL_LEGGINGS, armorDispenseBehavior);
registry.putBehavior(Material.CHAINMAIL_CHESTPLATE, armorDispenseBehavior);
registry.putBehavior(Material.CHAINMAIL_HELMET, armorDispenseBehavior);
registry.putBehavior(Material.DIAMOND_BOOTS, armorDispenseBehavior);
registry.putBehavior(Material.DIAMOND_LEGGINGS, armorDispenseBehavior);
registry.putBehavior(Material.DIAMOND_CHESTPLATE, armorDispenseBehavior);
registry.putBehavior(Material.DIAMOND_HELMET, armorDispenseBehavior);
for (Material headType : MaterialTags.SKULLS.getValues()) {
registry.putBehavior(headType, armorDispenseBehavior);
}
registry.putBehavior(Material.PUMPKIN, armorDispenseBehavior);
registry.putBehavior(Material.EGG, new ProjectileDispenseBehavior(GlowEgg::new));
registry.putBehavior(Material.SNOWBALL, new ProjectileDispenseBehavior(GlowSnowball::new));
registry.putBehavior(Material.ARROW, new ProjectileDispenseBehavior(GlowArrow::new));
registry.putBehavior(Material.EXPERIENCE_BOTTLE, new ProjectileDispenseBehavior(GlowThrownExpBottle::new));
registry.putBehavior(Material.SPECTRAL_ARROW, new ProjectileDispenseBehavior(GlowSpectralArrow::new));
registry.putBehavior(Material.TIPPED_ARROW, new ProjectileDispenseBehavior(((location, itemStack) -> {
GlowTippedArrow tippedArrow = new GlowTippedArrow(location);
tippedArrow.copyFrom((PotionMeta) itemStack.getItemMeta());
return tippedArrow;
})));
registry.putBehavior(Material.FIRE_CHARGE, new ProjectileDispenseBehavior(location -> {
Fireball fireball = new GlowFireball(location);
fireball.setYield(0);
fireball.setIsIncendiary(true);
return fireball;
}));
registry.putBehavior(Material.SPLASH_POTION, new ProjectileDispenseBehavior((location, itemStack) -> {
SplashPotion potion = new GlowSplashPotion(location);
potion.setItem(itemStack);
return potion;
}));
registry.putBehavior(Material.LINGERING_POTION, new ProjectileDispenseBehavior((location, itemStack) -> {
SplashPotion potion = new GlowLingeringPotion(location);
potion.setItem(itemStack);
return potion;
}));
// TODO: Firework rockets
}
Aggregations