Fixed bug with MetalClips and misc errors. (#869)

## Errors and bugs corrected
* A `ClassCastException` in `PKListener.java:onEntityDamageEvent()` would occur when a non-Living Entity took damage.
* Ingots on the ground would disappear when their `ItemStack` merged with MetalClips', and the latter is removed upon colliding with an Entity.

## Improvements made
* A small vertical push was given to items affected by the *magnetize* functionality of MetalClips, so that they no longer get stuck when being pulled upwards.

## Other changes
* Added a `gitignore` entry to omit IntelliJ's out/ directory, which contains compiled code.
This commit is contained in:
Carbogen 2017-12-19 19:08:31 -05:00 committed by Christopher Martin
parent 102112ffdd
commit 08165edeb1
3 changed files with 9 additions and 4 deletions

1
.gitignore vendored
View file

@ -237,4 +237,5 @@ target/
.idea/ .idea/
classes/ classes/
out/
projectkorra.iml projectkorra.iml

View file

@ -470,7 +470,7 @@ public class PKListener implements Listener {
FireDamageTimer.dealFlameDamage(entity); FireDamageTimer.dealFlameDamage(entity);
} }
if (TempArmor.hasTempArmor((LivingEntity)entity)) { if (entity instanceof LivingEntity && TempArmor.hasTempArmor((LivingEntity)entity)) {
event.setDamage(DamageModifier.ARMOR, 0); event.setDamage(DamageModifier.ARMOR, 0);
} }

View file

@ -339,7 +339,7 @@ public class MetalClips extends MetalAbility {
Item iron = (Item) entity; Item iron = (Item) entity;
if (Arrays.asList(METAL_ITEMS).contains(iron.getItemStack().getType())) { if (Arrays.asList(METAL_ITEMS).contains(iron.getItemStack().getType())) {
iron.setVelocity(vector.normalize().multiply(magnetPower)); iron.setVelocity(vector.normalize().multiply(magnetPower).add(new Vector(0, 0.2, 0)));
} }
} }
} }
@ -435,7 +435,7 @@ public class MetalClips extends MetalAbility {
} }
} else { } else {
DamageHandler.damageEntity(e, player, damage, this); DamageHandler.damageEntity(e, player, damage, this);
dropIngots(e.getLocation()); dropIngots(e.getLocation(), ii.getItemStack().getAmount());
remove(); remove();
} }
@ -450,7 +450,11 @@ public class MetalClips extends MetalAbility {
} }
public void dropIngots(Location loc) { public void dropIngots(Location loc) {
Item i = player.getWorld().dropItem(loc, new ItemStack(Material.IRON_INGOT, metalClipsCount == 0 ? 1 : metalClipsCount)); dropIngots(loc, metalClipsCount == 0 ? 1 : metalClipsCount);
}
public void dropIngots(Location loc, int amount) {
Item i = player.getWorld().dropItem(loc, new ItemStack(Material.IRON_INGOT, amount));
i.setPickupDelay(61); i.setPickupDelay(61);
} }