mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-16 07:35:32 +01:00
Fix portal removal timing
This commit is contained in:
parent
a269bf1ccc
commit
bbf3f281eb
@ -145,6 +145,7 @@ public class SkinTrait extends Trait {
|
||||
* Sets the skin data directly, respawning the NPC if spawned
|
||||
*
|
||||
* @param skinName
|
||||
* Skin name, for caching purposes
|
||||
* @param signature
|
||||
* {@link #getSignature()}
|
||||
* @param data
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -45,6 +46,7 @@ import net.minecraft.server.v1_15_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_15_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_15_R1.ChatComponentText;
|
||||
import net.minecraft.server.v1_15_R1.DamageSource;
|
||||
import net.minecraft.server.v1_15_R1.DimensionManager;
|
||||
import net.minecraft.server.v1_15_R1.Entity;
|
||||
import net.minecraft.server.v1_15_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_15_R1.EntityPlayer;
|
||||
@ -77,8 +79,8 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
private final CitizensNPC npc;
|
||||
private final Location packetLocationCache = new Location(null, 0, 0, 0);
|
||||
private final SkinPacketTracker skinTracker;
|
||||
|
||||
private int updateCounter = 0;
|
||||
private int yawUpdateRequiredTicks;
|
||||
|
||||
public EntityHumanNPC(MinecraftServer minecraftServer, WorldServer world, GameProfile gameProfile,
|
||||
PlayerInteractManager playerInteractManager, NPC npc) {
|
||||
@ -316,7 +318,22 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
}
|
||||
|
||||
public void livingEntityBaseTick() {
|
||||
// doPortalTick code
|
||||
boolean old = this.af;
|
||||
if (af && ag + 1 > ab()) {
|
||||
af = false;
|
||||
Bukkit.getServer().getScheduler().runTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
portalCooldown = ba();
|
||||
a(world.worldProvider.getDimensionManager().getType() == DimensionManager.NETHER
|
||||
? DimensionManager.OVERWORLD
|
||||
: DimensionManager.NETHER, TeleportCause.NETHER_PORTAL);
|
||||
}
|
||||
});
|
||||
}
|
||||
entityBaseTick();
|
||||
af = old;
|
||||
this.az = this.aA;
|
||||
if (this.hurtTicks > 0) {
|
||||
this.hurtTicks -= 1;
|
||||
@ -381,7 +398,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
}
|
||||
|
||||
public void setTargetLook(Location target) {
|
||||
controllerLook.a(target.getX(), target.getY(), target.getZ(), 10, 40);
|
||||
controllerLook.a(target.getX(), target.getY(), target.getZ());
|
||||
}
|
||||
|
||||
public void setTracked() {
|
||||
@ -423,6 +440,16 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
}
|
||||
|
||||
npc.update();
|
||||
/*
|
||||
double diff = this.yaw - this.aK;
|
||||
if (diff != 40 && diff != -40) {
|
||||
++this.yawUpdateRequiredTicks;
|
||||
}
|
||||
if (this.yawUpdateRequiredTicks > 5) {
|
||||
this.yaw = (diff > -40 && diff < 0) || (diff > 0 && diff > 40) ? this.aK - 40 : this.aK + 40;
|
||||
this.yawUpdateRequiredTicks = 0;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public void updateAI() {
|
||||
|
@ -34,7 +34,6 @@ public class PlayerControllerLook {
|
||||
// this.a.yaw = MathHelper.b(this.a.yaw, this.a.aK, 40F);
|
||||
// this.a.aK = this.a(this.a.aK, this.a.aI, 10.0F);
|
||||
}
|
||||
|
||||
if (!this.a.getNavigation().m()) {
|
||||
this.a.aK = MathHelper.b(this.a.aK, this.a.aI, 75);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user