Fix custom names in 1.9
This commit is contained in:
parent
280d03daa7
commit
0f752fb7e3
@ -28,6 +28,7 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity;
|
|||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutNewAttachEntity;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||||
|
|
||||||
@ -67,9 +68,9 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
{
|
{
|
||||||
super("Custom Tag Fix", plugin);
|
super("Custom Tag Fix", plugin);
|
||||||
|
|
||||||
packetHandler.addPacketHandler(this, true, PacketPlayOutAttachEntity.class, PacketPlayOutEntityDestroy.class,
|
packetHandler.addPacketHandler(this, true, PacketPlayOutEntityDestroy.class, PacketPlayOutEntityMetadata.class,
|
||||||
PacketPlayOutEntityMetadata.class, PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class,
|
PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class, PacketPlayOutNamedEntitySpawn.class,
|
||||||
PacketPlayOutNamedEntitySpawn.class, PacketPlayInUseEntity.class, PacketPlayOutAttachEntity.class);
|
PacketPlayInUseEntity.class, PacketPlayOutAttachEntity.class, PacketPlayOutNewAttachEntity.class);
|
||||||
|
|
||||||
// NCPHookManager.addHook(CheckType.MOVING_SURVIVALFLY, this);
|
// NCPHookManager.addHook(CheckType.MOVING_SURVIVALFLY, this);
|
||||||
// NCPHookManager.addHook(CheckType.MOVING_PASSABLE, this);
|
// NCPHookManager.addHook(CheckType.MOVING_PASSABLE, this);
|
||||||
@ -452,9 +453,25 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (packet instanceof PacketPlayOutAttachEntity)
|
else if (packet instanceof PacketPlayOutAttachEntity || packet instanceof PacketPlayOutNewAttachEntity)
|
||||||
{
|
{
|
||||||
PacketPlayOutAttachEntity attachPacket = (PacketPlayOutAttachEntity) packet;
|
int vech = -1;
|
||||||
|
int rider = -1;
|
||||||
|
|
||||||
|
if (packet instanceof PacketPlayOutAttachEntity)
|
||||||
|
{
|
||||||
|
PacketPlayOutAttachEntity attachPacket = (PacketPlayOutAttachEntity) packet;
|
||||||
|
vech = attachPacket.b;
|
||||||
|
rider = attachPacket.c;
|
||||||
|
}
|
||||||
|
else if (packet instanceof PacketPlayOutNewAttachEntity)
|
||||||
|
{
|
||||||
|
PacketPlayOutNewAttachEntity attachPacket = (PacketPlayOutNewAttachEntity) packet;
|
||||||
|
vech = attachPacket.a;
|
||||||
|
|
||||||
|
if (attachPacket.b.length > 0)
|
||||||
|
rider = attachPacket.b[0];
|
||||||
|
}
|
||||||
|
|
||||||
// c = rider, b = ridden
|
// c = rider, b = ridden
|
||||||
// When detaching, c is sent, b is -1
|
// When detaching, c is sent, b is -1
|
||||||
@ -473,27 +490,27 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
|
|
||||||
int vehicleId = -1;
|
int vehicleId = -1;
|
||||||
|
|
||||||
if (_entityRiding.get(owner.getName()).containsKey(attachPacket.b))
|
if (_entityRiding.get(owner.getName()).containsKey(vech))
|
||||||
{
|
{
|
||||||
vehicleId = _entityRiding.get(owner.getName()).get(attachPacket.b);
|
vehicleId = _entityRiding.get(owner.getName()).get(vech);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attachPacket.c == -1 && _entityMap.get(owner.getName()).containsKey(vehicleId))
|
if (rider == -1 && _entityMap.get(owner.getName()).containsKey(vehicleId))
|
||||||
{
|
{
|
||||||
Integer[] ids = _entityMap.get(owner.getName()).get(vehicleId);
|
Integer[] ids = _entityMap.get(owner.getName()).get(vehicleId);
|
||||||
|
|
||||||
_entityRiding.get(owner.getName()).remove(attachPacket.b);
|
_entityRiding.get(owner.getName()).remove(vech);
|
||||||
|
|
||||||
sendProtocolPackets(owner, vehicleId, _entityNameMap.get(owner.getName()).get(vehicleId), verifier, true,
|
sendProtocolPackets(owner, vehicleId, _entityNameMap.get(owner.getName()).get(vehicleId), verifier, true,
|
||||||
ids);
|
ids);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Integer[] ids = _entityMap.get(owner.getName()).get(attachPacket.c);
|
Integer[] ids = _entityMap.get(owner.getName()).get(rider);
|
||||||
|
|
||||||
if (ids != null && ids[1] != attachPacket.b)
|
if (ids != null && ids[1] != vech)
|
||||||
{
|
{
|
||||||
_entityRiding.get(owner.getName()).put(attachPacket.b, attachPacket.c);
|
_entityRiding.get(owner.getName()).put(vech, rider);
|
||||||
|
|
||||||
int[] newIds = new int[ids.length];
|
int[] newIds = new int[ids.length];
|
||||||
|
|
||||||
@ -522,54 +539,76 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
{
|
{
|
||||||
DataWatcher watcher = new DataWatcher(new DummyEntity(((CraftWorld) owner.getWorld()).getHandle()));
|
DataWatcher watcher = new DataWatcher(new DummyEntity(((CraftWorld) owner.getWorld()).getHandle()));
|
||||||
|
|
||||||
watcher.a(0, (byte) (0 | 1 << 5), Entity.META_ENTITYDATA, (byte) (0 | 1 << 5)); // Invisible
|
watcher.a(0, (byte) 32, Entity.META_ENTITYDATA, (byte) 32); // Invisible
|
||||||
watcher.a(1, Short.valueOf((short) 300), Entity.META_AIR, 0);
|
watcher.a(1, Short.valueOf((short) 300), Entity.META_AIR, 0);
|
||||||
watcher.a(2, finalEntityName, Entity.META_CUSTOMNAME, finalEntityName);
|
watcher.a(2, finalEntityName, Entity.META_CUSTOMNAME, finalEntityName);
|
||||||
watcher.a(3, (byte) 1, Entity.META_CUSTOMNAME_VISIBLE, true);
|
watcher.a(3, (byte) 1, Entity.META_CUSTOMNAME_VISIBLE, true);
|
||||||
watcher.a(10, (byte) (0 | 0x1), EntityArmorStand.META_ARMOR_OPTION, (byte) (0 | 0x1)); // Small
|
watcher.a(10, (byte) 16, EntityArmorStand.META_ARMOR_OPTION, (byte) 16); // Small
|
||||||
|
|
||||||
if (newPacket)
|
if (newPacket)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
watcher.watch(10, (byte) 16, EntityArmorStand.META_ARMOR_OPTION, (byte) 16);
|
|
||||||
|
|
||||||
DataWatcher squidWatcher = new DataWatcher(new DummyEntity(((CraftWorld) owner.getWorld()).getHandle()));
|
DataWatcher squidWatcher = new DataWatcher(new DummyEntity(((CraftWorld) owner.getWorld()).getHandle()));
|
||||||
squidWatcher.a(0, (byte) (0 | 1 << 5), Entity.META_ENTITYDATA, (byte) (0 | 1 << 5));
|
squidWatcher.a(0, (byte) 32, Entity.META_ENTITYDATA, (byte) 32);
|
||||||
|
|
||||||
PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving();
|
PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving();
|
||||||
spawnPacket.a = entityIds[1];
|
spawnPacket.a = entityIds[1];
|
||||||
spawnPacket.b = (byte) EntityType.SQUID.getTypeId();
|
spawnPacket.b = (byte) EntityType.SQUID.getTypeId();
|
||||||
spawnPacket.c = 1000000;
|
spawnPacket.c = owner.getLocation().getBlockX() * 32;
|
||||||
|
spawnPacket.d = -150;
|
||||||
|
spawnPacket.e = owner.getLocation().getBlockZ() * 32;
|
||||||
|
|
||||||
spawnPacket.l = squidWatcher;
|
spawnPacket.l = squidWatcher;
|
||||||
spawnPacket.uuid = UUID.randomUUID();
|
spawnPacket.uuid = UUID.randomUUID();
|
||||||
|
|
||||||
UtilPlayer.sendPacket(owner, spawnPacket);
|
UtilPlayer.sendPacket(owner, spawnPacket);
|
||||||
|
|
||||||
PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity();
|
if (UtilPlayer.is1_9(owner))
|
||||||
vehiclePacket.a = 0;
|
{
|
||||||
vehiclePacket.b = spawnPacket.a;
|
UtilPlayer.sendPacket(owner, new PacketPlayOutNewAttachEntity(entityId, new int[]
|
||||||
vehiclePacket.c = entityId;
|
{
|
||||||
|
entityIds[1]
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity();
|
||||||
|
vehiclePacket.a = 0;
|
||||||
|
vehiclePacket.b = spawnPacket.a;
|
||||||
|
vehiclePacket.c = entityId;
|
||||||
|
|
||||||
UtilPlayer.sendPacket(owner, vehiclePacket);
|
UtilPlayer.sendPacket(owner, vehiclePacket);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving();
|
PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving();
|
||||||
spawnPacket.a = entityIds[0];
|
spawnPacket.a = entityIds[0];
|
||||||
spawnPacket.b = (byte) 30;
|
spawnPacket.b = (byte) 30;
|
||||||
spawnPacket.c = 1000000;
|
spawnPacket.c = owner.getLocation().getBlockX() * 32;
|
||||||
|
spawnPacket.d = -150;
|
||||||
|
spawnPacket.e = owner.getLocation().getBlockZ() * 32;
|
||||||
|
|
||||||
spawnPacket.l = watcher;
|
spawnPacket.l = watcher;
|
||||||
spawnPacket.uuid = UUID.randomUUID();
|
spawnPacket.uuid = UUID.randomUUID();
|
||||||
|
|
||||||
UtilPlayer.sendPacket(owner, spawnPacket);
|
UtilPlayer.sendPacket(owner, spawnPacket);
|
||||||
|
|
||||||
PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity();
|
if (UtilPlayer.is1_9(owner))
|
||||||
vehiclePacket.a = 0;
|
{
|
||||||
vehiclePacket.b = entityIds[0];
|
UtilPlayer.sendPacket(owner, new PacketPlayOutNewAttachEntity(entityIds[1], new int[]
|
||||||
vehiclePacket.c = entityIds[1];
|
{
|
||||||
|
entityIds[0]
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity();
|
||||||
|
vehiclePacket.a = 0;
|
||||||
|
vehiclePacket.b = entityIds[0];
|
||||||
|
vehiclePacket.c = entityIds[1];
|
||||||
|
|
||||||
UtilPlayer.sendPacket(owner, vehiclePacket);
|
UtilPlayer.sendPacket(owner, vehiclePacket);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -917,7 +917,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
|
|
||||||
if (client.getHologram() == null)
|
if (client.getHologram() == null)
|
||||||
{
|
{
|
||||||
double yAdd = 2.18;
|
double yAdd = 2.3;
|
||||||
hologram = new Hologram(_hologramManager, _carlNpc.getLocation().clone().add(0, yAdd, 0), "");
|
hologram = new Hologram(_hologramManager, _carlNpc.getLocation().clone().add(0, yAdd, 0), "");
|
||||||
hologram.setHologramTarget(Hologram.HologramTarget.WHITELIST);
|
hologram.setHologramTarget(Hologram.HologramTarget.WHITELIST);
|
||||||
hologram.addPlayer(player);
|
hologram.addPlayer(player);
|
||||||
|
Loading…
Reference in New Issue
Block a user