Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from PXAV/development
Add all changes for v0.3.0 - "The world update"
- Loading branch information
Showing
54 changed files
with
4,505 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# v0.3.0 | ||
> Release date: 27.02.2021 | ||
**The world update**: | ||
* Add custom library to for world and location management: | ||
* Add `KelpWorld` class replacing the normal `World` class by bukkit. It still does not offer all methods of a default bukkit world, but offers integration with other kelp world classes. | ||
* Add `KelpLocation` offering a replacement for the normal bukkit `Location`. It offers some more methods for vector calculation for example. | ||
* Add `KelpChunk`, which is a replacement for the normal bukkit `Chunk`. On top of the normal bukkit methods, it offers methods to work with neighbouring chunks. | ||
* Add `KelpBlock` | ||
* All the mentioned classes port methods from newer versions to older versions for example bone meal application for `KelpBlock` or checking whether a `KelpChunk` is a slime chunk. More method ports will follow. | ||
* Add some util methods used by the kelp world classes: | ||
* `WorldType` expresses whether a world is overworld, nether or the end | ||
* `CardinalDirection` expresses in which direction a player or relative block is facing. It simplifies the work wit `yaw` | ||
* `ExplosionPower` is basically just a wrapper for a float, but it contains some default values for default minecraft explosion types, which makes the code more readable. Instead of `4F`, you would write `ExplosionPower.TNT` | ||
* Add functionality to force load chunks | ||
* The `KelpPlayer`, `KelpEntity`, `KelpNpc` class as well as the particle library are now using the new location system instead of the normal bukkit system. | ||
* Add `KelpDummyPlugin` which can be used to emulate a plugin (`KelpApplication`) when developing core features where providing a plugin instance is needed. | ||
* Fix some material sub ids of the above mentioned ones. | ||
* Add `MathUtils` class providing some useful mathematical functions | ||
* When tagging an item of type `AIR`, the method does not return `null` anymore but the original item stack without a tag. This should avoid unexpected NPEs in the future. | ||
* Documentation improvements | ||
* Fix #45: Item description of `KelpItem` was not rendered. | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package de.pxav.kelp.core; | ||
|
||
import de.pxav.kelp.core.application.KelpApplication; | ||
|
||
/** | ||
* This class is used to pass a dummy plugin instance when developing | ||
* inside the core module. | ||
* | ||
* For some things like {@link de.pxav.kelp.core.world.KelpChunk#addForceLoadFlag(Class)} you | ||
* need to pass a {@link KelpApplication} class representing your plugin, but the kelp core | ||
* obviously is no Kelp plugin, but a spigot plugin ({@link org.bukkit.plugin.java.JavaPlugin}). | ||
* | ||
* So if you ever run into such scenarios as a KelpCore developer, use this | ||
* class. | ||
* | ||
* @author pxav | ||
*/ | ||
public class KelpDummyPlugin extends KelpApplication {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
core/src/main/java/de/pxav/kelp/core/common/MathUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package de.pxav.kelp.core.common; | ||
|
||
import java.util.concurrent.ThreadLocalRandom; | ||
|
||
/** | ||
* A small collection of some mathematical utils for Kelp. | ||
* This class is functional, so all methods can be accessed statically. | ||
* | ||
* @author pxav | ||
*/ | ||
public class MathUtils { | ||
|
||
/** | ||
* Checks if the given number x is even, which is | ||
* equal to {@code x % 2 == 0} | ||
* | ||
* @param number The number to check. | ||
* @return {@code true} if the number is even. | ||
*/ | ||
public static boolean isEven(int number) { | ||
return number % 2 == 0; | ||
} | ||
|
||
/** | ||
* Checks if the given number x is odd, which is | ||
* equal to {@code x % 2 == 1} | ||
* | ||
* @param number The number to check. | ||
* @return {@code true} if the number is odd. | ||
*/ | ||
public static boolean isOdd(int number) { | ||
return number % 2 != 0; | ||
} | ||
|
||
/** | ||
* Randomly calculates whether a certain chance has been | ||
* fulfilled. If your {@code chance} is set to {@code 50}, | ||
* there will be a 50% chance that this method will return | ||
* {@code true}. If it is {@code 5}, then there will be a | ||
* {@code 5} per cent chance that this method will return | ||
* {@code true}. | ||
* | ||
* @param chance The chance to use for random calculation. | ||
* @return Either true or false depending on your luck and the provided chance. | ||
*/ | ||
public static boolean perCentChance(int chance) { | ||
if (chance == 100) { | ||
return true; | ||
} | ||
if (chance == 0) { | ||
return false; | ||
} | ||
return ThreadLocalRandom.current().nextInt(0, 101) < chance; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.