Skip to content
This repository was archived by the owner on Apr 14, 2020. It is now read-only.

Changed exp calculation and added an option for exp scaling on multiply exp; fixed #53#62

Merged
ploppyperson merged 7 commits intoploppyperson:masterfrom
Gluupor:master
Jun 10, 2018
Merged

Changed exp calculation and added an option for exp scaling on multiply exp; fixed #53#62
ploppyperson merged 7 commits intoploppyperson:masterfrom
Gluupor:master

Conversation

@Gluupor
Copy link
Contributor

@Gluupor Gluupor commented Jun 8, 2018

Should fix #61 adds some functionality

@andrewkm
Copy link

andrewkm commented Jun 9, 2018

@Gluupor have you tested this locally before submitting the PR?
This looks like it will error for anyone who doesn't update the config as it has no default as well.

added a default for the use in code in case the config isnt updated right away
@Gluupor
Copy link
Contributor Author

Gluupor commented Jun 9, 2018

made an edit to provide a default thx @andrewkm and @JamieSinn for pointing that out

when spawning the dupe entity:
getting the location of the block the original died on and add .5 to x and z so it spawns in the blocks center and not on the side half way into a possible wall wich would cause it to glitch through
@Gluupor
Copy link
Contributor Author

Gluupor commented Jun 9, 2018

97f8d0a
i tested this for a good 20 mins locally and didnt have any zombie'ish entities glitching through a wall.

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.

@Gluupor Gluupor changed the title Changed exp calculation and added an option for exp scaling on multiply exp Changed exp calculation and added an option for exp scaling on multiply exp; fixed #53 Jun 9, 2018
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);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import?

Gluupor added 3 commits June 9, 2018 18:31
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
@ploppyperson ploppyperson merged commit 9906831 into ploppyperson:master Jun 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not receiving all the exp from kill-all/kill-step.

3 participants