Refactoring

This commit is contained in:
filoghost 2021-08-19 09:28:58 +02:00
parent 903c94657b
commit ec5cf3ca94
44 changed files with 224 additions and 143 deletions

View File

@ -10,6 +10,9 @@ import me.filoghost.holographicdisplays.common.nms.NMSPacketList;
public interface ClickableNMSPacketEntity extends NMSPacketEntity { public interface ClickableNMSPacketEntity extends NMSPacketEntity {
double SLIME_Y_OFFSET = 0;
double SLIME_HEIGHT = 0.5;
EntityID getID(); EntityID getID();
void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ); void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ);

View File

@ -10,6 +10,9 @@ import org.bukkit.inventory.ItemStack;
public interface ItemNMSPacketEntity extends NMSPacketEntity { public interface ItemNMSPacketEntity extends NMSPacketEntity {
double ITEM_Y_OFFSET = 0;
double ITEM_HEIGHT = 0.7;
void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack); void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack);
void addChangePackets(NMSPacketList packetList, ItemStack itemStack); void addChangePackets(NMSPacketList packetList, ItemStack itemStack);

View File

@ -10,6 +10,9 @@ import me.filoghost.holographicdisplays.common.nms.NMSPacketList;
public interface TextNMSPacketEntity extends NMSPacketEntity { public interface TextNMSPacketEntity extends NMSPacketEntity {
double ARMOR_STAND_Y_OFFSET = -0.29;
double ARMOR_STAND_TEXT_HEIGHT = 0.23;
void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ); void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ);
void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text); void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text);

View File

@ -26,12 +26,14 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntitySpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + SLIME_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(EntityLivingSpawnNMSPacket.builder(slimeID, EntityTypeID.SLIME, positionX, positionY, positionZ) packetList.add(EntityLivingSpawnNMSPacket.builder(
slimeID, EntityTypeID.SLIME, positionX, positionY + SLIME_Y_OFFSET, positionZ)
.setInvisible() .setInvisible()
.setSlimeSmall() // Required for a correct client-side collision box .setSlimeSmall() // Required for a correct client-side collision box
.build() .build()
@ -41,7 +43,7 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + SLIME_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -22,12 +22,14 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) {
packetList.add(new EntitySpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntitySpawnNMSPacket(itemID, EntityTypeID.ITEM, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
itemID, EntityTypeID.ITEM, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(itemID) packetList.add(EntityMetadataNMSPacket.builder(itemID)
.setItemStack(itemStack) .setItemStack(itemStack)
.build() .build()
@ -45,7 +47,7 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + ITEM_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -21,7 +21,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
@ -30,7 +31,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(text) .setCustomName(text)
@ -41,7 +43,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets( public void addSpawnPackets(
NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) { NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID) packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(individualText.get(player)) .setCustomName(individualText.get(player))
@ -67,7 +70,7 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -26,12 +26,14 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntitySpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + SLIME_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(EntityLivingSpawnNMSPacket.builder(slimeID, EntityTypeID.SLIME, positionX, positionY, positionZ) packetList.add(EntityLivingSpawnNMSPacket.builder(
slimeID, EntityTypeID.SLIME, positionX, positionY + SLIME_Y_OFFSET, positionZ)
.setInvisible() .setInvisible()
.setSlimeSmall() // Required for a correct client-side collision box .setSlimeSmall() // Required for a correct client-side collision box
.build() .build()
@ -41,7 +43,7 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + SLIME_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -22,12 +22,14 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) {
packetList.add(new EntitySpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntitySpawnNMSPacket(itemID, EntityTypeID.ITEM, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
itemID, EntityTypeID.ITEM, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(itemID) packetList.add(EntityMetadataNMSPacket.builder(itemID)
.setItemStack(itemStack) .setItemStack(itemStack)
.build() .build()
@ -45,7 +47,7 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + ITEM_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -21,7 +21,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
@ -30,7 +31,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(text) .setCustomName(text)
@ -41,7 +43,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets( public void addSpawnPackets(
NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) { NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID) packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(individualText.get(player)) .setCustomName(individualText.get(player))
@ -67,7 +70,7 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -26,12 +26,14 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntitySpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + SLIME_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(EntityLivingSpawnNMSPacket.builder(slimeID, EntityTypeID.SLIME, positionX, positionY, positionZ) packetList.add(EntityLivingSpawnNMSPacket.builder(
slimeID, EntityTypeID.SLIME, positionX, positionY + SLIME_Y_OFFSET, positionZ)
.setInvisible() .setInvisible()
.setSlimeSmall() // Required for a correct client-side collision box .setSlimeSmall() // Required for a correct client-side collision box
.build() .build()
@ -41,7 +43,7 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + SLIME_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -22,12 +22,14 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) {
packetList.add(new EntitySpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntitySpawnNMSPacket(itemID, EntityTypeID.ITEM, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
itemID, EntityTypeID.ITEM, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(itemID) packetList.add(EntityMetadataNMSPacket.builder(itemID)
.setItemStack(itemStack) .setItemStack(itemStack)
.build() .build()
@ -45,7 +47,7 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + ITEM_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -21,7 +21,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
@ -30,7 +31,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(text) .setCustomName(text)
@ -41,7 +43,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets( public void addSpawnPackets(
NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) { NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID) packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(individualText.get(player)) .setCustomName(individualText.get(player))
@ -67,7 +70,7 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -26,12 +26,14 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntitySpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + SLIME_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(EntityLivingSpawnNMSPacket.builder(slimeID, EntityTypeID.SLIME, positionX, positionY, positionZ) packetList.add(EntityLivingSpawnNMSPacket.builder(
slimeID, EntityTypeID.SLIME, positionX, positionY + SLIME_Y_OFFSET, positionZ)
.setInvisible() .setInvisible()
.setSlimeSmall() // Required for a correct client-side collision box .setSlimeSmall() // Required for a correct client-side collision box
.build() .build()
@ -41,7 +43,7 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + SLIME_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -22,12 +22,14 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) {
packetList.add(new EntitySpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntitySpawnNMSPacket(itemID, EntityTypeID.ITEM, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
itemID, EntityTypeID.ITEM, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(itemID) packetList.add(EntityMetadataNMSPacket.builder(itemID)
.setItemStack(itemStack) .setItemStack(itemStack)
.build() .build()
@ -45,7 +47,7 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + ITEM_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -21,7 +21,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
@ -30,7 +31,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(text) .setCustomName(text)
@ -41,7 +43,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets( public void addSpawnPackets(
NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) { NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID) packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(individualText.get(player)) .setCustomName(individualText.get(player))
@ -67,7 +70,7 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -26,11 +26,13 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(EntityLivingSpawnNMSPacket.builder(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ) packetList.add(EntityLivingSpawnNMSPacket.builder(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + SLIME_Y_OFFSET, positionZ)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(EntityLivingSpawnNMSPacket.builder(slimeID, EntityTypeID.SLIME, positionX, positionY, positionZ) packetList.add(EntityLivingSpawnNMSPacket.builder(
slimeID, EntityTypeID.SLIME, positionX, positionY + SLIME_Y_OFFSET, positionZ)
.setInvisible() .setInvisible()
.setSlimeSmall() // Required for a correct client-side collision box .setSlimeSmall() // Required for a correct client-side collision box
.build() .build()
@ -40,7 +42,7 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + SLIME_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -22,11 +22,13 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) {
packetList.add(EntityLivingSpawnNMSPacket.builder(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ) packetList.add(EntityLivingSpawnNMSPacket.builder(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + ITEM_Y_OFFSET, positionZ)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntitySpawnNMSPacket(itemID, EntityTypeID.ITEM, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
itemID, EntityTypeID.ITEM, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(itemID) packetList.add(EntityMetadataNMSPacket.builder(itemID)
.setItemStack(itemStack) .setItemStack(itemStack)
.build() .build()
@ -44,7 +46,7 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + ITEM_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -21,7 +21,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(EntityLivingSpawnNMSPacket.builder(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ) packetList.add(EntityLivingSpawnNMSPacket.builder(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
@ -29,7 +30,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) {
packetList.add(EntityLivingSpawnNMSPacket.builder(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ) packetList.add(EntityLivingSpawnNMSPacket.builder(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(text) .setCustomName(text)
.build() .build()
@ -40,7 +42,7 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
public void addSpawnPackets( public void addSpawnPackets(
NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) { NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) {
packetList.add(new IndividualNMSPacket(player -> EntityLivingSpawnNMSPacket.builder( packetList.add(new IndividualNMSPacket(player -> EntityLivingSpawnNMSPacket.builder(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ) armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(individualText.get(player)) .setCustomName(individualText.get(player))
.build() .build()
@ -65,7 +67,7 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -26,12 +26,14 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityLivingSpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + SLIME_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntityLivingSpawnNMSPacket(slimeID, EntityTypeID.SLIME, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
slimeID, EntityTypeID.SLIME, positionX, positionY + SLIME_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(slimeID) packetList.add(EntityMetadataNMSPacket.builder(slimeID)
.setInvisible() .setInvisible()
.setSlimeSmall() // Required for a correct client-side collision box .setSlimeSmall() // Required for a correct client-side collision box
@ -42,7 +44,7 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + SLIME_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -22,12 +22,14 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) {
packetList.add(new EntityLivingSpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntitySpawnNMSPacket(itemID, EntityTypeID.ITEM, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
itemID, EntityTypeID.ITEM, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(itemID) packetList.add(EntityMetadataNMSPacket.builder(itemID)
.setItemStack(itemStack) .setItemStack(itemStack)
.build() .build()
@ -45,7 +47,7 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + ITEM_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -21,7 +21,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityLivingSpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
@ -30,7 +31,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) {
packetList.add(new EntityLivingSpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(text) .setCustomName(text)
@ -41,7 +43,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets( public void addSpawnPackets(
NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) { NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) {
packetList.add(new EntityLivingSpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID) packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(individualText.get(player)) .setCustomName(individualText.get(player))
@ -67,7 +70,7 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -26,12 +26,14 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityLivingSpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + SLIME_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntityLivingSpawnNMSPacket(slimeID, EntityTypeID.SLIME, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
slimeID, EntityTypeID.SLIME, positionX, positionY + SLIME_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(slimeID) packetList.add(EntityMetadataNMSPacket.builder(slimeID)
.setInvisible() .setInvisible()
.setSlimeSmall() // Required for a correct client-side collision box .setSlimeSmall() // Required for a correct client-side collision box
@ -42,7 +44,7 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + SLIME_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -22,12 +22,14 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) {
packetList.add(new EntityLivingSpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntitySpawnNMSPacket(itemID, EntityTypeID.ITEM, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
itemID, EntityTypeID.ITEM, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(itemID) packetList.add(EntityMetadataNMSPacket.builder(itemID)
.setItemStack(itemStack) .setItemStack(itemStack)
.build() .build()
@ -45,7 +47,7 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + ITEM_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -21,7 +21,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityLivingSpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
@ -30,7 +31,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) {
packetList.add(new EntityLivingSpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(text) .setCustomName(text)
@ -41,7 +43,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets( public void addSpawnPackets(
NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) { NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) {
packetList.add(new EntityLivingSpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID) packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(individualText.get(player)) .setCustomName(individualText.get(player))
@ -67,7 +70,7 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -26,12 +26,14 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityLivingSpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + SLIME_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntityLivingSpawnNMSPacket(slimeID, EntityTypeID.SLIME, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
slimeID, EntityTypeID.SLIME, positionX, positionY + SLIME_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(slimeID) packetList.add(EntityMetadataNMSPacket.builder(slimeID)
.setInvisible() .setInvisible()
.setSlimeSmall() // Required for a correct client-side collision box .setSlimeSmall() // Required for a correct client-side collision box
@ -42,7 +44,7 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + SLIME_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -22,12 +22,14 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) {
packetList.add(new EntityLivingSpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntitySpawnNMSPacket(itemID, EntityTypeID.ITEM, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
itemID, EntityTypeID.ITEM, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(itemID) packetList.add(EntityMetadataNMSPacket.builder(itemID)
.setItemStack(itemStack) .setItemStack(itemStack)
.build() .build()
@ -45,7 +47,7 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + ITEM_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -21,7 +21,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityLivingSpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
@ -30,7 +31,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) {
packetList.add(new EntityLivingSpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(text) .setCustomName(text)
@ -41,7 +43,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets( public void addSpawnPackets(
NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) { NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) {
packetList.add(new EntityLivingSpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID) packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(individualText.get(player)) .setCustomName(individualText.get(player))
@ -67,7 +70,7 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -26,12 +26,14 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityLivingSpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + SLIME_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntityLivingSpawnNMSPacket(slimeID, EntityTypeID.SLIME, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
slimeID, EntityTypeID.SLIME, positionX, positionY + SLIME_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(slimeID) packetList.add(EntityMetadataNMSPacket.builder(slimeID)
.setInvisible() .setInvisible()
.setSlimeSmall() // Required for a correct client-side collision box .setSlimeSmall() // Required for a correct client-side collision box
@ -42,7 +44,7 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + SLIME_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -22,12 +22,14 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) {
packetList.add(new EntityLivingSpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntitySpawnNMSPacket(itemID, EntityTypeID.ITEM, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
itemID, EntityTypeID.ITEM, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(itemID) packetList.add(EntityMetadataNMSPacket.builder(itemID)
.setItemStack(itemStack) .setItemStack(itemStack)
.build() .build()
@ -45,7 +47,7 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + ITEM_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -21,7 +21,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityLivingSpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
@ -30,7 +31,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) {
packetList.add(new EntityLivingSpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(text) .setCustomName(text)
@ -41,7 +43,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets( public void addSpawnPackets(
NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) { NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) {
packetList.add(new EntityLivingSpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID) packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(individualText.get(player)) .setCustomName(individualText.get(player))
@ -67,7 +70,7 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -26,12 +26,14 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityLivingSpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + SLIME_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntityLivingSpawnNMSPacket(slimeID, EntityTypeID.SLIME, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
slimeID, EntityTypeID.SLIME, positionX, positionY + SLIME_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(slimeID) packetList.add(EntityMetadataNMSPacket.builder(slimeID)
.setInvisible() .setInvisible()
.setSlimeSmall() // Required for a correct client-side collision box .setSlimeSmall() // Required for a correct client-side collision box
@ -42,7 +44,7 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + SLIME_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -22,12 +22,14 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) {
packetList.add(new EntityLivingSpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntitySpawnNMSPacket(itemID, EntityTypeID.ITEM, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
itemID, EntityTypeID.ITEM, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(itemID) packetList.add(EntityMetadataNMSPacket.builder(itemID)
.setItemStack(itemStack) .setItemStack(itemStack)
.build() .build()
@ -45,7 +47,7 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + ITEM_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -21,7 +21,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityLivingSpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
@ -30,7 +31,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) {
packetList.add(new EntityLivingSpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(text) .setCustomName(text)
@ -41,7 +43,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets( public void addSpawnPackets(
NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) { NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) {
packetList.add(new EntityLivingSpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntityLivingSpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID) packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(individualText.get(player)) .setCustomName(individualText.get(player))
@ -67,7 +70,7 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -26,12 +26,14 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntitySpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + SLIME_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(EntityLivingSpawnNMSPacket.builder(slimeID, EntityTypeID.SLIME, positionX, positionY, positionZ) packetList.add(EntityLivingSpawnNMSPacket.builder(
slimeID, EntityTypeID.SLIME, positionX, positionY + SLIME_Y_OFFSET, positionZ)
.setInvisible() .setInvisible()
.setSlimeSmall() // Required for a correct client-side collision box .setSlimeSmall() // Required for a correct client-side collision box
.build() .build()
@ -41,7 +43,7 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + SLIME_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -22,12 +22,14 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) {
packetList.add(new EntitySpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntitySpawnNMSPacket(itemID, EntityTypeID.ITEM, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
itemID, EntityTypeID.ITEM, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(itemID) packetList.add(EntityMetadataNMSPacket.builder(itemID)
.setItemStack(itemStack) .setItemStack(itemStack)
.build() .build()
@ -45,7 +47,7 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + ITEM_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -21,7 +21,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
@ -30,7 +31,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(text) .setCustomName(text)
@ -41,7 +43,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets( public void addSpawnPackets(
NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) { NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID) packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(individualText.get(player)) .setCustomName(individualText.get(player))
@ -67,7 +70,7 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -26,12 +26,14 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntitySpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + SLIME_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(EntityLivingSpawnNMSPacket.builder(slimeID, EntityTypeID.SLIME, positionX, positionY, positionZ) packetList.add(EntityLivingSpawnNMSPacket.builder(
slimeID, EntityTypeID.SLIME, positionX, positionY + SLIME_Y_OFFSET, positionZ)
.setInvisible() .setInvisible()
.setSlimeSmall() // Required for a correct client-side collision box .setSlimeSmall() // Required for a correct client-side collision box
.build() .build()
@ -41,7 +43,7 @@ public class VersionClickableNMSPacketEntity implements ClickableNMSPacketEntity
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + SLIME_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -22,12 +22,14 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, ItemStack itemStack) {
packetList.add(new EntitySpawnNMSPacket(vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
vehicleID, EntityTypeID.ARMOR_STAND, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(vehicleID) packetList.add(EntityMetadataNMSPacket.builder(vehicleID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
); );
packetList.add(new EntitySpawnNMSPacket(itemID, EntityTypeID.ITEM, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
itemID, EntityTypeID.ITEM, positionX, positionY + ITEM_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(itemID) packetList.add(EntityMetadataNMSPacket.builder(itemID)
.setItemStack(itemStack) .setItemStack(itemStack)
.build() .build()
@ -45,7 +47,7 @@ public class VersionItemNMSPacketEntity implements ItemNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(vehicleID, positionX, positionY + ITEM_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -21,7 +21,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.build() .build()
@ -30,7 +31,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) { public void addSpawnPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ, String text) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(EntityMetadataNMSPacket.builder(armorStandID) packetList.add(EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(text) .setCustomName(text)
@ -41,7 +43,8 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addSpawnPackets( public void addSpawnPackets(
NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) { NMSPacketList packetList, double positionX, double positionY, double positionZ, IndividualText individualText) {
packetList.add(new EntitySpawnNMSPacket(armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); packetList.add(new EntitySpawnNMSPacket(
armorStandID, EntityTypeID.ARMOR_STAND, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID) packetList.add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(armorStandID)
.setArmorStandMarker() .setArmorStandMarker()
.setCustomName(individualText.get(player)) .setCustomName(individualText.get(player))
@ -67,7 +70,7 @@ class VersionTextNMSPacketEntity implements TextNMSPacketEntity {
@Override @Override
public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) { public void addTeleportPackets(NMSPacketList packetList, double positionX, double positionY, double positionZ) {
packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY, positionZ)); packetList.add(new EntityTeleportNMSPacket(armorStandID, positionX, positionY + ARMOR_STAND_Y_OFFSET, positionZ));
} }
@Override @Override

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.plugin.hologram.base;
import me.filoghost.fcommons.Preconditions; import me.filoghost.fcommons.Preconditions;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.holographicdisplays.api.hologram.PickupListener; import me.filoghost.holographicdisplays.api.hologram.PickupListener;
import me.filoghost.holographicdisplays.common.nms.entity.ItemNMSPacketEntity;
import me.filoghost.holographicdisplays.plugin.hologram.tracking.ItemLineTracker; import me.filoghost.holographicdisplays.plugin.hologram.tracking.ItemLineTracker;
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager; import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -75,7 +76,7 @@ public abstract class BaseItemLine extends BaseClickableLine {
@Override @Override
public double getHeight() { public double getHeight() {
return 0.7; return ItemNMSPacketEntity.ITEM_HEIGHT;
} }
@Override @Override

View File

@ -5,6 +5,7 @@
*/ */
package me.filoghost.holographicdisplays.plugin.hologram.base; package me.filoghost.holographicdisplays.plugin.hologram.base;
import me.filoghost.holographicdisplays.common.nms.entity.TextNMSPacketEntity;
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager; import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager;
import me.filoghost.holographicdisplays.plugin.hologram.tracking.TextLineTracker; import me.filoghost.holographicdisplays.plugin.hologram.tracking.TextLineTracker;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -38,7 +39,7 @@ public abstract class BaseTextLine extends BaseClickableLine {
@Override @Override
public double getHeight() { public double getHeight() {
return 0.23; return TextNMSPacketEntity.ARMOR_STAND_TEXT_HEIGHT;
} }
@Override @Override

View File

@ -14,8 +14,6 @@ import org.jetbrains.annotations.MustBeInvokedByOverriders;
public abstract class ClickableLineTracker<T extends BaseClickableLine> extends PositionBasedLineTracker<T> { public abstract class ClickableLineTracker<T extends BaseClickableLine> extends PositionBasedLineTracker<T> {
private static final double CLICKABLE_ENTITY_HEIGHT = 0.5;
private final ClickableNMSPacketEntity clickableEntity; private final ClickableNMSPacketEntity clickableEntity;
private final LineClickListener lineClickListener; private final LineClickListener lineClickListener;
@ -98,7 +96,7 @@ public abstract class ClickableLineTracker<T extends BaseClickableLine> extends
} }
private double getClickablePositionY() { private double getClickablePositionY() {
return positionY + ((line.getHeight() - CLICKABLE_ENTITY_HEIGHT) / 2); return positionY + ((line.getHeight() - ClickableNMSPacketEntity.SLIME_HEIGHT) / 2);
} }
} }

View File

@ -83,7 +83,7 @@ public class ItemLineTracker extends ClickableLineTracker<BaseItemLine> {
super.addSpawnPackets(packetList); super.addSpawnPackets(packetList);
if (spawnItemEntity) { if (spawnItemEntity) {
itemEntity.addSpawnPackets(packetList, positionX, getItemPositionY(), positionZ, itemStack); itemEntity.addSpawnPackets(packetList, positionX, positionY, positionZ, itemStack);
} }
} }
@ -104,7 +104,7 @@ public class ItemLineTracker extends ClickableLineTracker<BaseItemLine> {
if (spawnItemEntityChanged) { if (spawnItemEntityChanged) {
if (spawnItemEntity) { if (spawnItemEntity) {
itemEntity.addSpawnPackets(packetList, positionX, getItemPositionY(), positionZ, itemStack); itemEntity.addSpawnPackets(packetList, positionX, positionY, positionZ, itemStack);
} else { } else {
itemEntity.addDestroyPackets(packetList); itemEntity.addDestroyPackets(packetList);
} }
@ -120,12 +120,8 @@ public class ItemLineTracker extends ClickableLineTracker<BaseItemLine> {
super.addPositionChangePackets(packetList); super.addPositionChangePackets(packetList);
if (spawnItemEntity) { if (spawnItemEntity) {
itemEntity.addTeleportPackets(packetList, positionX, getItemPositionY(), positionZ); itemEntity.addTeleportPackets(packetList, positionX, positionY, positionZ);
} }
} }
private double getItemPositionY() {
return positionY;
}
} }

View File

@ -77,14 +77,11 @@ public class TextLineTracker extends ClickableLineTracker<BaseTextLine> {
super.addSpawnPackets(packetList); super.addSpawnPackets(packetList);
if (!allowPlaceholders) { if (!allowPlaceholders) {
textEntity.addSpawnPackets( textEntity.addSpawnPackets(packetList, positionX, positionY, positionZ, displayText.getWithoutReplacements());
packetList, positionX, getTextPositionY(), positionZ, displayText.getWithoutReplacements());
} else if (displayText.containsIndividualPlaceholders()) { } else if (displayText.containsIndividualPlaceholders()) {
textEntity.addSpawnPackets( textEntity.addSpawnPackets(packetList, positionX, positionY, positionZ, displayText::getWithIndividualReplacements);
packetList, positionX, getTextPositionY(), positionZ, displayText::getWithIndividualReplacements);
} else { } else {
textEntity.addSpawnPackets( textEntity.addSpawnPackets(packetList, positionX, positionY, positionZ, displayText.getWithGlobalReplacements());
packetList, positionX, getTextPositionY(), positionZ, displayText.getWithGlobalReplacements());
} }
} }
@ -114,11 +111,7 @@ public class TextLineTracker extends ClickableLineTracker<BaseTextLine> {
@Override @Override
protected void addPositionChangePackets(NMSPacketList packetList) { protected void addPositionChangePackets(NMSPacketList packetList) {
super.addPositionChangePackets(packetList); super.addPositionChangePackets(packetList);
textEntity.addTeleportPackets(packetList, positionX, getTextPositionY(), positionZ); textEntity.addTeleportPackets(packetList, positionX, positionY, positionZ);
}
private double getTextPositionY() {
return positionY - 0.29;
} }
} }