mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
Use head height for block breaker
This commit is contained in:
parent
9d50055d6f
commit
d9762be13b
@ -9,6 +9,7 @@ import net.citizensnpcs.api.ai.tree.BehaviorStatus;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.PlayerAnimation;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_10_R1.BlockPosition;
|
||||
@ -46,7 +47,8 @@ public class CitizensBlockBreaker extends BlockBreaker {
|
||||
}
|
||||
|
||||
private double distanceSquared() {
|
||||
return Math.pow(entity.locX - x, 2) + Math.pow(entity.locY - y, 2) + Math.pow(entity.locZ - z, 2);
|
||||
return Math.pow(entity.locX - x, 2) + Math.pow(NMS.getHeight(entity.getBukkitEntity()) + entity.locY - y, 2)
|
||||
+ Math.pow(entity.locZ - z, 2);
|
||||
}
|
||||
|
||||
private net.minecraft.server.v1_10_R1.ItemStack getCurrentItem() {
|
||||
|
@ -9,6 +9,7 @@ import net.citizensnpcs.api.ai.tree.BehaviorStatus;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.PlayerAnimation;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_11_R1.BlockPosition;
|
||||
@ -46,7 +47,8 @@ public class CitizensBlockBreaker extends BlockBreaker {
|
||||
}
|
||||
|
||||
private double distanceSquared() {
|
||||
return Math.pow(entity.locX - x, 2) + Math.pow(entity.locY - y, 2) + Math.pow(entity.locZ - z, 2);
|
||||
return Math.pow(entity.locX - x, 2) + Math.pow(NMS.getHeight(entity.getBukkitEntity()) + entity.locY - y, 2)
|
||||
+ Math.pow(entity.locZ - z, 2);
|
||||
}
|
||||
|
||||
private net.minecraft.server.v1_11_R1.ItemStack getCurrentItem() {
|
||||
|
@ -9,6 +9,7 @@ import net.citizensnpcs.api.ai.tree.BehaviorStatus;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.PlayerAnimation;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_12_R1.BlockPosition;
|
||||
@ -46,7 +47,8 @@ public class CitizensBlockBreaker extends BlockBreaker {
|
||||
}
|
||||
|
||||
private double distanceSquared() {
|
||||
return Math.pow(entity.locX - x, 2) + Math.pow(entity.locY - y, 2) + Math.pow(entity.locZ - z, 2);
|
||||
return Math.pow(entity.locX - x, 2) + Math.pow(NMS.getHeight(entity.getBukkitEntity()) + entity.locY - y, 2)
|
||||
+ Math.pow(entity.locZ - z, 2);
|
||||
}
|
||||
|
||||
private net.minecraft.server.v1_12_R1.ItemStack getCurrentItem() {
|
||||
|
@ -9,6 +9,7 @@ import net.citizensnpcs.api.ai.tree.BehaviorStatus;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.PlayerAnimation;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_13_R2.BlockPosition;
|
||||
@ -46,7 +47,8 @@ public class CitizensBlockBreaker extends BlockBreaker {
|
||||
}
|
||||
|
||||
private double distanceSquared() {
|
||||
return Math.pow(entity.locX - x, 2) + Math.pow(entity.locY - y, 2) + Math.pow(entity.locZ - z, 2);
|
||||
return Math.pow(entity.locX - x, 2) + Math.pow(NMS.getHeight(entity.getBukkitEntity()) + entity.locY - y, 2)
|
||||
+ Math.pow(entity.locZ - z, 2);
|
||||
}
|
||||
|
||||
private net.minecraft.server.v1_13_R2.ItemStack getCurrentItem() {
|
||||
|
@ -9,6 +9,7 @@ import net.citizensnpcs.api.ai.tree.BehaviorStatus;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.PlayerAnimation;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_14_R1.BlockPosition;
|
||||
@ -47,7 +48,8 @@ public class CitizensBlockBreaker extends BlockBreaker {
|
||||
}
|
||||
|
||||
private double distanceSquared() {
|
||||
return Math.pow(entity.locX - x, 2) + Math.pow(entity.locY - y, 2) + Math.pow(entity.locZ - z, 2);
|
||||
return Math.pow(entity.locX - x, 2) + Math.pow(NMS.getHeight(entity.getBukkitEntity()) + entity.locY - y, 2)
|
||||
+ Math.pow(entity.locZ - z, 2);
|
||||
}
|
||||
|
||||
private net.minecraft.server.v1_14_R1.ItemStack getCurrentItem() {
|
||||
|
@ -9,6 +9,7 @@ import net.citizensnpcs.api.ai.tree.BehaviorStatus;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.PlayerAnimation;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_15_R1.BlockPosition;
|
||||
@ -47,7 +48,8 @@ public class CitizensBlockBreaker extends BlockBreaker {
|
||||
}
|
||||
|
||||
private double distanceSquared() {
|
||||
return Math.pow(entity.locX() - x, 2) + Math.pow(entity.locY() - y, 2) + Math.pow(entity.locZ() - z, 2);
|
||||
return Math.pow(entity.locX() - x, 2) + Math.pow(NMS.getHeight(entity.getBukkitEntity()) + entity.locY() - y, 2)
|
||||
+ Math.pow(entity.locZ() - z, 2);
|
||||
}
|
||||
|
||||
private net.minecraft.server.v1_15_R1.ItemStack getCurrentItem() {
|
||||
|
@ -64,22 +64,22 @@ public class HumanController extends AbstractEntityController {
|
||||
Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());
|
||||
NMS.addOrRemoveFromPlayerList(getBukkitEntity(), removeFromPlayerList);
|
||||
|
||||
if (Setting.USE_SCOREBOARD_TEAMS.asBoolean()) {
|
||||
Scoreboard scoreboard = Util.getDummyScoreboard();
|
||||
String teamName = Util.getTeamName(profile.getId());
|
||||
if (!Setting.USE_SCOREBOARD_TEAMS.asBoolean())
|
||||
return;
|
||||
Scoreboard scoreboard = Util.getDummyScoreboard();
|
||||
String teamName = Util.getTeamName(profile.getId());
|
||||
|
||||
Team team = scoreboard.getTeam(teamName);
|
||||
int mode = 2;
|
||||
if (team == null) {
|
||||
team = scoreboard.registerNewTeam(teamName);
|
||||
mode = 0;
|
||||
}
|
||||
team.addPlayer(handle.getBukkitEntity());
|
||||
|
||||
handle.getNPC().data().set(NPC.SCOREBOARD_FAKE_TEAM_NAME_METADATA, teamName);
|
||||
|
||||
Util.sendTeamPacketToOnlinePlayers(team, mode);
|
||||
Team team = scoreboard.getTeam(teamName);
|
||||
int mode = 2;
|
||||
if (team == null) {
|
||||
team = scoreboard.registerNewTeam(teamName);
|
||||
mode = 0;
|
||||
}
|
||||
team.addPlayer(handle.getBukkitEntity());
|
||||
|
||||
handle.getNPC().data().set(NPC.SCOREBOARD_FAKE_TEAM_NAME_METADATA, teamName);
|
||||
|
||||
Util.sendTeamPacketToOnlinePlayers(team, mode);
|
||||
}
|
||||
}, 20);
|
||||
|
||||
|
@ -9,6 +9,7 @@ import net.citizensnpcs.api.ai.tree.BehaviorStatus;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.PlayerAnimation;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_16_R1.BlockPosition;
|
||||
@ -47,7 +48,8 @@ public class CitizensBlockBreaker extends BlockBreaker {
|
||||
}
|
||||
|
||||
private double distanceSquared() {
|
||||
return Math.pow(entity.locX() - x, 2) + Math.pow(entity.locY() - y, 2) + Math.pow(entity.locZ() - z, 2);
|
||||
return Math.pow(entity.locX() - x, 2) + Math.pow(NMS.getHeight(entity.getBukkitEntity()) + entity.locY() - y, 2)
|
||||
+ Math.pow(entity.locZ() - z, 2);
|
||||
}
|
||||
|
||||
private net.minecraft.server.v1_16_R1.ItemStack getCurrentItem() {
|
||||
|
@ -9,6 +9,7 @@ import net.citizensnpcs.api.ai.tree.BehaviorStatus;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.PlayerAnimation;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_8_R3.Block;
|
||||
@ -46,7 +47,8 @@ public class CitizensBlockBreaker extends BlockBreaker {
|
||||
}
|
||||
|
||||
private double distanceSquared() {
|
||||
return Math.pow(entity.locX - x, 2) + Math.pow(entity.locY - y, 2) + Math.pow(entity.locZ - z, 2);
|
||||
return Math.pow(entity.locX - x, 2) + Math.pow(NMS.getHeight(entity.getBukkitEntity()) + entity.locY - y, 2)
|
||||
+ Math.pow(entity.locZ - z, 2);
|
||||
}
|
||||
|
||||
private net.minecraft.server.v1_8_R3.ItemStack getCurrentItem() {
|
||||
|
Loading…
Reference in New Issue
Block a user