Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ public static ItemStack getSrcWeapon(@NotNull Projectile e) {
return ((Trident) e).getItem();
}
if (!e.hasMetadata(PROJECTILE_SOURCE_WEAPON)) return null;

Object val = e.getMetadata(PROJECTILE_SOURCE_WEAPON).get(0).value();
var meta = e.getMetadata(PROJECTILE_SOURCE_WEAPON);
if (meta.isEmpty()) return null;
Object val = meta.get(0).value();
return (ItemStack) val;
}

Expand All @@ -38,8 +39,9 @@ public static void setPower(@NotNull Projectile e, double power) {

public static double getPower(@NotNull Projectile e) {
if (!e.hasMetadata(PROJECTILE_LAUNCH_POWER)) return 1D;

return e.getMetadata(PROJECTILE_LAUNCH_POWER).get(0).asDouble();
var meta = e.getMetadata(PROJECTILE_LAUNCH_POWER);
if (meta.isEmpty()) return 1D;
return meta.get(0).asDouble();
}

public static void setPickable(@NotNull Entity pp, boolean b) {
Expand All @@ -48,7 +50,8 @@ public static void setPickable(@NotNull Entity pp, boolean b) {

public static boolean isPickable(@NotNull Entity pp) {
if (!pp.hasMetadata(PROJECTILE_PICKABLE)) return true;

return pp.getMetadata(PROJECTILE_PICKABLE).get(0).asBoolean();
var meta = pp.getMetadata(PROJECTILE_PICKABLE);
if (meta.isEmpty()) return true;
return meta.get(0).asBoolean();
}
}
Loading