Skip to content

Commit 50f26ec

Browse files
committed
added player trading behaviors, updated pom for 1.7.2
1 parent 64ce4cf commit 50f26ec

3 files changed

Lines changed: 73 additions & 3 deletions

File tree

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>de.ntcomputer</groupId>
55
<artifactId>controllable-mobs-api</artifactId>
6-
<version>1.6.4.6-SNAPSHOT</version>
6+
<version>1.7.2.6-SNAPSHOT</version>
77
<name>Controllable Mobs API</name>
88
<url>http://dev.bukkit.org/bukkit-plugins/controllable-mobs-api/</url>
99

1010
<properties>
1111
<maven.compiler.source>1.6</maven.compiler.source>
1212
<maven.compiler.target>1.6</maven.compiler.target>
1313
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14-
<minecraft.version>1.6.4</minecraft.version>
15-
<minecraft_version>1_6_R3</minecraft_version>
14+
<minecraft.version>1.7.2</minecraft.version>
15+
<minecraft_version>1_7_R1</minecraft_version>
1616
<github.global.server>github</github.global.server>
1717
</properties>
1818

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package de.ntcomputer.minecraft.controllablemobs.api.ai.behaviors;
2+
3+
import net.minecraft.server.v1_7_R1.EntityVillager;
4+
import net.minecraft.server.v1_7_R1.PathfinderGoal;
5+
import net.minecraft.server.v1_7_R1.PathfinderGoalTradeWithPlayer;
6+
7+
import org.bukkit.entity.Villager;
8+
9+
import de.ntcomputer.minecraft.controllablemobs.api.ai.AIType;
10+
import de.ntcomputer.minecraft.controllablemobs.implementation.CraftControllableMob;
11+
12+
/**
13+
* This AI behavior will mark a villager as trading with a player.
14+
*
15+
* @author DevCybran
16+
* @version 1.7.2.6
17+
*
18+
*/
19+
public final class AIPlayerTrade extends AIBehavior<Villager> {
20+
21+
public AIPlayerTrade(int priority) {
22+
super(priority);
23+
}
24+
25+
@Override
26+
public AIType getType() {
27+
return AIType.ACTION_PLAYERTRADE;
28+
}
29+
30+
@Override
31+
public PathfinderGoal createPathfinderGoal(CraftControllableMob<? extends Villager> mob) {
32+
return new PathfinderGoalTradeWithPlayer((EntityVillager) mob.nmsEntity);
33+
}
34+
35+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package de.ntcomputer.minecraft.controllablemobs.api.ai.behaviors;
2+
3+
import net.minecraft.server.v1_7_R1.EntityVillager;
4+
import net.minecraft.server.v1_7_R1.PathfinderGoal;
5+
import net.minecraft.server.v1_7_R1.PathfinderGoalLookAtTradingPlayer;
6+
7+
import org.bukkit.entity.Villager;
8+
9+
import de.ntcomputer.minecraft.controllablemobs.api.ai.AIType;
10+
import de.ntcomputer.minecraft.controllablemobs.implementation.CraftControllableMob;
11+
12+
/**
13+
* This AI behavior will make a villager look at the player he is trading with (if any).
14+
*
15+
* @author DevCybran
16+
* @version 1.7.2.6
17+
*
18+
*/
19+
public final class AIPlayerTradingLook extends AIBehavior<Villager> {
20+
21+
public AIPlayerTradingLook(int priority) {
22+
super(priority);
23+
}
24+
25+
@Override
26+
public AIType getType() {
27+
return AIType.ACTION_PLAYERTRADINGLOOK;
28+
}
29+
30+
@Override
31+
public PathfinderGoal createPathfinderGoal(CraftControllableMob<? extends Villager> mob) {
32+
return new PathfinderGoalLookAtTradingPlayer((EntityVillager) mob.nmsEntity);
33+
}
34+
35+
}

0 commit comments

Comments
 (0)