use of thpmc.vanilla_source.api.util.collision.CollideOption in project VanillaSource by TheHollowPlanetMC.
the class TestListener method onChat.
@EventHandler
public void onChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
if (!event.getMessage().equals("spawn"))
return;
TaskHandler.runSync(() -> {
Location location = player.getLocation();
INMSHandler nmsHandler = VanillaSourceAPI.getInstance().getNMSHandler();
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "NPC");
NMSEntityController entityPlayer = nmsHandler.createNMSEntityController(location.getWorld(), location.getX(), location.getY(), location.getZ(), EntityType.PLAYER, gameProfile);
entityPlayer.setPositionRaw(location.getX(), location.getY(), location.getZ());
CollideOption collideOption = new CollideOption(FluidCollisionMode.NEVER, true);
/*
collideOption.setCollideBlockFunction(engineBlock -> {
return engineBlock.getMaterial() != Material.GLASS;
});*/
/*
VanillaSourceAPI.getInstance().getTickRunnerPool().spawn(tickRunner -> {
EnginePlayerEntity npc = new EnginePlayerEntity(tickRunner.getThreadLocalCache().getWorld(location.getWorld().getName()), (NMSEntityPlayer) entityPlayer, tickRunner, true);
npc.getGoalSelector().registerGoal(0, new EntityFollowGoal(player));
npc.setMovementCollideOption(collideOption);
tickRunner.addEntity(npc);
});*/
});
}
Aggregations