Changed exp calculation and added an option for exp scaling on multiply exp; fixed #53#62
Changed exp calculation and added an option for exp scaling on multiply exp; fixed #53#62ploppyperson merged 7 commits intoploppyperson:masterfrom Gluupor:master
Conversation
|
@Gluupor have you tested this locally before submitting the PR? |
added a default for the use in code in case the config isnt updated right away
|
made an edit to provide a default thx @andrewkm and @JamieSinn for pointing that out |
|
97f8d0a the issue remains with bigger entities like horses, donkeys and such (yes there actually is a problem with them as well even before the change i made and tested). dealing with that would require more intenisve checking and figuring out a decent location to spawn the new entitiy in. then again this would be impossible when people drop those kind of entities in a 1x1 block space and then proceed to kill them. |
| int newExperience = (int) Math.round(originalExperience * (subtractAmount - 1) * (0.75 + ThreadLocalRandom.current().nextDouble(0.5))); | ||
| ((ExperienceOrb) dead.getWorld().spawnEntity(dead.getLocation(), EntityType.EXPERIENCE_ORB)).setExperience(newExperience); | ||
| double newExperience = subtractAmount * (originalExperience * sm.config.getCustomConfig().getDouble("multiply-exp-scaling", 1.0)); | ||
| ((ExperienceOrb) dead.getWorld().spawnEntity(dead.getLocation(), EntityType.EXPERIENCE_ORB)).setExperience((int)newExperience); |
There was a problem hiding this comment.
Casting a double to an int without rounding is a bad idea.
| import uk.antiperson.stackmob.StackMob; | ||
| import uk.antiperson.stackmob.tools.extras.GlobalValues; | ||
|
|
||
| import java.io.Console; |
it will only run for entities that were causing issues as per #53 doing it for every entity like spiders caused them to glitch out
changed the way of how the location is determined for spawning new mobs after kills so it only does it for zombie'ish entities as per #53 it was glitching out for spiders doing it the same way for every entity
Should fix #61 adds some functionality