Force armor stands to use the new pathfinder and override packet sending

This commit is contained in:
fullwall 2018-09-18 18:15:37 +08:00
parent 9d14b76d10
commit 97d4d7b428
6 changed files with 31 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import java.util.Iterator;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -239,7 +240,8 @@ public class CitizensNavigator implements Navigator, Runnable {
PathStrategy newStrategy; PathStrategy newStrategy;
if (npc.isFlyable()) { if (npc.isFlyable()) {
newStrategy = new FlyingAStarNavigationStrategy(npc, path, localParams); newStrategy = new FlyingAStarNavigationStrategy(npc, path, localParams);
} else if (localParams.useNewPathfinder() || !(npc.getEntity() instanceof LivingEntity)) { } else if (localParams.useNewPathfinder() || !(npc.getEntity() instanceof LivingEntity)
|| npc.getEntity() instanceof ArmorStand) {
newStrategy = new AStarNavigationStrategy(npc, path, localParams); newStrategy = new AStarNavigationStrategy(npc, path, localParams);
} else { } else {
newStrategy = new MCNavigationStrategy(npc, path, localParams); newStrategy = new MCNavigationStrategy(npc, path, localParams);
@ -260,7 +262,8 @@ public class CitizensNavigator implements Navigator, Runnable {
PathStrategy newStrategy; PathStrategy newStrategy;
if (npc.isFlyable()) { if (npc.isFlyable()) {
newStrategy = new FlyingAStarNavigationStrategy(npc, target, localParams); newStrategy = new FlyingAStarNavigationStrategy(npc, target, localParams);
} else if (localParams.useNewPathfinder() || !(npc.getEntity() instanceof LivingEntity)) { } else if (localParams.useNewPathfinder() || !(npc.getEntity() instanceof LivingEntity)
|| npc.getEntity() instanceof ArmorStand) {
newStrategy = new AStarNavigationStrategy(npc, target, localParams); newStrategy = new AStarNavigationStrategy(npc, target, localParams);
} else { } else {
newStrategy = new MCNavigationStrategy(npc, target, localParams); newStrategy = new MCNavigationStrategy(npc, target, localParams);

View File

@ -5,6 +5,7 @@ import java.io.IOException;
import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl;
import net.minecraft.server.v1_10_R1.EnumProtocolDirection; import net.minecraft.server.v1_10_R1.EnumProtocolDirection;
import net.minecraft.server.v1_10_R1.NetworkManager; import net.minecraft.server.v1_10_R1.NetworkManager;
import net.minecraft.server.v1_10_R1.Packet;
public class EmptyNetworkManager extends NetworkManager { public class EmptyNetworkManager extends NetworkManager {
public EmptyNetworkManager(EnumProtocolDirection flag) throws IOException { public EmptyNetworkManager(EnumProtocolDirection flag) throws IOException {
@ -16,4 +17,8 @@ public class EmptyNetworkManager extends NetworkManager {
public boolean isConnected() { public boolean isConnected() {
return true; return true;
} }
@Override
public void sendPacket(Packet packet) {
}
} }

View File

@ -5,6 +5,7 @@ import java.io.IOException;
import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl;
import net.minecraft.server.v1_11_R1.EnumProtocolDirection; import net.minecraft.server.v1_11_R1.EnumProtocolDirection;
import net.minecraft.server.v1_11_R1.NetworkManager; import net.minecraft.server.v1_11_R1.NetworkManager;
import net.minecraft.server.v1_11_R1.Packet;
public class EmptyNetworkManager extends NetworkManager { public class EmptyNetworkManager extends NetworkManager {
public EmptyNetworkManager(EnumProtocolDirection flag) throws IOException { public EmptyNetworkManager(EnumProtocolDirection flag) throws IOException {
@ -16,4 +17,8 @@ public class EmptyNetworkManager extends NetworkManager {
public boolean isConnected() { public boolean isConnected() {
return true; return true;
} }
@Override
public void sendPacket(Packet packet) {
}
} }

View File

@ -5,6 +5,7 @@ import java.io.IOException;
import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl;
import net.minecraft.server.v1_12_R1.EnumProtocolDirection; import net.minecraft.server.v1_12_R1.EnumProtocolDirection;
import net.minecraft.server.v1_12_R1.NetworkManager; import net.minecraft.server.v1_12_R1.NetworkManager;
import net.minecraft.server.v1_12_R1.Packet;
public class EmptyNetworkManager extends NetworkManager { public class EmptyNetworkManager extends NetworkManager {
public EmptyNetworkManager(EnumProtocolDirection flag) throws IOException { public EmptyNetworkManager(EnumProtocolDirection flag) throws IOException {
@ -16,4 +17,8 @@ public class EmptyNetworkManager extends NetworkManager {
public boolean isConnected() { public boolean isConnected() {
return true; return true;
} }
@Override
public void sendPacket(Packet packet) {
}
} }

View File

@ -2,9 +2,11 @@ package net.citizensnpcs.nms.v1_13_R2.network;
import java.io.IOException; import java.io.IOException;
import io.netty.util.concurrent.GenericFutureListener;
import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl;
import net.minecraft.server.v1_13_R2.EnumProtocolDirection; import net.minecraft.server.v1_13_R2.EnumProtocolDirection;
import net.minecraft.server.v1_13_R2.NetworkManager; import net.minecraft.server.v1_13_R2.NetworkManager;
import net.minecraft.server.v1_13_R2.Packet;
public class EmptyNetworkManager extends NetworkManager { public class EmptyNetworkManager extends NetworkManager {
public EmptyNetworkManager(EnumProtocolDirection flag) throws IOException { public EmptyNetworkManager(EnumProtocolDirection flag) throws IOException {
@ -16,4 +18,8 @@ public class EmptyNetworkManager extends NetworkManager {
public boolean isConnected() { public boolean isConnected() {
return true; return true;
} }
@Override
public void sendPacket(Packet packet, GenericFutureListener genericfuturelistener) {
}
} }

View File

@ -5,6 +5,7 @@ import java.io.IOException;
import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl;
import net.minecraft.server.v1_8_R3.EnumProtocolDirection; import net.minecraft.server.v1_8_R3.EnumProtocolDirection;
import net.minecraft.server.v1_8_R3.NetworkManager; import net.minecraft.server.v1_8_R3.NetworkManager;
import net.minecraft.server.v1_8_R3.Packet;
public class EmptyNetworkManager extends NetworkManager { public class EmptyNetworkManager extends NetworkManager {
public EmptyNetworkManager(EnumProtocolDirection flag) throws IOException { public EmptyNetworkManager(EnumProtocolDirection flag) throws IOException {
@ -16,4 +17,8 @@ public class EmptyNetworkManager extends NetworkManager {
public boolean g() { public boolean g() {
return true; return true;
} }
@Override
public void sendPacket(Packet packet) {
}
} }