Skip to content

Commit

Permalink
Added Sonic Shock enchantment, fixed default config
Browse files Browse the repository at this point in the history
  • Loading branch information
brainiac94 committed Jul 7, 2017
1 parent 081c1a7 commit 36df770
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1712,6 +1712,39 @@ public boolean onBlockBreak(BlockBreakEvent evt, int level, boolean usedHand) {
}
}

public static class SonicShock extends CustomEnchantment {

public SonicShock() {
maxLevel = 3;
loreName = "Sonic Shock";
probability = 0;
enchantable = new Tool[]{WINGS};
conflicting = new Class[]{};
description = "Damages mobs when flying past at high speed";
cooldown = 0;
power = 1.0;
handUse = 0;
}

public int getEnchantmentId() {
return 56;
}

@Override
public boolean onFastScan(Player player, int level, boolean usedHand) {
if (player.isGliding() && player.getVelocity().length() >= 1) {
System.out.print(player.getVelocity().length());
for (Entity e : player.getNearbyEntities(2 + level, 3, 2 + level)) {
double damage = player.getVelocity().length() * 1.5 * level;
if (e instanceof LivingEntity) {
ADAPTER.attackEntity((LivingEntity) e, player, power * damage);
}
}
}
return true;
}
}

public static class Magnetism extends CustomEnchantment {

public Magnetism() {
Expand Down Expand Up @@ -3432,21 +3465,19 @@ public boolean onBlockInteract(PlayerInteractEvent evt, int level, boolean usedH
if (evt.getAction().equals(RIGHT_CLICK_BLOCK)) {
Block start = evt.getClickedBlock().getRelative(evt.getBlockFace());
List<Block> blocks = bfs(start);

Material[] mats = {STONE, GRASS, DIRT, COBBLESTONE, WOOD, SAND, GRAVEL,
GOLD_ORE, IRON_ORE, COAL_ORE, LOG, LEAVES, LAPIS_ORE, SANDSTONE,
DOUBLE_STEP, BRICK, TNT, BOOKSHELF, MOSSY_COBBLESTONE, ICE, SNOW_BLOCK,
CLAY, NETHERRACK, SOUL_SAND, SMOOTH_BRICK, HUGE_MUSHROOM_1, HUGE_MUSHROOM_2,
MYCEL, NETHER_BRICK, ENDER_STONE, WOOD_DOUBLE_STEP, EMERALD_ORE, QUARTZ_ORE,
QUARTZ_BLOCK, STAINED_CLAY, LEAVES_2, LOG_2, SLIME_BLOCK, PRISMARINE, HARD_CLAY,
PACKED_ICE, RED_SANDSTONE, DOUBLE_STONE_SLAB2};



Material mat = AIR;
byte bt = 0;
int c = -1;



for (int i = 0; i < 9; i++) {
if (evt.getPlayer().getInventory().getItem(i) != null) {
if (evt.getPlayer().getInventory().getItem(i).getType().isBlock() && ArrayUtils.contains(mats, evt.getPlayer().getInventory().getItem(i).getType())) {
Expand All @@ -3460,7 +3491,7 @@ public boolean onBlockInteract(PlayerInteractEvent evt, int level, boolean usedH
if (mat == HUGE_MUSHROOM_1 || mat == HUGE_MUSHROOM_2) {
bt = 14;
}

for (Block b : blocks) {
if (b.getType().equals(AIR)) {
if (Utilities.removeItemCheck(evt.getPlayer(), mat, bt, 1)) {
Expand Down
17 changes: 15 additions & 2 deletions Zenchantments/src/main/resources/defaultconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ZenchantmentsConfigVersion: 1.5.0
# Chance of obtaining the enchantment when enchanting

# Tools: (Axe, Shovel, Sword, Pickaxe, Rod, Shears, Bow, Lighter,
# Hoe, Helmet, Chestplate, Leggings, Boots, All)
# Hoe, Helmet, Chestplate, Leggings, Boots, Elytra, All)
# Determines what tools can recieve the enchantment

# Name: (For color use '§' instead of "&")
Expand Down Expand Up @@ -385,6 +385,13 @@ enchantments:
Max Level: 4
Cooldown: 0
Power: 1.0
- Sonic Shock:
Probability: 1.0
Tools: Elytra
Name: Sonic Shock
Max Level: 3
Cooldown: 0
Power: 1.0
- Spectral:
Probability: 1.0
Tools: Shovel
Expand Down Expand Up @@ -426,7 +433,13 @@ enchantments:
Name: Stock
Max Level: 1
Cooldown: 0
Power: 1.0
Power: 1.0ma
- Stream:
Probability: 1.0
Tools: Elytra
Max Level: 1
Name: Stream
Cooldown: 0
- Switch:
Probability: 1.0
Tools: Pickaxe
Expand Down

0 comments on commit 36df770

Please sign in to comment.