Use armor stands for holograms
This commit is contained in:
parent
d8b7a37543
commit
f88c2771a8
|
@ -94,7 +94,6 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
|||
private Settings config;
|
||||
private boolean enabled;
|
||||
private LocationLookup locationLookup;
|
||||
|
||||
private final NMSHelper nmsHelper = new NMSHelper() {
|
||||
private boolean SUPPORT_OWNER_PROFILE = true;
|
||||
|
||||
|
|
|
@ -23,8 +23,6 @@ import net.citizensnpcs.api.trait.TraitName;
|
|||
*/
|
||||
@TraitName("followtrait")
|
||||
public class FollowTrait extends Trait {
|
||||
@Persist("active")
|
||||
private boolean enabled = false;
|
||||
private Entity entity;
|
||||
private Flocker flock;
|
||||
@Persist
|
||||
|
@ -44,11 +42,11 @@ public class FollowTrait extends Trait {
|
|||
* Returns whether the trait is actively following a {@link Entity}.
|
||||
*/
|
||||
public boolean isActive() {
|
||||
return enabled && npc.isSpawned() && entity != null;
|
||||
return npc.isSpawned() && entity != null;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
return followingUUID != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -119,15 +117,12 @@ public class FollowTrait extends Trait {
|
|||
*/
|
||||
public boolean toggle(Entity entity, boolean protect) {
|
||||
this.protect = protect;
|
||||
if (entity.getUniqueId().equals(this.followingUUID) || this.followingUUID == null) {
|
||||
this.enabled = !enabled;
|
||||
}
|
||||
this.followingUUID = entity.getUniqueId();
|
||||
this.followingUUID = entity.getUniqueId().equals(followingUUID) ? null : entity.getUniqueId();
|
||||
if (npc.getNavigator().isNavigating() && this.entity != null && npc.getNavigator().getEntityTarget() != null
|
||||
&& this.entity == npc.getNavigator().getEntityTarget().getTarget()) {
|
||||
npc.getNavigator().cancelNavigation();
|
||||
}
|
||||
this.entity = null;
|
||||
return this.enabled;
|
||||
return followingUUID != null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class HologramTrait extends Trait {
|
|||
private NPC nameNPC;
|
||||
private final NPCRegistry registry = CitizensAPI.createCitizensBackedNPCRegistry(new MemoryNPCDataStore());
|
||||
private int t;
|
||||
private boolean useTextDisplay = SUPPORTS_TEXT_DISPLAY;
|
||||
private boolean useTextDisplay;
|
||||
|
||||
public HologramTrait() {
|
||||
super("hologramtrait");
|
||||
|
@ -269,7 +269,7 @@ public class HologramTrait extends Trait {
|
|||
}
|
||||
|
||||
if (currentLoc == null) {
|
||||
currentLoc = npc.getStoredLocation();
|
||||
currentLoc = npc.getStoredLocation().clone();
|
||||
}
|
||||
|
||||
boolean nameplateVisible = Boolean
|
||||
|
@ -392,7 +392,6 @@ public class HologramTrait extends Trait {
|
|||
*/
|
||||
public void setLineHeight(double height) {
|
||||
lineHeight = height;
|
||||
|
||||
reloadLineHolograms();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.citizensnpcs.nms.v1_10_R1.entity;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEnderDragon;
|
||||
|
@ -211,9 +213,26 @@ public class EnderDragonController extends MobEntityController {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, false)) {
|
||||
try {
|
||||
KNOCKBACK.invoke(this, this.world.getEntities(this,
|
||||
children[6].getBoundingBox().grow(4.0, 2.0, 4.0).c(0.0, -2.0, 0.0)));
|
||||
KNOCKBACK.invoke(this, this.world.getEntities(this,
|
||||
children[7].getBoundingBox().grow(4.0, 2.0, 4.0).c(0.0, -2.0, 0.0)));
|
||||
HURT.invoke(this, this.world.getEntities(this, children[0].getBoundingBox().g(1.0)));
|
||||
HURT.invoke(this, this.world.getEntities(this, children[1].getBoundingBox().g(1.0)));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.n();
|
||||
}
|
||||
}
|
||||
|
||||
private static final MethodHandle HURT = NMS.getMethodHandle(EntityEnderDragon.class, "b", true,
|
||||
java.util.List.class);
|
||||
private static final MethodHandle KNOCKBACK = NMS.getMethodHandle(EntityEnderDragon.class, "a", true,
|
||||
java.util.List.class);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package net.citizensnpcs.nms.v1_10_R1.entity;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -20,7 +21,6 @@ import com.mojang.authlib.GameProfile;
|
|||
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.npc.NPC.NPCUpdate;
|
||||
import net.citizensnpcs.api.trait.trait.Inventory;
|
||||
|
@ -58,6 +58,7 @@ import net.minecraft.server.v1_10_R1.NavigationAbstract;
|
|||
import net.minecraft.server.v1_10_R1.NetworkManager;
|
||||
import net.minecraft.server.v1_10_R1.Packet;
|
||||
import net.minecraft.server.v1_10_R1.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_10_R1.PacketPlayOutUpdateAttributes;
|
||||
import net.minecraft.server.v1_10_R1.PathType;
|
||||
import net.minecraft.server.v1_10_R1.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_10_R1.SoundEffect;
|
||||
|
@ -172,8 +173,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
Vector vector = Util.callPushEvent(npc, x, y, z);
|
||||
|
@ -402,6 +401,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
private void updatePackets(boolean navigating) {
|
||||
if (!npc.isUpdating(NPCUpdate.PACKET))
|
||||
return;
|
||||
|
||||
updateEffects = true;
|
||||
boolean itemChanged = false;
|
||||
for (EnumItemSlot slot : EnumItemSlot.values()) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.citizensnpcs.nms.v1_11_R1.entity;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEnderDragon;
|
||||
|
@ -20,6 +22,7 @@ import net.minecraft.server.v1_11_R1.DamageSource;
|
|||
import net.minecraft.server.v1_11_R1.DragonControllerPhase;
|
||||
import net.minecraft.server.v1_11_R1.Entity;
|
||||
import net.minecraft.server.v1_11_R1.EntityEnderDragon;
|
||||
import net.minecraft.server.v1_11_R1.IEntitySelector;
|
||||
import net.minecraft.server.v1_11_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_11_R1.SoundEffect;
|
||||
import net.minecraft.server.v1_11_R1.Vec3D;
|
||||
|
@ -212,9 +215,28 @@ public class EnderDragonController extends MobEntityController {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, false)) {
|
||||
try {
|
||||
KNOCKBACK.invoke(this, this.world.getEntities(this,
|
||||
children[6].getBoundingBox().grow(4.0, 2.0, 4.0).d(0.0, -2.0, 0.0), IEntitySelector.e));
|
||||
KNOCKBACK.invoke(this, this.world.getEntities(this,
|
||||
children[7].getBoundingBox().grow(4.0, 2.0, 4.0).d(0.0, -2.0, 0.0), IEntitySelector.e));
|
||||
HURT.invoke(this,
|
||||
this.world.getEntities(this, children[0].getBoundingBox().g(1.0), IEntitySelector.e));
|
||||
HURT.invoke(this,
|
||||
this.world.getEntities(this, children[1].getBoundingBox().g(1.0), IEntitySelector.e));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.n();
|
||||
}
|
||||
}
|
||||
|
||||
private static final MethodHandle HURT = NMS.getMethodHandle(EntityEnderDragon.class, "b", true,
|
||||
java.util.List.class);
|
||||
private static final MethodHandle KNOCKBACK = NMS.getMethodHandle(EntityEnderDragon.class, "a", true,
|
||||
java.util.List.class);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package net.citizensnpcs.nms.v1_11_R1.entity;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -20,7 +21,6 @@ import com.mojang.authlib.GameProfile;
|
|||
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.npc.NPC.NPCUpdate;
|
||||
import net.citizensnpcs.api.trait.trait.Inventory;
|
||||
|
@ -60,6 +60,7 @@ import net.minecraft.server.v1_11_R1.NavigationAbstract;
|
|||
import net.minecraft.server.v1_11_R1.NetworkManager;
|
||||
import net.minecraft.server.v1_11_R1.Packet;
|
||||
import net.minecraft.server.v1_11_R1.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_11_R1.PacketPlayOutUpdateAttributes;
|
||||
import net.minecraft.server.v1_11_R1.PathType;
|
||||
import net.minecraft.server.v1_11_R1.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_11_R1.SoundEffect;
|
||||
|
@ -186,8 +187,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
Vector vector = Util.callPushEvent(npc, x, y, z);
|
||||
|
@ -413,6 +412,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
private void updatePackets(boolean navigating) {
|
||||
if (!npc.isUpdating(NPCUpdate.PACKET))
|
||||
return;
|
||||
|
||||
updateEffects = true;
|
||||
boolean itemChanged = false;
|
||||
for (EnumItemSlot slot : EnumItemSlot.values()) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.citizensnpcs.nms.v1_12_R1.entity;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEnderDragon;
|
||||
|
@ -20,6 +22,7 @@ import net.minecraft.server.v1_12_R1.DamageSource;
|
|||
import net.minecraft.server.v1_12_R1.DragonControllerPhase;
|
||||
import net.minecraft.server.v1_12_R1.Entity;
|
||||
import net.minecraft.server.v1_12_R1.EntityEnderDragon;
|
||||
import net.minecraft.server.v1_12_R1.IEntitySelector;
|
||||
import net.minecraft.server.v1_12_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_12_R1.SoundEffect;
|
||||
import net.minecraft.server.v1_12_R1.Vec3D;
|
||||
|
@ -212,9 +215,28 @@ public class EnderDragonController extends MobEntityController {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, false)) {
|
||||
try {
|
||||
KNOCKBACK.invoke(this, this.world.getEntities(this,
|
||||
children[6].getBoundingBox().grow(4.0, 2.0, 4.0).d(0.0, -2.0, 0.0), IEntitySelector.e));
|
||||
KNOCKBACK.invoke(this, this.world.getEntities(this,
|
||||
children[7].getBoundingBox().grow(4.0, 2.0, 4.0).d(0.0, -2.0, 0.0), IEntitySelector.e));
|
||||
HURT.invoke(this,
|
||||
this.world.getEntities(this, children[0].getBoundingBox().g(1.0), IEntitySelector.e));
|
||||
HURT.invoke(this,
|
||||
this.world.getEntities(this, children[1].getBoundingBox().g(1.0), IEntitySelector.e));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.n();
|
||||
}
|
||||
}
|
||||
|
||||
private static final MethodHandle HURT = NMS.getMethodHandle(EntityEnderDragon.class, "b", true,
|
||||
java.util.List.class);
|
||||
private static final MethodHandle KNOCKBACK = NMS.getMethodHandle(EntityEnderDragon.class, "a", true,
|
||||
java.util.List.class);
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package net.citizensnpcs.nms.v1_12_R1.entity;
|
|||
import java.io.IOException;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.net.Socket;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -21,7 +22,6 @@ import com.mojang.authlib.GameProfile;
|
|||
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.npc.NPC.NPCUpdate;
|
||||
import net.citizensnpcs.api.trait.trait.Inventory;
|
||||
|
@ -64,6 +64,7 @@ import net.minecraft.server.v1_12_R1.NavigationAbstract;
|
|||
import net.minecraft.server.v1_12_R1.NetworkManager;
|
||||
import net.minecraft.server.v1_12_R1.Packet;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayOutUpdateAttributes;
|
||||
import net.minecraft.server.v1_12_R1.PathType;
|
||||
import net.minecraft.server.v1_12_R1.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_12_R1.SoundEffect;
|
||||
|
@ -205,8 +206,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
Vector vector = Util.callPushEvent(npc, x, y, z);
|
||||
|
@ -439,6 +438,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
private void updatePackets(boolean navigating) {
|
||||
if (!npc.isUpdating(NPCUpdate.PACKET))
|
||||
return;
|
||||
|
||||
updateEffects = true;
|
||||
boolean itemChanged = false;
|
||||
for (EnumItemSlot slot : EnumItemSlot.values()) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.citizensnpcs.nms.v1_13_R2.entity;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -25,6 +26,7 @@ import net.minecraft.server.v1_13_R2.EntityBoat;
|
|||
import net.minecraft.server.v1_13_R2.EntityEnderDragon;
|
||||
import net.minecraft.server.v1_13_R2.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_13_R2.FluidType;
|
||||
import net.minecraft.server.v1_13_R2.IEntitySelector;
|
||||
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
||||
import net.minecraft.server.v1_13_R2.SoundEffect;
|
||||
import net.minecraft.server.v1_13_R2.Tag;
|
||||
|
@ -223,6 +225,20 @@ public class EnderDragonController extends MobEntityController {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, false)) {
|
||||
try {
|
||||
KNOCKBACK.invoke(this, this.world.getEntities(this,
|
||||
children[6].getBoundingBox().grow(4.0, 2.0, 4.0).d(0.0, -2.0, 0.0), IEntitySelector.e));
|
||||
KNOCKBACK.invoke(this, this.world.getEntities(this,
|
||||
children[7].getBoundingBox().grow(4.0, 2.0, 4.0).d(0.0, -2.0, 0.0), IEntitySelector.e));
|
||||
HURT.invoke(this,
|
||||
this.world.getEntities(this, children[0].getBoundingBox().g(1.0), IEntitySelector.e));
|
||||
HURT.invoke(this,
|
||||
this.world.getEntities(this, children[1].getBoundingBox().g(1.0), IEntitySelector.e));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
super.movementTick();
|
||||
|
@ -244,6 +260,10 @@ public class EnderDragonController extends MobEntityController {
|
|||
return super.n(entity);
|
||||
}
|
||||
|
||||
private static final MethodHandle HURT = NMS.getMethodHandle(EntityEnderDragon.class, "b", true,
|
||||
java.util.List.class);
|
||||
private static final MethodHandle KNOCKBACK = NMS.getMethodHandle(EntityEnderDragon.class, "a", true,
|
||||
java.util.List.class);
|
||||
private static final Method MOVEMENT_TICK = NMS.getMethod(EntityEnderDragon.class, "k", false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.citizensnpcs.nms.v1_13_R2.entity;
|
|||
import java.io.IOException;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.net.Socket;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -21,7 +22,6 @@ import com.mojang.authlib.GameProfile;
|
|||
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.npc.NPC.NPCUpdate;
|
||||
import net.citizensnpcs.api.trait.trait.Inventory;
|
||||
|
@ -64,6 +64,7 @@ import net.minecraft.server.v1_13_R2.NavigationAbstract;
|
|||
import net.minecraft.server.v1_13_R2.NetworkManager;
|
||||
import net.minecraft.server.v1_13_R2.Packet;
|
||||
import net.minecraft.server.v1_13_R2.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_13_R2.PacketPlayOutUpdateAttributes;
|
||||
import net.minecraft.server.v1_13_R2.PathType;
|
||||
import net.minecraft.server.v1_13_R2.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_13_R2.SoundEffect;
|
||||
|
@ -193,8 +194,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
}, 35); // give enough time for death and smoke animation
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
Vector vector = Util.callPushEvent(npc, x, y, z);
|
||||
|
@ -430,6 +429,8 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
private void updatePackets(boolean navigating) {
|
||||
if (!npc.isUpdating(NPCUpdate.PACKET))
|
||||
return;
|
||||
|
||||
|
||||
updateEffects = true;
|
||||
boolean itemChanged = false;
|
||||
for (EnumItemSlot slot : EnumItemSlot.values()) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.citizensnpcs.nms.v1_14_R1.entity;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEnderDragon;
|
||||
|
@ -24,6 +26,7 @@ import net.minecraft.server.v1_14_R1.EntityEnderDragon;
|
|||
import net.minecraft.server.v1_14_R1.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_14_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_14_R1.FluidType;
|
||||
import net.minecraft.server.v1_14_R1.IEntitySelector;
|
||||
import net.minecraft.server.v1_14_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_14_R1.SoundEffect;
|
||||
import net.minecraft.server.v1_14_R1.Tag;
|
||||
|
@ -220,6 +223,20 @@ public class EnderDragonController extends MobEntityController {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, false)) {
|
||||
try {
|
||||
KNOCKBACK.invoke(this, this.world.getEntities(this,
|
||||
children[6].getBoundingBox().grow(4.0, 2.0, 4.0).d(0.0, -2.0, 0.0), IEntitySelector.e));
|
||||
KNOCKBACK.invoke(this, this.world.getEntities(this,
|
||||
children[7].getBoundingBox().grow(4.0, 2.0, 4.0).d(0.0, -2.0, 0.0), IEntitySelector.e));
|
||||
HURT.invoke(this,
|
||||
this.world.getEntities(this, children[0].getBoundingBox().g(1.0), IEntitySelector.e));
|
||||
HURT.invoke(this,
|
||||
this.world.getEntities(this, children[1].getBoundingBox().g(1.0), IEntitySelector.e));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.movementTick();
|
||||
}
|
||||
|
@ -232,5 +249,10 @@ public class EnderDragonController extends MobEntityController {
|
|||
}
|
||||
return super.n(entity);
|
||||
}
|
||||
|
||||
private static final MethodHandle HURT = NMS.getMethodHandle(EntityEnderDragon.class, "b", true,
|
||||
java.util.List.class);
|
||||
private static final MethodHandle KNOCKBACK = NMS.getMethodHandle(EntityEnderDragon.class, "a", true,
|
||||
java.util.List.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.citizensnpcs.nms.v1_14_R1.entity;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -20,7 +21,6 @@ import com.mojang.authlib.GameProfile;
|
|||
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.npc.NPC.NPCUpdate;
|
||||
import net.citizensnpcs.api.trait.trait.Inventory;
|
||||
|
@ -62,6 +62,7 @@ import net.minecraft.server.v1_14_R1.NavigationAbstract;
|
|||
import net.minecraft.server.v1_14_R1.NetworkManager;
|
||||
import net.minecraft.server.v1_14_R1.Packet;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayOutUpdateAttributes;
|
||||
import net.minecraft.server.v1_14_R1.PathType;
|
||||
import net.minecraft.server.v1_14_R1.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_14_R1.SoundEffect;
|
||||
|
@ -182,8 +183,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
Vector vector = Util.callPushEvent(npc, x, y, z);
|
||||
|
@ -435,6 +434,8 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
private void updatePackets(boolean navigating) {
|
||||
if (!npc.isUpdating(NPCUpdate.PACKET))
|
||||
return;
|
||||
|
||||
|
||||
updateEffects = true;
|
||||
boolean itemChanged = false;
|
||||
for (EnumItemSlot slot : EnumItemSlot.values()) {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package net.citizensnpcs.nms.v1_15_R1.entity;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEnderDragon;
|
||||
|
@ -25,6 +28,7 @@ import net.minecraft.server.v1_15_R1.EntityEnderDragon;
|
|||
import net.minecraft.server.v1_15_R1.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_15_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_15_R1.FluidType;
|
||||
import net.minecraft.server.v1_15_R1.IEntitySelector;
|
||||
import net.minecraft.server.v1_15_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_15_R1.SoundEffect;
|
||||
import net.minecraft.server.v1_15_R1.Tag;
|
||||
|
@ -213,6 +217,20 @@ public class EnderDragonController extends MobEntityController {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, false)) {
|
||||
try {
|
||||
KNOCKBACK.invoke(this, this.world.getEntities(this,
|
||||
children[6].getBoundingBox().grow(4.0, 2.0, 4.0).d(0.0, -2.0, 0.0), IEntitySelector.e));
|
||||
KNOCKBACK.invoke(this, this.world.getEntities(this,
|
||||
children[7].getBoundingBox().grow(4.0, 2.0, 4.0).d(0.0, -2.0, 0.0), IEntitySelector.e));
|
||||
HURT.invoke(this,
|
||||
this.world.getEntities(this, children[0].getBoundingBox().g(1.0), IEntitySelector.e));
|
||||
HURT.invoke(this,
|
||||
this.world.getEntities(this, children[1].getBoundingBox().g(1.0), IEntitySelector.e));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.movementTick();
|
||||
}
|
||||
|
@ -225,5 +243,9 @@ public class EnderDragonController extends MobEntityController {
|
|||
}
|
||||
return super.n(entity);
|
||||
}
|
||||
|
||||
private static final MethodHandle HURT = NMS.getMethodHandle(EntityEnderDragon.class, "b", true, List.class);
|
||||
private static final MethodHandle KNOCKBACK = NMS.getMethodHandle(EntityEnderDragon.class, "a", true,
|
||||
List.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.citizensnpcs.nms.v1_15_R1.entity;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -19,7 +20,6 @@ import com.mojang.authlib.GameProfile;
|
|||
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.npc.NPC.NPCUpdate;
|
||||
import net.citizensnpcs.api.trait.trait.Inventory;
|
||||
|
@ -61,6 +61,7 @@ import net.minecraft.server.v1_15_R1.NavigationAbstract;
|
|||
import net.minecraft.server.v1_15_R1.NetworkManager;
|
||||
import net.minecraft.server.v1_15_R1.Packet;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutUpdateAttributes;
|
||||
import net.minecraft.server.v1_15_R1.PathType;
|
||||
import net.minecraft.server.v1_15_R1.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_15_R1.SoundEffect;
|
||||
|
@ -182,8 +183,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public CraftPlayer getBukkitEntity() {
|
||||
if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) {
|
||||
|
@ -434,6 +433,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
private void updatePackets(boolean navigating) {
|
||||
if (!npc.isUpdating(NPCUpdate.PACKET))
|
||||
return;
|
||||
|
||||
updateEffects = true;
|
||||
boolean itemChanged = false;
|
||||
for (EnumItemSlot slot : EnumItemSlot.values()) {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package net.citizensnpcs.nms.v1_16_R3.entity;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_16_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEnderDragon;
|
||||
|
@ -25,6 +28,7 @@ import net.minecraft.server.v1_16_R3.EntityEnderDragon;
|
|||
import net.minecraft.server.v1_16_R3.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_16_R3.EntityTypes;
|
||||
import net.minecraft.server.v1_16_R3.FluidType;
|
||||
import net.minecraft.server.v1_16_R3.IEntitySelector;
|
||||
import net.minecraft.server.v1_16_R3.NBTTagCompound;
|
||||
import net.minecraft.server.v1_16_R3.SoundEffect;
|
||||
import net.minecraft.server.v1_16_R3.Tag;
|
||||
|
@ -214,6 +218,20 @@ public class EnderDragonController extends MobEntityController {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, false)) {
|
||||
try {
|
||||
KNOCKBACK.invoke(this, this.world.getEntities(this,
|
||||
children[6].getBoundingBox().grow(4.0, 2.0, 4.0).d(0.0, -2.0, 0.0), IEntitySelector.e));
|
||||
KNOCKBACK.invoke(this, this.world.getEntities(this,
|
||||
children[7].getBoundingBox().grow(4.0, 2.0, 4.0).d(0.0, -2.0, 0.0), IEntitySelector.e));
|
||||
HURT.invoke(this,
|
||||
this.world.getEntities(this, children[0].getBoundingBox().g(1.0), IEntitySelector.e));
|
||||
HURT.invoke(this,
|
||||
this.world.getEntities(this, children[1].getBoundingBox().g(1.0), IEntitySelector.e));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.movementTick();
|
||||
}
|
||||
|
@ -226,5 +244,9 @@ public class EnderDragonController extends MobEntityController {
|
|||
}
|
||||
return super.n(entity);
|
||||
}
|
||||
|
||||
private static final MethodHandle HURT = NMS.getMethodHandle(EntityEnderDragon.class, "b", true, List.class);
|
||||
private static final MethodHandle KNOCKBACK = NMS.getMethodHandle(EntityEnderDragon.class, "a", true,
|
||||
List.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -398,6 +398,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
private void updatePackets(boolean navigating) {
|
||||
if (!npc.isUpdating(NPCUpdate.PACKET))
|
||||
return;
|
||||
|
||||
updateEffects = true;
|
||||
boolean itemChanged = false;
|
||||
for (EnumItemSlot slot : EnumItemSlot.values()) {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package net.citizensnpcs.nms.v1_17_R1.entity;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftEnderDragon;
|
||||
|
@ -20,6 +23,7 @@ import net.minecraft.sounds.SoundEvent;
|
|||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntitySelector;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
||||
import net.minecraft.world.entity.boss.enderdragon.phases.EnderDragonPhase;
|
||||
|
@ -119,6 +123,24 @@ public class EnderDragonController extends MobEntityController {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, false)) {
|
||||
try {
|
||||
KNOCKBACK.invoke(this,
|
||||
this.level.getEntities(this,
|
||||
subEntities[6].getBoundingBox().inflate(4.0, 2.0, 4.0).move(0.0, -2.0, 0.0),
|
||||
EntitySelector.NO_CREATIVE_OR_SPECTATOR));
|
||||
KNOCKBACK.invoke(this,
|
||||
this.level.getEntities(this,
|
||||
subEntities[7].getBoundingBox().inflate(4.0, 2.0, 4.0).move(0.0, -2.0, 0.0),
|
||||
EntitySelector.NO_CREATIVE_OR_SPECTATOR));
|
||||
HURT.invoke(this, this.level.getEntities(this, subEntities[0].getBoundingBox().inflate(1.0),
|
||||
EntitySelector.NO_CREATIVE_OR_SPECTATOR));
|
||||
HURT.invoke(this, this.level.getEntities(this, subEntities[1].getBoundingBox().inflate(1.0),
|
||||
EntitySelector.NO_CREATIVE_OR_SPECTATOR));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.aiStep();
|
||||
}
|
||||
|
@ -233,5 +255,8 @@ public class EnderDragonController extends MobEntityController {
|
|||
public boolean updateFluidHeightAndDoFluidPushing(Tag<Fluid> Tag, double d0) {
|
||||
return NMSImpl.fluidPush(npc, this, () -> super.updateFluidHeightAndDoFluidPushing(Tag, d0));
|
||||
}
|
||||
|
||||
private static final MethodHandle HURT = NMS.getMethodHandle(EnderDragon.class, "b", true, List.class);
|
||||
private static final MethodHandle KNOCKBACK = NMS.getMethodHandle(EnderDragon.class, "a", true, List.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.lang.invoke.MethodHandle;
|
|||
import java.net.Socket;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
@ -49,6 +50,7 @@ import net.minecraft.network.chat.TextComponent;
|
|||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.PacketFlow;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundUpdateAttributesPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
@ -58,6 +60,7 @@ import net.minecraft.stats.ServerStatsCounter;
|
|||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -404,6 +407,8 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||
private void updatePackets(boolean navigating) {
|
||||
if (!npc.isUpdating(NPCUpdate.PACKET))
|
||||
return;
|
||||
|
||||
|
||||
effectsDirty = true;
|
||||
boolean itemChanged = false;
|
||||
for (EquipmentSlot slot : EquipmentSlot.values()) {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package net.citizensnpcs.nms.v1_18_R2.entity;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftEnderDragon;
|
||||
|
@ -22,6 +25,7 @@ import net.minecraft.sounds.SoundEvent;
|
|||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntitySelector;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
||||
import net.minecraft.world.entity.boss.enderdragon.phases.EnderDragonPhase;
|
||||
|
@ -121,6 +125,24 @@ public class EnderDragonController extends MobEntityController {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, false)) {
|
||||
try {
|
||||
KNOCKBACK.invoke(this,
|
||||
this.level.getEntities(this,
|
||||
subEntities[6].getBoundingBox().inflate(4.0, 2.0, 4.0).move(0.0, -2.0, 0.0),
|
||||
EntitySelector.NO_CREATIVE_OR_SPECTATOR));
|
||||
KNOCKBACK.invoke(this,
|
||||
this.level.getEntities(this,
|
||||
subEntities[7].getBoundingBox().inflate(4.0, 2.0, 4.0).move(0.0, -2.0, 0.0),
|
||||
EntitySelector.NO_CREATIVE_OR_SPECTATOR));
|
||||
HURT.invoke(this, this.level.getEntities(this, subEntities[0].getBoundingBox().inflate(1.0),
|
||||
EntitySelector.NO_CREATIVE_OR_SPECTATOR));
|
||||
HURT.invoke(this, this.level.getEntities(this, subEntities[1].getBoundingBox().inflate(1.0),
|
||||
EntitySelector.NO_CREATIVE_OR_SPECTATOR));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.aiStep();
|
||||
}
|
||||
|
@ -242,5 +264,8 @@ public class EnderDragonController extends MobEntityController {
|
|||
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tagkey, double d0) {
|
||||
return NMSImpl.fluidPush(npc, this, () -> super.updateFluidHeightAndDoFluidPushing(tagkey, d0));
|
||||
}
|
||||
|
||||
private static final MethodHandle HURT = NMS.getMethodHandle(EnderDragon.class, "b", true, List.class);
|
||||
private static final MethodHandle KNOCKBACK = NMS.getMethodHandle(EnderDragon.class, "a", true, List.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.lang.invoke.MethodHandle;
|
|||
import java.net.Socket;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
@ -50,6 +51,7 @@ import net.minecraft.network.chat.TextComponent;
|
|||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.PacketFlow;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundUpdateAttributesPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
@ -59,6 +61,7 @@ import net.minecraft.stats.ServerStatsCounter;
|
|||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -403,6 +406,8 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||
private void updatePackets(boolean navigating) {
|
||||
if (!npc.isUpdating(NPCUpdate.PACKET))
|
||||
return;
|
||||
|
||||
|
||||
effectsDirty = true;
|
||||
boolean itemChanged = false;
|
||||
for (EquipmentSlot slot : EquipmentSlot.values()) {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package net.citizensnpcs.nms.v1_19_R3.entity;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_19_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_19_R3.entity.CraftEnderDragon;
|
||||
|
@ -22,6 +25,7 @@ import net.minecraft.sounds.SoundEvent;
|
|||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntitySelector;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
||||
import net.minecraft.world.entity.boss.enderdragon.phases.EnderDragonPhase;
|
||||
|
@ -123,6 +127,24 @@ public class EnderDragonController extends MobEntityController {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, false)) {
|
||||
try {
|
||||
KNOCKBACK.invoke(this,
|
||||
this.level.getEntities(this,
|
||||
subEntities[6].getBoundingBox().inflate(4.0, 2.0, 4.0).move(0.0, -2.0, 0.0),
|
||||
EntitySelector.NO_CREATIVE_OR_SPECTATOR));
|
||||
KNOCKBACK.invoke(this,
|
||||
this.level.getEntities(this,
|
||||
subEntities[7].getBoundingBox().inflate(4.0, 2.0, 4.0).move(0.0, -2.0, 0.0),
|
||||
EntitySelector.NO_CREATIVE_OR_SPECTATOR));
|
||||
HURT.invoke(this, this.level.getEntities(this, subEntities[0].getBoundingBox().inflate(1.0),
|
||||
EntitySelector.NO_CREATIVE_OR_SPECTATOR));
|
||||
HURT.invoke(this, this.level.getEntities(this, subEntities[1].getBoundingBox().inflate(1.0),
|
||||
EntitySelector.NO_CREATIVE_OR_SPECTATOR));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.aiStep();
|
||||
}
|
||||
|
@ -244,5 +266,9 @@ public class EnderDragonController extends MobEntityController {
|
|||
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tagkey, double d0) {
|
||||
return NMSImpl.fluidPush(npc, this, () -> super.updateFluidHeightAndDoFluidPushing(tagkey, d0));
|
||||
}
|
||||
|
||||
private static final MethodHandle HURT = NMS.getMethodHandle(EnderDragon.class, "c", true, List.class);
|
||||
|
||||
private static final MethodHandle KNOCKBACK = NMS.getMethodHandle(EnderDragon.class, "b", true, List.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -408,6 +408,7 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||
private void updatePackets(boolean navigating) {
|
||||
if (!npc.isUpdating(NPCUpdate.PACKET))
|
||||
return;
|
||||
|
||||
effectsDirty = true;
|
||||
boolean itemChanged = false;
|
||||
for (EquipmentSlot slot : EquipmentSlot.values()) {
|
||||
|
@ -425,6 +426,7 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||
for (EquipmentSlot slot : EquipmentSlot.values()) {
|
||||
vals.add(new Pair<EquipmentSlot, ItemStack>(slot, getItemBySlot(slot)));
|
||||
}
|
||||
|
||||
Packet<?>[] packets = { new ClientboundSetEquipmentPacket(getId(), vals) };
|
||||
NMSImpl.sendPacketsNearby(getBukkitEntity(), getBukkitEntity().getLocation(packetLocationCache), packets);
|
||||
}
|
||||
|
|
|
@ -60,8 +60,7 @@ public class PlayerAnimationImpl {
|
|||
}
|
||||
|
||||
protected static void playDefaultAnimation(ServerPlayer player, int radius, int code) {
|
||||
ClientboundAnimatePacket packet = new ClientboundAnimatePacket(player, code);
|
||||
sendPacketNearby(packet, player, radius);
|
||||
sendPacketNearby(new ClientboundAnimatePacket(player, code), player, radius);
|
||||
}
|
||||
|
||||
private static void sendEntityData(int radius, final ServerPlayer player) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.citizensnpcs.nms.v1_8_R3.entity;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderDragon;
|
||||
|
@ -198,6 +200,18 @@ public class EnderDragonController extends MobEntityController {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, false)) {
|
||||
try {
|
||||
KNOCKBACK.invoke(this, this.world.getEntities(this,
|
||||
children[6].getBoundingBox().grow(4.0, 2.0, 4.0).c(0.0, -2.0, 0.0)));
|
||||
KNOCKBACK.invoke(this, this.world.getEntities(this,
|
||||
children[7].getBoundingBox().grow(4.0, 2.0, 4.0).c(0.0, -2.0, 0.0)));
|
||||
HURT.invoke(this, this.world.getEntities(this, children[0].getBoundingBox().grow(1, 1, 1.0)));
|
||||
HURT.invoke(this, this.world.getEntities(this, children[1].getBoundingBox().grow(1, 1, 1.0)));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.m();
|
||||
}
|
||||
|
@ -207,5 +221,10 @@ public class EnderDragonController extends MobEntityController {
|
|||
protected String z() {
|
||||
return NMSImpl.getSoundEffect(npc, super.z(), NPC.Metadata.AMBIENT_SOUND);
|
||||
}
|
||||
|
||||
private static final MethodHandle HURT = NMS.getMethodHandle(EntityEnderDragon.class, "b", true,
|
||||
java.util.List.class);
|
||||
private static final MethodHandle KNOCKBACK = NMS.getMethodHandle(EntityEnderDragon.class, "a", true,
|
||||
java.util.List.class);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package net.citizensnpcs.nms.v1_8_R3.entity;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -55,6 +56,7 @@ import net.minecraft.server.v1_8_R3.NavigationAbstract;
|
|||
import net.minecraft.server.v1_8_R3.NetworkManager;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutUpdateAttributes;
|
||||
import net.minecraft.server.v1_8_R3.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||
import net.minecraft.server.v1_8_R3.WorldSettings;
|
||||
|
@ -392,6 +394,8 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
private void updatePackets(boolean navigating) {
|
||||
if (!npc.isUpdating(NPCUpdate.PACKET))
|
||||
return;
|
||||
|
||||
|
||||
updateEffects = true;
|
||||
boolean itemChanged = false;
|
||||
for (int slot = 0; slot < this.inventory.armor.length; slot++) {
|
||||
|
|
Loading…
Reference in New Issue