Skip to content
This repository has been archived by the owner on Dec 27, 2024. It is now read-only.

Commit

Permalink
task: update to 1.15 removed deprecated methods and those that weren'…
Browse files Browse the repository at this point in the history
…t right
  • Loading branch information
yannicklamprecht committed Dec 11, 2019
1 parent f4cb3b8 commit ea6f053
Show file tree
Hide file tree
Showing 32 changed files with 289 additions and 1,037 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,6 @@ interface Insentient {

fun getLookingAt(): Location

/**
* Will return the PathfinderGoalTargetSelector
*
* @return targetSelector
*/
@Deprecated("")
fun getTargetSelector(): PathfinderGoalSelector

/**
* Will return the PathfinderGoalSelector
*
* @return selector
*/
@Deprecated("")
fun getGoalSelector(): PathfinderGoalSelector

/**
* Get the ControllerJump for jumping
*
* @return controllerJump to let the entity jump
*/
fun getControllerJump(): ControllerJump

/**
* Get the ControllerLook for looking
*
* @return controllerLook to let the entity look at a target
*/
fun getControllerLook(): ControllerLook


/**
* Get the controllerMove direct movement
*
* @return controllerMove to move the entity directly
*/
fun getControllerMove(): ControllerMove

/**
* Get the Navigation for moving Entity
Expand All @@ -67,21 +30,6 @@ interface Insentient {
*/
fun getHeadHeight(): Float


/**
* Will return the entities default yaw
*
* @return yaw
*/
fun getDefaultYaw(): Int

/**
* Will return the entities default pitch
*
* @return pitch
*/
fun getDefaultPitch(): Int

/**
* Will return the LivingEntity of Bukkit
*
Expand Down Expand Up @@ -150,27 +98,6 @@ interface Insentient {
fun onEntityKill(livingEntity: LivingEntity)


/**
* @param motionX relative motionX
* @param motionY relative motionY
* @param motionZ relative motionZ
*/
@Deprecated("use {@link Insentient#setMovementDirection(Vector, double)} Will move the Entity\n" +
" relative")
fun moveRelative(motionX: Double, motionY: Double, motionZ: Double)


/**
* @param motionX relative motionX
* @param motionY relative motionY
* @param motionZ relative motionZ
* @param speed the speed multiplier
*/
@Deprecated("use {@link Insentient#setMovementDirection(Vector, double)} Will move the Entity\n" +
" relative")
fun moveRelative(motionX: Double, motionY: Double, motionZ: Double, speed: Double)


/**
* Rotates the entity
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class PathfinderGoalGimmiCookie(private val pathfinderGoalEntity: Insentient, pr
}

override fun execute() {
this.pathfinderGoalEntity.getControllerJump().jump()
this.pathfinderGoalEntity.jump()
if (creature.location.distanceSquared(nearestPlayer!!.location) <= 1) {
this.creature.world.dropItem(nearestPlayer!!.location, COOKIE)
this.creature.equipment?.setItemInMainHand(null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class PathfinderGoalMoveToLocation(private val pathfinderGoalEntity: Insentient,
override fun execute() {
if (pathfinderGoalEntity.getBukkitEntity().location.add(pathfinderGoalEntity.getBukkitEntity().location.direction.normalize())
.block.type != Material.AIR) {
pathfinderGoalEntity.getControllerJump().jump()
pathfinderGoalEntity.jump()
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PathfinderGoalFollowEntity(private val pathfinderGoalEntity: Insentient, p
if (pathfinderGoalEntity.getBukkitEntity().location
.add(pathfinderGoalEntity.getBukkitEntity().location.direction.normalize())
.block.type != Material.AIR) {
this.pathfinderGoalEntity.getControllerJump().jump()
this.pathfinderGoalEntity.jump()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PathfinderGoalReturnToLocation(private val pathfinderGoalEntity: Insentien
}

override fun execute() {
this.pathfinderGoalEntity.getControllerJump().jump()
this.pathfinderGoalEntity.jump()
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,10 @@ class PathfinderGoalSteerEntity(private val pathfinderManager: PathfinderManager

if (blockInDirection.block.type.isSolid && !blockInDirection.add(0.0, 1.0, 0.0).block
.type.isSolid) {
pathfinderGoalEntity.getControllerJump().jump()
pathfinderGoalEntity.jump()
}

this.pathfinderGoalEntity.getControllerMove()
.move(pathfinderPlayer!!.getMotionForward(), pathfinderPlayer!!.getMotionSideward())
this.pathfinderGoalEntity.setStrafeDirection(pathfinderPlayer!!.getMotionForward(), pathfinderPlayer!!.getMotionSideward())
val location = player.location

this.pathfinderGoalEntity.setRotation(location.yaw, location.yaw)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class PathfinderGoalWalkToSteakAndEat(private val pathfinderGoalEntity: Insentie
*/
override fun execute() {
pathfinderGoalEntity.getNavigation().moveTo(target!!, 2.0)
pathfinderGoalEntity.getControllerJump().jump()
pathfinderGoalEntity.jump()
}


Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@ import org.bukkit.entity.*
*/
interface PathfinderManager {

/**
* Returns a pathfinderGoalEntity from creature
*
* @param creature entity you want to get the PathfinderGoalEntity
* @return pathfinderGoalEntity the entity you can apply pathfindergoals on to
*/
@Deprecated("Forgot r of pathfinder")
fun getPathfindeGoalEntity(creature: Creature): Insentient

/**
* Returns a pathfinderGoalEntity from creature
*
Expand Down
7 changes: 4 additions & 3 deletions PathfinderPlugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,21 @@
</dependency>

<dependency>
<artifactId>Pathfinder_1_13</artifactId>
<artifactId>Pathfinder_1_13_2</artifactId>
<groupId>com.github.ysl3000.pathfindergoalapi</groupId>
<scope>compile</scope>
<version>${project.parent.version}</version>
</dependency>

<dependency>
<artifactId>Pathfinder_1_13_2</artifactId>
<artifactId>Pathfinder_1_14</artifactId>
<groupId>com.github.ysl3000.pathfindergoalapi</groupId>
<scope>compile</scope>
<version>${project.parent.version}</version>
</dependency>

<dependency>
<artifactId>Pathfinder_1_14</artifactId>
<artifactId>Pathfinder_1_15</artifactId>
<groupId>com.github.ysl3000.pathfindergoalapi</groupId>
<scope>compile</scope>
<version>${project.parent.version}</version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class PathfinderGoalPlugin : JavaPlugin() {
when (version) {

"v1_12_R1" -> this.craftPathfinderManager = com.github.ysl3000.bukkit.pathfinding.craftbukkit.v1_12_R1.pathfinding.CraftPathfinderManager()
"v1_13_R1" -> this.craftPathfinderManager = com.github.ysl3000.bukkit.pathfinding.craftbukkit.v1_13_R1.pathfinding.CraftPathfinderManager()
"v1_13_R2" -> this.craftPathfinderManager = com.github.ysl3000.bukkit.pathfinding.craftbukkit.v1_13_R2.pathfinding.CraftPathfinderManager()
"v1_14_R1" -> this.craftPathfinderManager = com.github.ysl3000.bukkit.pathfinding.craftbukkit.v1_14_R1.pathfinding.CraftPathfinderManager()
"v1_15_R1" -> this.craftPathfinderManager = com.github.ysl3000.bukkit.pathfinding.craftbukkit.v1_15_R1.pathfinding.CraftPathfinderManager()

else -> {
println("This version of Minecraft is not supported")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class PathfinderTestPlugin : JavaPlugin(), Listener {

private fun chatCommand(p: Player, args: List<String>): Boolean {
val creature = p.world.spawn<Zombie>(p.location, Zombie::class.java)
val pathfinderGoalEntity = this.pathfinderManager?.getPathfindeGoalEntity(creature)
val pathfinderGoalEntity = this.pathfinderManager?.getPathfinderGoalEntity(creature)
clear(pathfinderGoalEntity)
pathfinderGoalEntity?.let { insentient: Insentient ->
{
Expand All @@ -94,7 +94,7 @@ class PathfinderTestPlugin : JavaPlugin(), Listener {

val creature = p.world
.spawn<Zombie>(Location(p.world, 235.0, 70.0, 246.0), Zombie::class.java)
val pathfinderGoalEntity = this.pathfinderManager?.getPathfindeGoalEntity(creature)
val pathfinderGoalEntity = this.pathfinderManager?.getPathfinderGoalEntity(creature)
clear(pathfinderGoalEntity)
pathfinderGoalEntity?.addPathfinderGoal(0, PathfinderGoalGimmiCookie(pathfinderGoalEntity, creature))
return true
Expand All @@ -104,7 +104,7 @@ class PathfinderTestPlugin : JavaPlugin(), Listener {
private fun moveToLocationCommand(p: Player, args: List<String>): Boolean {

val creature = p.world.spawn<Zombie>(p.location, Zombie::class.java)
val pathfinderGoalEntity = this.pathfinderManager?.getPathfindeGoalEntity(creature)
val pathfinderGoalEntity = this.pathfinderManager?.getPathfinderGoalEntity(creature)

clear(pathfinderGoalEntity)
pathfinderGoalEntity?.addPathfinderGoal(0,
Expand All @@ -118,7 +118,7 @@ class PathfinderTestPlugin : JavaPlugin(), Listener {
private fun printGoalCommand(p: Player, args: List<String>): Boolean {
val creature = p.world.spawn<Zombie>(p.location, Zombie::class.java)

val pathfinderGoalEntity = this.pathfinderManager?.getPathfindeGoalEntity(creature)
val pathfinderGoalEntity = this.pathfinderManager?.getPathfinderGoalEntity(creature)
clear(pathfinderGoalEntity)
pathfinderGoalEntity?.addPathfinderGoal(0,
PathfinderGoalPrint()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private class Chat implements ICommand {
public boolean execute(Player p, List<String> args) {

Creature creature = p.getWorld().spawn(p.getLocation(), Zombie.class);
Insentient pathfinderGoalEntity = this.pathfinderManager.getPathfindeGoalEntity(creature);
Insentient pathfinderGoalEntity = this.pathfinderManager.getPathfinderGoalEntity(creature);

pathfinderGoalEntity.clearPathfinderGoals();
pathfinderGoalEntity.clearTargetPathfinderGoals();
Expand All @@ -100,7 +100,7 @@ public boolean execute(Player p, List<String> args) {

Creature creature = p.getWorld()
.spawn(new Location(p.getWorld(), 235.0, 70.0, 246.0), Zombie.class);
Insentient pathfinderGoalEntity = this.pathfinderManager.getPathfindeGoalEntity(creature);
Insentient pathfinderGoalEntity = this.pathfinderManager.getPathfinderGoalEntity(creature);

pathfinderGoalEntity.clearPathfinderGoals();
pathfinderGoalEntity.clearTargetPathfinderGoals();
Expand All @@ -124,7 +124,7 @@ private MoveToLocation(PathfinderManager pathfinderManager) {
public boolean execute(Player p, List<String> args) {

Creature creature = p.getWorld().spawn(p.getLocation(), Zombie.class);
Insentient pathfinderGoalEntity = this.pathfinderManager.getPathfindeGoalEntity(creature);
Insentient pathfinderGoalEntity = this.pathfinderManager.getPathfinderGoalEntity(creature);
pathfinderGoalEntity.clearPathfinderGoals();
pathfinderGoalEntity.clearTargetPathfinderGoals();
pathfinderGoalEntity.addPathfinderGoal(0,
Expand All @@ -148,7 +148,7 @@ private PrintGoal(PathfinderManager pathfinderManager) {
public boolean execute(Player p, List<String> atgs) {
Creature creature = p.getWorld().spawn(p.getLocation(), Zombie.class);

Insentient pathfinderGoalEntity = this.pathfinderManager.getPathfindeGoalEntity(creature);
Insentient pathfinderGoalEntity = this.pathfinderManager.getPathfinderGoalEntity(creature);
pathfinderGoalEntity.clearPathfinderGoals();
pathfinderGoalEntity.clearTargetPathfinderGoals();
pathfinderGoalEntity.addPathfinderGoal(0,
Expand Down
Loading

0 comments on commit ea6f053

Please sign in to comment.