-
-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to catch entities with fishing #301
Conversation
Location location = event.getHook().getLocation(); | ||
Entity entity = loot.getEntity().spawnEntity(plugin, event.getHook().getLocation()); | ||
|
||
LootDropEvent dropEvent = new LootDropEvent(player, plugin.getUser(player).toApi(), entity, event.getHook().getLocation(), cause); | ||
Bukkit.getPluginManager().callEvent(dropEvent); | ||
|
||
if (dropEvent.isCancelled()) { | ||
loot.getEntity().removeEntity(entity); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be dumb if the event is canceled since the entity will spawn and will be removed immediately. Sadly I don't know any other way without using NMS.
bukkit/src/main/java/dev/aurelium/auraskills/bukkit/loot/entity/EntityProperties.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial formatting review, will need to test in game personally later.
...src/main/java/dev/aurelium/auraskills/bukkit/hooks/mythicmobs/loot/MythicEntitySupplier.java
Show resolved
Hide resolved
return new EntityProperties( | ||
id.length > 1 ? id[1] : id[0], | ||
config.node("name").getString(), | ||
config.node("level").empty() ? null :config.node("level").getInt(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure space after colon
bukkit/src/main/java/dev/aurelium/auraskills/bukkit/loot/entity/EntitySupplier.java
Show resolved
Hide resolved
bukkit/src/main/java/dev/aurelium/auraskills/bukkit/loot/entity/EntitySupplier.java
Show resolved
Hide resolved
bukkit/src/main/java/dev/aurelium/auraskills/bukkit/loot/entity/VanillaEntityParser.java
Show resolved
Hide resolved
itemEntity.setItemStack(new ItemStack(Material.AIR)); | ||
|
||
Float hVelocity = loot.getEntity().getEntityProperties().horizontalVelocity(); | ||
if(hVelocity == null) hVelocity = 1.2f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after if
bukkit/src/main/java/dev/aurelium/auraskills/bukkit/loot/parser/EntityLootParser.java
Show resolved
Hide resolved
bukkit/src/main/java/dev/aurelium/auraskills/bukkit/loot/type/EntityLoot.java
Show resolved
Hide resolved
} | ||
|
||
if (getEntityProperties().level() != null) { | ||
entity.setMetadata("aura_skills_level", new FixedMetadataValue(plugin, getEntityProperties().level())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auraskills should be one word without an underscore
Made those changes. Also enabled auto formatting in Intellij on save for the future :'D |
This PR adds a new entity loot type for fishing (or it can be added to other loot tables as well, it just didn't really make sense).
The caught entity can be a vanilla entity (typically a mob) or a MythicMobs using the
mythicmobs:
prefix. Entity health, damage, and level can also be configured.The vertical and horizontal velocities are also configurable for fishing but already have default values.
Example configuration in
fishing.yml
: