mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 04:05:12 +00:00
Made setRotation work for players, with yaw and pitch parameters.
This commit is contained in:
1 parent
18aa2d099f
commit
6fcf566ef7
2 files changed
+26
-1
No files matched your search
@@ -110,6 +110,28 @@ public class NoppesUtilPlayer {
|
||||
}
|
||||
player.worldObj.updateEntityWithOptionalForce(player, false);
|
||||
}
|
||||
|
||||
public static void teleportPlayer(EntityPlayerMP player, double posX, double posY, double posZ, float yaw, float pitch, int dimension){
|
||||
if(player.dimension != dimension){
|
||||
int dim = player.dimension;
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
WorldServer wor = server.worldServerForDimension(dimension);
|
||||
if(wor == null){
|
||||
player.addChatMessage(new ChatComponentText("Broken transporter. Dimenion does not exist"));
|
||||
return;
|
||||
}
|
||||
player.setLocationAndAngles(posX, posY, posZ, yaw, pitch);
|
||||
server.getConfigurationManager().transferPlayerToDimension(player, dimension, new CustomTeleporter(wor));
|
||||
player.playerNetServerHandler.setPlayerLocation(posX, posY, posZ, yaw, pitch);
|
||||
|
||||
if(!wor.playerEntities.contains(player))
|
||||
wor.spawnEntityInWorld(player);
|
||||
}
|
||||
else{
|
||||
player.playerNetServerHandler.setPlayerLocation(posX, posY, posZ, yaw, pitch);
|
||||
}
|
||||
player.worldObj.updateEntityWithOptionalForce(player, false);
|
||||
}
|
||||
|
||||
private static void followerBuy(RoleFollower role,IInventory currencyInv,EntityPlayerMP player, EntityNPCInterface npc){
|
||||
ItemStack currency = currencyInv.getStackInSlot(0);
|
||||
|
||||
@@ -309,7 +309,10 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
player.inventory.mainInventory[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setRotation(float rotationYaw, float rotationPitch){
|
||||
NoppesUtilPlayer.teleportPlayer(player, player.posX, player.posY, player.posZ, rotationYaw, rotationPitch, player.dimension);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param achievement The achievement id. For a complete list see http://minecraft.gamepedia.com/Achievements
|
||||
|
||||
Reference in new issue
Block a user