Remove useless setLockTick() method, minor code cleanup

This commit is contained in:
filoghost 2020-04-18 13:24:19 +02:00
parent e5936b423d
commit eae28963bc
38 changed files with 538 additions and 869 deletions

View File

@ -23,9 +23,6 @@ public interface NMSEntityBase {
// Returns the linked CraftHologramLine, all the entities are part of a piece. Should never be null.
public HologramLine getHologramLine();
// Sets if the entity should tick or not.
public void setLockTick(boolean lock);
// Returns if the entity is dead through NMS.
public boolean isDeadNMS();

View File

@ -36,7 +36,6 @@ import net.minecraft.server.v1_10_R1.World;
public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorStand {
private boolean lockTick;
private HologramLine parentPiece;
private String customName;
@ -55,6 +54,25 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
this.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
}
@Override
public void m() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
@ -140,32 +158,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
super.a(boundingBox);
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void m() {
if (!lockTick) {
super.m();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void a(SoundEffect soundeffect, float f, float f1) {
// Remove sounds.
@ -188,11 +180,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
return super.getCustomName();
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -46,7 +46,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "au");
private boolean lockTick;
private ItemLine parentPiece;
private ItemPickupManager itemPickupManager;
@ -61,6 +60,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
@Override
public void m() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
@ -84,10 +84,14 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
}
}
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
if (!lockTick) {
super.m();
}
// So it won't get removed.
ticksLived = 0;
}
// Method called when a player is near.
@ -153,20 +157,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
return false;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -42,7 +42,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "au");
private boolean lockTick;
private HologramLine parentPiece;
private int resendMountPacketTicks;
@ -58,17 +57,9 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
forceSetBoundingBox(new NullBoundingBox());
}
@Override
public void a(AxisAlignedBB boundingBox) {
// Do not change it!
}
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
super.a(boundingBox);
}
@Override
public void m() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
@ -92,10 +83,23 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
}
}
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
if (!lockTick) {
super.m();
}
// So it won't get removed.
ticksLived = 0;
}
@Override
public void a(AxisAlignedBB boundingBox) {
// Do not change it!
}
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
super.a(boundingBox);
}
@Override
@ -172,11 +176,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
// Remove sounds.
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -36,7 +36,6 @@ import net.minecraft.server.v1_11_R1.World;
public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorStand {
private boolean lockTick;
private HologramLine parentPiece;
private String customName;
@ -55,6 +54,25 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
this.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
}
@Override
public void A_() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
@ -109,32 +127,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
// Locks the custom name.
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void A_() {
if (!lockTick) {
super.A_();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void setCustomNameVisible(boolean visible) {
// Locks the custom name.
@ -188,11 +180,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
return super.getCustomName();
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -44,7 +44,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "au");
private boolean lockTick;
private ItemLine parentPiece;
private ItemPickupManager itemPickupManager;
@ -57,13 +56,18 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
@Override
public void A_() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
if (!lockTick) {
super.A_();
}
// So it won't get removed.
ticksLived = 0;
}
// Method called when a player is near.
@ -129,20 +133,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
return false;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -40,7 +40,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "au");
private boolean lockTick;
private HologramLine parentPiece;
public EntityNMSSlime(World world, HologramLine parentPiece) {
@ -54,6 +53,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
forceSetBoundingBox(new NullBoundingBox());
}
@Override
public void A_() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void a(AxisAlignedBB boundingBox) {
// Do not change it!
@ -63,17 +78,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
super.a(boundingBox);
}
@Override
public void A_() {
// So it won't get removed.
ticksLived = 0;
if (!lockTick) {
super.A_();
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
// Do not save NBT.
@ -132,15 +136,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
public boolean isCollidable() {
return false;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setCustomName(String customName) {
@ -157,11 +152,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
// Remove sounds.
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -36,7 +36,6 @@ import net.minecraft.server.v1_12_R1.World;
public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorStand {
private boolean lockTick;
private HologramLine parentPiece;
private String customName;
@ -55,6 +54,25 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
this.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
}
@Override
public void B_() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
@ -109,32 +127,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
// Locks the custom name.
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void B_() {
if (!lockTick) {
super.B_();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void setCustomNameVisible(boolean visible) {
// Locks the custom name.
@ -188,11 +180,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
return super.getCustomName();
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -44,7 +44,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "au");
private boolean lockTick;
private ItemLine parentPiece;
private ItemPickupManager itemPickupManager;
@ -57,13 +56,18 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
@Override
public void B_() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
if (!lockTick) {
super.B_();
}
// So it won't get removed.
ticksLived = 0;
}
// Method called when a player is near.
@ -129,20 +133,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
return false;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -40,7 +40,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "au");
private boolean lockTick;
private HologramLine parentPiece;
public EntityNMSSlime(World world, HologramLine parentPiece) {
@ -54,6 +53,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
forceSetBoundingBox(new NullBoundingBox());
}
@Override
public void B_() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void a(AxisAlignedBB boundingBox) {
// Do not change it!
@ -63,17 +78,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
super.a(boundingBox);
}
@Override
public void B_() {
// So it won't get removed.
ticksLived = 0;
if (!lockTick) {
super.B_();
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
// Do not save NBT.
@ -132,15 +136,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
public boolean isCollidable() {
return false;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setCustomName(String customName) {
@ -156,12 +151,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
public void a(SoundEffect soundeffect, float f, float f1) {
// Remove sounds.
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -39,7 +39,6 @@ import net.minecraft.server.v1_13_R1.World;
public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorStand {
private boolean lockTick;
private HologramLine parentPiece;
private String customName;
@ -58,6 +57,25 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
this.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
}
@Override
public void tick() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
@ -112,32 +130,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
// Locks the custom name.
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void tick() {
if (!lockTick) {
super.tick();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void setCustomNameVisible(boolean visible) {
// Locks the custom name.
@ -191,11 +183,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
return super.getCustomName();
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -44,7 +44,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "ax");
private boolean lockTick;
private ItemLine parentPiece;
private ItemPickupManager itemPickupManager;
@ -57,13 +56,18 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
@Override
public void tick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
if (!lockTick) {
super.tick();
}
// So it won't get removed.
ticksLived = 0;
}
// Method called when a player is near.
@ -128,21 +132,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
public boolean isCollidable() {
return false;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -40,8 +40,7 @@ import net.minecraft.server.v1_13_R1.World;
public class EntityNMSSlime extends EntitySlime implements NMSSlime {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "ax");
private boolean lockTick;
private HologramLine parentPiece;
public EntityNMSSlime(World world, HologramLine parentPiece) {
@ -55,6 +54,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
forceSetBoundingBox(new NullBoundingBox());
}
@Override
public void tick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void a(AxisAlignedBB boundingBox) {
// Do not change it!
@ -64,17 +79,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
super.a(boundingBox);
}
@Override
public void tick() {
// So it won't get removed.
ticksLived = 0;
if (!lockTick) {
super.tick();
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
// Do not save NBT.
@ -133,15 +137,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
public boolean isCollidable() {
return false;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
@ -158,11 +153,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
// Remove sounds.
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -39,7 +39,6 @@ import net.minecraft.server.v1_13_R2.World;
public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorStand {
private boolean lockTick;
private HologramLine parentPiece;
private String customName;
@ -58,6 +57,25 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
this.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
}
@Override
public void tick() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
@ -112,32 +130,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
// Locks the custom name.
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void tick() {
if (!lockTick) {
super.tick();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void setCustomNameVisible(boolean visible) {
// Locks the custom name.
@ -191,11 +183,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
return super.getCustomName();
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -44,7 +44,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "vehicle");
private boolean lockTick;
private ItemLine parentPiece;
private ItemPickupManager itemPickupManager;
@ -57,13 +56,18 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
@Override
public void tick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
if (!lockTick) {
super.tick();
}
// So it won't get removed.
ticksLived = 0;
}
// Method called when a player is near.
@ -129,20 +133,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
return false;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -41,7 +41,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "vehicle");
private boolean lockTick;
private HologramLine parentPiece;
public EntityNMSSlime(World world, HologramLine parentPiece) {
@ -55,6 +54,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
forceSetBoundingBox(new NullBoundingBox());
}
@Override
public void tick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void a(AxisAlignedBB boundingBox) {
// Do not change it!
@ -62,18 +77,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
super.a(boundingBox);
}
@Override
public void tick() {
// So it won't get removed.
ticksLived = 0;
if (!lockTick) {
super.tick();
}
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
@ -134,15 +138,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
return false;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
// Locks the custom name.
@ -158,11 +153,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
// Remove sounds.
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -40,7 +40,6 @@ import net.minecraft.server.v1_14_R1.World;
public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorStand {
private boolean lockTick;
private HologramLine parentPiece;
private CraftEntity customBukkitEntity;
private String customName;
@ -60,6 +59,25 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
this.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
}
@Override
public void tick() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
@ -114,32 +132,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
// Locks the custom name.
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void tick() {
if (!lockTick) {
super.tick();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void setCustomNameVisible(boolean visible) {
// Locks the custom name.
@ -192,12 +184,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
public Object getCustomNameObjectNMS() {
return super.getCustomName();
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -45,7 +45,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "vehicle");
private boolean lockTick;
private ItemLine parentPiece;
private ItemPickupManager itemPickupManager;
private CraftEntity customBukkitEntity;
@ -59,13 +58,18 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
@Override
public void tick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
if (!lockTick) {
super.tick();
}
// So it won't get removed.
ticksLived = 0;
}
// Method called when a player is near.
@ -131,20 +135,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
return false;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -42,7 +42,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "vehicle");
private boolean lockTick;
private HologramLine parentPiece;
private CraftEntity customBukkitEntity;
@ -57,6 +56,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
forceSetBoundingBox(new NullBoundingBox());
}
@Override
public void tick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void a(AxisAlignedBB boundingBox) {
// Do not change it!
@ -66,17 +81,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
super.a(boundingBox);
}
@Override
public void tick() {
// So it won't get removed.
ticksLived = 0;
if (!lockTick) {
super.tick();
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
// Do not save NBT.
@ -135,15 +139,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
public boolean isCollidable() {
return false;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
@ -160,11 +155,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
// Remove sounds.
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -23,7 +23,6 @@ import org.bukkit.craftbukkit.v1_15_R1.util.CraftChatMessage;
public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorStand {
private boolean lockTick;
private HologramLine parentPiece;
private CraftEntity customBukkitEntity;
private String customName;
@ -42,7 +41,26 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
this.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
}
@Override
public void tick() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
@ -97,32 +115,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
// Locks the custom name.
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void tick() {
if (!lockTick) {
super.tick();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void setCustomNameVisible(boolean visible) {
// Locks the custom name.
@ -176,11 +168,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
return super.getCustomName();
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -32,7 +32,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "vehicle");
private boolean lockTick;
private ItemLine parentPiece;
private ItemPickupManager itemPickupManager;
private CraftEntity customBukkitEntity;
@ -46,14 +45,19 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
@Override
public void tick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
if (!lockTick) {
super.tick();
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
// Method called when a player is near.
@Override
@ -117,21 +121,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
public boolean isCollidable() {
return false;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -42,7 +42,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "vehicle");
private boolean lockTick;
private HologramLine parentPiece;
private CraftEntity customBukkitEntity;
@ -57,6 +56,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
forceSetBoundingBox(new NullBoundingBox());
}
@Override
public void tick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void a(AxisAlignedBB boundingBox) {
// Do not change it!
@ -66,17 +81,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
super.a(boundingBox);
}
@Override
public void tick() {
// So it won't get removed.
ticksLived = 0;
if (!lockTick) {
super.tick();
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
// Do not save NBT.
@ -135,15 +139,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
public boolean isCollidable() {
return false;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
@ -160,11 +155,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
// Remove sounds.
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -40,7 +40,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
private static final ReflectField<Integer> DISABLED_SLOTS_FIELD = new ReflectField<>(EntityArmorStand.class, "bi");
private static final ReflectMethod<Void> SET_MARKER_METHOD = new ReflectMethod<>(EntityArmorStand.class, "n", boolean.class);
private boolean lockTick;
private HologramLine parentPiece;
private String customName;
@ -68,6 +67,25 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
this.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
}
@Override
public void t_() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
@ -138,32 +156,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
super.a(boundingBox);
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void t_() {
if (!lockTick) {
super.t_();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void makeSound(String sound, float f1, float f2) {
// Remove sounds.
@ -186,15 +178,9 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
return super.getCustomName();
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
setLockTick(false);
super.die();
// Prevent being killed.
}
@Override
@ -207,7 +193,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
@Override
public void killEntityNMS() {
die();
super.dead = true;
}
@Override

View File

@ -45,7 +45,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
private static final ReflectField<Double> RIDER_PITCH_DELTA = new ReflectField<>(Entity.class, "ar");
private static final ReflectField<Double> RIDER_YAW_DELTA = new ReflectField<>(Entity.class, "as");
private boolean lockTick;
private ItemLine parentPiece;
private ItemPickupManager itemPickupManager;
@ -58,13 +57,18 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
@Override
public void t_() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
if (!lockTick) {
super.t_();
}
// So it won't get removed.
ticksLived = 0;
}
// Method called when a player is near.
@ -113,25 +117,10 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
*/
return true;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
setLockTick(false);
super.die();
// Prevent being killed.
}
@Override
@ -156,7 +145,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
@Override
public void killEntityNMS() {
die();
super.dead = true;
}
@Override

View File

@ -40,7 +40,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
private static final ReflectField<Double> RIDER_PITCH_DELTA = new ReflectField<>(Entity.class, "ar");
private static final ReflectField<Double> RIDER_YAW_DELTA = new ReflectField<>(Entity.class, "as");
private boolean lockTick;
private HologramLine parentPiece;
public EntityNMSSlime(World world, HologramLine parentPiece) {
@ -53,6 +52,27 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
forceSetBoundingBox(new NullBoundingBox());
}
@Override
public void t_() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
// The slime dies without a vehicle.
if (this.vehicle == null) {
killEntityNMS();
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void a(AxisAlignedBB boundingBox) {
// Do not change it!
@ -62,21 +82,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
super.a(boundingBox);
}
@Override
public void t_() {
// Checks every 20 ticks.
if (ticksLived % 20 == 0) {
// The slime dies without a vehicle.
if (this.vehicle == null) {
die();
}
}
if (!lockTick) {
super.t_();
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
// Do not save NBT.
@ -135,15 +140,9 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
// Remove sounds.
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
setLockTick(false);
super.die();
// Prevent being killed.
}
@Override
@ -161,7 +160,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
@Override
public void killEntityNMS() {
die();
super.dead = true;
}
@Override

View File

@ -40,7 +40,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
private static final ReflectField<Integer> DISABLED_SLOTS_FIELD = new ReflectField<>(EntityArmorStand.class, "bi");
private static final ReflectMethod<Void> SET_MARKER_METHOD = new ReflectMethod<>(EntityArmorStand.class, "n", boolean.class);
private boolean lockTick;
private HologramLine parentPiece;
private String customName;
@ -68,6 +67,25 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
this.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
}
@Override
public void t_() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
@ -138,32 +156,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
super.a(boundingBox);
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void t_() {
if (!lockTick) {
super.t_();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void makeSound(String sound, float f1, float f2) {
// Remove sounds.
@ -186,15 +178,9 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
return super.getCustomName();
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
setLockTick(false);
super.die();
// Prevent being killed.
}
@Override
@ -207,7 +193,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
@Override
public void killEntityNMS() {
die();
super.dead = true;
}
@Override

View File

@ -45,7 +45,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
private static final ReflectField<Double> RIDER_PITCH_DELTA = new ReflectField<>(Entity.class, "ar");
private static final ReflectField<Double> RIDER_YAW_DELTA = new ReflectField<>(Entity.class, "as");
private boolean lockTick;
private ItemLine parentPiece;
private ItemPickupManager itemPickupManager;
@ -58,13 +57,18 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
@Override
public void t_() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
if (!lockTick) {
super.t_();
}
// So it won't get removed.
ticksLived = 0;
}
// Method called when a player is near.
@ -114,24 +118,9 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
return true;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
setLockTick(false);
super.die();
// Prevent being killed.
}
@Override
@ -156,7 +145,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
@Override
public void killEntityNMS() {
die();
super.dead = true;
}
@Override

View File

@ -40,7 +40,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
private static final ReflectField<Double> RIDER_PITCH_DELTA = new ReflectField<>(Entity.class, "ar");
private static final ReflectField<Double> RIDER_YAW_DELTA = new ReflectField<>(Entity.class, "as");
private boolean lockTick;
private HologramLine parentPiece;
public EntityNMSSlime(World world, HologramLine parentPiece) {
@ -53,6 +52,27 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
forceSetBoundingBox(new NullBoundingBox());
}
@Override
public void t_() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
// The slime dies without a vehicle.
if (this.vehicle == null) {
killEntityNMS();
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
}
@Override
public void a(AxisAlignedBB boundingBox) {
// Do not change it!
@ -62,21 +82,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
super.a(boundingBox);
}
@Override
public void t_() {
// Checks every 20 ticks.
if (ticksLived % 20 == 0) {
// The slime dies without a vehicle.
if (this.vehicle == null) {
die();
}
}
if (!lockTick) {
super.t_();
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
// Do not save NBT.
@ -135,15 +140,9 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
// Remove sounds.
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
setLockTick(false);
super.die();
// Prevent being killed.
}
@Override
@ -161,7 +160,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
@Override
public void killEntityNMS() {
die();
super.dead = true;
}
@Override

View File

@ -39,7 +39,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
private static final ReflectField<Integer> DISABLED_SLOTS_FIELD = new ReflectField<>(EntityArmorStand.class, "bz");
private boolean lockTick;
private HologramLine parentPiece;
private String customName;
@ -63,6 +62,25 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
this.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
}
@Override
public void m() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
@ -148,32 +166,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
super.a(boundingBox);
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void m() {
if (!lockTick) {
super.m();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void a(SoundEffect soundeffect, float f, float f1) {
// Remove sounds.
@ -196,11 +188,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
return super.getCustomName();
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -46,7 +46,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "as");
private boolean lockTick;
private ItemLine parentPiece;
private ItemPickupManager itemPickupManager;
@ -61,6 +60,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
@Override
public void m() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
@ -84,10 +84,14 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
}
}
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
if (!lockTick) {
super.m();
}
// So it won't get removed.
ticksLived = 0;
}
// Method called when a player is near.
@ -152,20 +156,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
return false;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -42,7 +42,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "as");
private boolean lockTick;
private HologramLine parentPiece;
private int resendMountPacketTicks;
@ -57,17 +56,9 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
forceSetBoundingBox(new NullBoundingBox());
}
@Override
public void a(AxisAlignedBB boundingBox) {
// Do not change it!
}
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
super.a(boundingBox);
}
@Override
public void m() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
@ -91,10 +82,23 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
}
}
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
if (!lockTick) {
super.m();
}
// So it won't get removed.
ticksLived = 0;
}
@Override
public void a(AxisAlignedBB boundingBox) {
// Do not change it!
}
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
super.a(boundingBox);
}
@Override
@ -170,11 +174,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
// Remove sounds.
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -36,7 +36,6 @@ import net.minecraft.server.v1_9_R2.World;
public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorStand {
private boolean lockTick;
private HologramLine parentPiece;
private String customName;
@ -54,6 +53,25 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
this.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
}
@Override
public void m() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void b(NBTTagCompound nbttagcompound) {
@ -140,32 +158,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
super.a(boundingBox);
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void m() {
if (!lockTick) {
super.m();
}
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
if (this.onGround) {
this.onGround = false;
}
}
@Override
public void a(SoundEffect soundeffect, float f, float f1) {
// Remove sounds.
@ -188,11 +180,6 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
return super.getCustomName();
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -46,7 +46,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "at");
private boolean lockTick;
private ItemLine parentPiece;
private ItemPickupManager itemPickupManager;
@ -61,6 +60,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
@Override
public void m() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
@ -84,10 +84,14 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
}
}
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
if (!lockTick) {
super.m();
}
// So it won't get removed.
ticksLived = 0;
}
// Method called when a player is near.
@ -153,20 +157,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
return false;
}
@Override
public void inactiveTick() {
// Check inactive ticks.
if (!lockTick) {
super.inactiveTick();
}
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -42,7 +42,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
private static final ReflectField<Entity> VEHICLE_FIELD = new ReflectField<>(Entity.class, "at");
private boolean lockTick;
private HologramLine parentPiece;
private int resendMountPacketTicks;
@ -57,17 +56,9 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
forceSetBoundingBox(new NullBoundingBox());
}
@Override
public void a(AxisAlignedBB boundingBox) {
// Do not change it!
}
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
super.a(boundingBox);
}
@Override
public void m() {
// Disable normal ticking for this entity.
// So it won't get removed.
ticksLived = 0;
@ -91,10 +82,23 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
}
}
}
}
@Override
public void inactiveTick() {
// Disable normal ticking for this entity.
if (!lockTick) {
super.m();
}
// So it won't get removed.
ticksLived = 0;
}
@Override
public void a(AxisAlignedBB boundingBox) {
// Do not change it!
}
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
super.a(boundingBox);
}
@Override
@ -171,11 +175,6 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
// Remove sounds.
}
@Override
public void setLockTick(boolean lock) {
lockTick = lock;
}
@Override
public void die() {
// Prevent being killed.

View File

@ -20,6 +20,7 @@ import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.GameMode;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
@ -77,7 +78,7 @@ public class MainListener implements Listener, ItemPickupManager {
@EventHandler (priority = EventPriority.MONITOR)
public void onChunkLoad(ChunkLoadEvent event) {
final Chunk chunk = event.getChunk();
Chunk chunk = event.getChunk();
// Other plugins could call this event wrongly, check if the chunk is actually loaded.
if (chunk.isLoaded()) {
@ -126,37 +127,38 @@ public class MainListener implements Listener, ItemPickupManager {
@EventHandler (priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSlimeInteract(PlayerInteractEntityEvent event) {
if (event.getRightClicked().getType() == EntityType.SLIME) {
Player clicker = event.getPlayer();
NMSEntityBase entityBase = nmsManager.getNMSEntityBase(event.getRightClicked());
if (entityBase != null && entityBase.getHologramLine() instanceof CraftTouchSlimeLine && !isSpectatorMode(clicker)) {
CraftTouchSlimeLine touchSlime = (CraftTouchSlimeLine) entityBase.getHologramLine();
if (touchSlime.getTouchablePiece().getTouchHandler() != null && touchSlime.getParent().getVisibilityManager().isVisibleTo(clicker)) {
Long lastClick = anticlickSpam.get(clicker);
if (lastClick != null && System.currentTimeMillis() - lastClick.longValue() < 100) {
return;
}
anticlickSpam.put(event.getPlayer(), System.currentTimeMillis());
try {
touchSlime.getTouchablePiece().getTouchHandler().onTouch(event.getPlayer());
} catch (Throwable t) {
Plugin plugin = touchSlime.getParent() instanceof PluginHologram ? ((PluginHologram) touchSlime.getParent()).getOwner() : HolographicDisplays.getInstance();
ConsoleLogger.log(Level.WARNING, "The plugin " + plugin.getName() + " generated an exception when the player " + event.getPlayer().getName() + " touched a hologram.", t);
}
}
}
if (event.getRightClicked().getType() != EntityType.SLIME) {
return;
}
Player clicker = event.getPlayer();
if (clicker.getGameMode() == GameMode.SPECTATOR) {
return;
}
NMSEntityBase entityBase = nmsManager.getNMSEntityBase(event.getRightClicked());
if (entityBase == null || !(entityBase.getHologramLine() instanceof CraftTouchSlimeLine)) {
return;
}
CraftTouchSlimeLine touchSlime = (CraftTouchSlimeLine) entityBase.getHologramLine();
if (touchSlime.getTouchablePiece().getTouchHandler() == null || !touchSlime.getParent().getVisibilityManager().isVisibleTo(clicker)) {
return;
}
Long lastClick = anticlickSpam.get(clicker);
if (lastClick != null && System.currentTimeMillis() - lastClick.longValue() < 100) {
return;
}
anticlickSpam.put(event.getPlayer(), System.currentTimeMillis());
try {
touchSlime.getTouchablePiece().getTouchHandler().onTouch(event.getPlayer());
} catch (Throwable t) {
Plugin plugin = touchSlime.getParent() instanceof PluginHologram ? ((PluginHologram) touchSlime.getParent()).getOwner() : HolographicDisplays.getInstance();
ConsoleLogger.log(Level.WARNING, "The plugin " + plugin.getName() + " generated an exception when the player " + event.getPlayer().getName() + " touched a hologram.", t);
}
}
public boolean isSpectatorMode(Player player) {
return player.getGameMode().toString().equals("SPECTATOR");
}
@Override

View File

@ -90,9 +90,6 @@ public class CraftItemLine extends CraftTouchableLine implements ItemLine {
nmsVehicle = HolographicDisplays.getNMSManager().spawnNMSArmorStand(world, x, y + offset, z, this, HolographicDisplays.hasProtocolLibHook());
nmsItem.setPassengerOfNMS(nmsVehicle);
nmsItem.setLockTick(true);
nmsVehicle.setLockTick(true);
}
}

View File

@ -104,8 +104,6 @@ public class CraftTextLine extends CraftTouchableLine implements TextLine {
if (text != null && !text.isEmpty()) {
nmsNameable.setCustomNameNMS(text);
}
nmsNameable.setLockTick(true);
}

View File

@ -55,9 +55,6 @@ public class CraftTouchSlimeLine extends CraftHologramLine {
nmsVehicle = HolographicDisplays.getNMSManager().spawnNMSArmorStand(world, x, y + offset, z, this, HolographicDisplays.hasProtocolLibHook());
nmsSlime.setPassengerOfNMS(nmsVehicle);
nmsSlime.setLockTick(true);
nmsVehicle.setLockTick(true);
}