mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-12-19 23:37:33 +01:00
Rename location references to "position"
This commit is contained in:
parent
9b21ffdf76
commit
150cc4c62b
@ -10,25 +10,25 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public interface NMSPacketList {
|
||||
|
||||
void addArmorStandSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ);
|
||||
void addArmorStandSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ);
|
||||
|
||||
void addArmorStandSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ, String customName);
|
||||
void addArmorStandSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ, String customName);
|
||||
|
||||
void addArmorStandSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ, IndividualCustomName individualCustomName);
|
||||
void addArmorStandSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ, IndividualCustomName individualCustomName);
|
||||
|
||||
void addArmorStandNameChangePackets(EntityID entityID, String customName);
|
||||
|
||||
void addArmorStandNameChangePackets(EntityID entityID, IndividualCustomName individualCustomName);
|
||||
|
||||
void addItemSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ, ItemStack itemStack);
|
||||
void addItemSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ, ItemStack itemStack);
|
||||
|
||||
void addItemStackChangePackets(EntityID entityID, ItemStack itemStack);
|
||||
|
||||
void addSlimeSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ);
|
||||
void addSlimeSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ);
|
||||
|
||||
void addEntityDestroyPackets(EntityID... entityIDs);
|
||||
|
||||
void addTeleportPackets(EntityID entityID, double locationX, double locationY, double locationZ);
|
||||
void addTeleportPackets(EntityID entityID, double positionX, double positionY, double positionZ);
|
||||
|
||||
void addMountPackets(EntityID vehicleEntityID, EntityID passengerEntityID);
|
||||
|
||||
|
@ -13,7 +13,7 @@ class EntityLivingSpawnNMSPacket extends VersionNMSPacket {
|
||||
|
||||
private final Packet<?> rawPacket;
|
||||
|
||||
EntityLivingSpawnNMSPacket(EntityID entityID, int entityTypeID, double locationX, double locationY, double locationZ) {
|
||||
EntityLivingSpawnNMSPacket(EntityID entityID, int entityTypeID, double positionX, double positionY, double positionZ) {
|
||||
PacketByteBuffer packetByteBuffer = PacketByteBuffer.get();
|
||||
|
||||
packetByteBuffer.writeVarInt(entityID.getNumericID());
|
||||
@ -21,9 +21,9 @@ class EntityLivingSpawnNMSPacket extends VersionNMSPacket {
|
||||
packetByteBuffer.writeVarInt(entityTypeID);
|
||||
|
||||
// Position
|
||||
packetByteBuffer.writeDouble(locationX);
|
||||
packetByteBuffer.writeDouble(locationY);
|
||||
packetByteBuffer.writeDouble(locationZ);
|
||||
packetByteBuffer.writeDouble(positionX);
|
||||
packetByteBuffer.writeDouble(positionY);
|
||||
packetByteBuffer.writeDouble(positionZ);
|
||||
|
||||
// Rotation
|
||||
packetByteBuffer.writeByte(0);
|
||||
|
@ -13,7 +13,7 @@ class EntitySpawnNMSPacket extends VersionNMSPacket {
|
||||
|
||||
private final Packet<?> rawPacket;
|
||||
|
||||
EntitySpawnNMSPacket(EntityID entityID, int entityTypeID, double locationX, double locationY, double locationZ) {
|
||||
EntitySpawnNMSPacket(EntityID entityID, int entityTypeID, double positionX, double positionY, double positionZ) {
|
||||
PacketByteBuffer packetByteBuffer = PacketByteBuffer.get();
|
||||
|
||||
packetByteBuffer.writeVarInt(entityID.getNumericID());
|
||||
@ -21,9 +21,9 @@ class EntitySpawnNMSPacket extends VersionNMSPacket {
|
||||
packetByteBuffer.writeVarInt(entityTypeID);
|
||||
|
||||
// Position
|
||||
packetByteBuffer.writeDouble(locationX);
|
||||
packetByteBuffer.writeDouble(locationY);
|
||||
packetByteBuffer.writeDouble(locationZ);
|
||||
packetByteBuffer.writeDouble(positionX);
|
||||
packetByteBuffer.writeDouble(positionY);
|
||||
packetByteBuffer.writeDouble(positionZ);
|
||||
|
||||
// Rotation
|
||||
packetByteBuffer.writeByte(0);
|
||||
|
@ -13,15 +13,15 @@ class EntityTeleportNMSPacket extends VersionNMSPacket {
|
||||
|
||||
private final Packet<?> rawPacket;
|
||||
|
||||
EntityTeleportNMSPacket(EntityID entityID, double locationX, double locationY, double locationZ) {
|
||||
EntityTeleportNMSPacket(EntityID entityID, double positionX, double positionY, double positionZ) {
|
||||
PacketByteBuffer packetByteBuffer = PacketByteBuffer.get();
|
||||
|
||||
packetByteBuffer.writeVarInt(entityID.getNumericID());
|
||||
|
||||
// Location
|
||||
packetByteBuffer.writeDouble(locationX);
|
||||
packetByteBuffer.writeDouble(locationY);
|
||||
packetByteBuffer.writeDouble(locationZ);
|
||||
// Position
|
||||
packetByteBuffer.writeDouble(positionX);
|
||||
packetByteBuffer.writeDouble(positionY);
|
||||
packetByteBuffer.writeDouble(positionZ);
|
||||
|
||||
// Rotation
|
||||
packetByteBuffer.writeByte(0);
|
||||
|
@ -21,8 +21,8 @@ class VersionNMSPacketList extends AbstractNMSPacketList {
|
||||
private static final boolean USE_ENTITY_LIST_DESTROY_PACKET = useEntityListDestroyPacket();
|
||||
|
||||
@Override
|
||||
public void addArmorStandSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ) {
|
||||
add(new EntityLivingSpawnNMSPacket(entityID, EntityTypeID.ARMOR_STAND, locationX, locationY, locationZ));
|
||||
public void addArmorStandSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ) {
|
||||
add(new EntityLivingSpawnNMSPacket(entityID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ));
|
||||
add(EntityMetadataNMSPacket.builder(entityID)
|
||||
.setArmorStandMarker()
|
||||
.build()
|
||||
@ -30,8 +30,8 @@ class VersionNMSPacketList extends AbstractNMSPacketList {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addArmorStandSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ, String customName) {
|
||||
add(new EntityLivingSpawnNMSPacket(entityID, EntityTypeID.ARMOR_STAND, locationX, locationY, locationZ));
|
||||
public void addArmorStandSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ, String customName) {
|
||||
add(new EntityLivingSpawnNMSPacket(entityID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ));
|
||||
add(EntityMetadataNMSPacket.builder(entityID)
|
||||
.setArmorStandMarker()
|
||||
.setCustomName(customName)
|
||||
@ -40,8 +40,8 @@ class VersionNMSPacketList extends AbstractNMSPacketList {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addArmorStandSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ, IndividualCustomName individualCustomName) {
|
||||
add(new EntityLivingSpawnNMSPacket(entityID, EntityTypeID.ARMOR_STAND, locationX, locationY, locationZ));
|
||||
public void addArmorStandSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ, IndividualCustomName individualCustomName) {
|
||||
add(new EntityLivingSpawnNMSPacket(entityID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ));
|
||||
add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(entityID)
|
||||
.setArmorStandMarker()
|
||||
.setCustomName(individualCustomName.get(player))
|
||||
@ -66,8 +66,8 @@ class VersionNMSPacketList extends AbstractNMSPacketList {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addItemSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ, ItemStack itemStack) {
|
||||
add(new EntitySpawnNMSPacket(entityID, EntityTypeID.ITEM, locationX, locationY, locationZ));
|
||||
public void addItemSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ, ItemStack itemStack) {
|
||||
add(new EntitySpawnNMSPacket(entityID, EntityTypeID.ITEM, positionX, positionY, positionZ));
|
||||
add(EntityMetadataNMSPacket.builder(entityID)
|
||||
.setItemStack(itemStack)
|
||||
.build()
|
||||
@ -83,8 +83,8 @@ class VersionNMSPacketList extends AbstractNMSPacketList {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSlimeSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ) {
|
||||
add(new EntityLivingSpawnNMSPacket(entityID, EntityTypeID.SLIME, locationX, locationY, locationZ));
|
||||
public void addSlimeSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ) {
|
||||
add(new EntityLivingSpawnNMSPacket(entityID, EntityTypeID.SLIME, positionX, positionY, positionZ));
|
||||
add(EntityMetadataNMSPacket.builder(entityID)
|
||||
.setInvisible()
|
||||
.setSlimeSmall() // Required for a correct client-side collision box
|
||||
@ -104,8 +104,8 @@ class VersionNMSPacketList extends AbstractNMSPacketList {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTeleportPackets(EntityID entityID, double locationX, double locationY, double locationZ) {
|
||||
add(new EntityTeleportNMSPacket(entityID, locationX, locationY, locationZ));
|
||||
public void addTeleportPackets(EntityID entityID, double positionX, double positionY, double positionZ) {
|
||||
add(new EntityTeleportNMSPacket(entityID, positionX, positionY, positionZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,7 +54,7 @@ public class AlignCommand extends HologramSubCommand {
|
||||
}
|
||||
|
||||
hologram.setPosition(newPosition);
|
||||
hologramEditor.saveChanges(hologram, ChangeType.EDIT_LOCATION);
|
||||
hologramEditor.saveChanges(hologram, ChangeType.EDIT_POSITION);
|
||||
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "Hologram \"" + hologram.getName() + "\""
|
||||
+ " aligned to the hologram \"" + referenceHologram.getName() + "\""
|
||||
|
@ -35,7 +35,7 @@ public class MovehereCommand extends HologramSubCommand {
|
||||
InternalHologram hologram = hologramEditor.getHologram(args[0]);
|
||||
|
||||
hologram.setPosition(player.getLocation());
|
||||
hologramEditor.saveChanges(hologram, ChangeType.EDIT_LOCATION);
|
||||
hologramEditor.saveChanges(hologram, ChangeType.EDIT_POSITION);
|
||||
|
||||
hologramEditor.teleportLookingDown(player, player.getLocation());
|
||||
player.sendMessage(ColorScheme.PRIMARY + "You moved the hologram '" + hologram.getName() + "' near to you.");
|
||||
|
@ -43,7 +43,7 @@ public class InternalHologramChangeEvent extends Event {
|
||||
|
||||
CREATE,
|
||||
EDIT_LINES,
|
||||
EDIT_LOCATION,
|
||||
EDIT_POSITION,
|
||||
DELETE
|
||||
|
||||
}
|
||||
|
@ -59,21 +59,21 @@ public abstract class BaseHologram<T extends EditableHologramLine> extends BaseH
|
||||
checkNotDeleted();
|
||||
|
||||
lines.add(line);
|
||||
updateLineLocations();
|
||||
updateLinePositions();
|
||||
}
|
||||
|
||||
public void addLines(List<? extends T> newLines) {
|
||||
checkNotDeleted();
|
||||
|
||||
lines.addAll(newLines);
|
||||
updateLineLocations();
|
||||
updateLinePositions();
|
||||
}
|
||||
|
||||
public void insertLine(int afterIndex, T line) {
|
||||
checkNotDeleted();
|
||||
|
||||
lines.add(afterIndex, line);
|
||||
updateLineLocations();
|
||||
updateLinePositions();
|
||||
}
|
||||
|
||||
public void setLine(int index, T line) {
|
||||
@ -81,7 +81,7 @@ public abstract class BaseHologram<T extends EditableHologramLine> extends BaseH
|
||||
|
||||
T previousLine = lines.set(index, line);
|
||||
previousLine.setDeleted();
|
||||
updateLineLocations();
|
||||
updateLinePositions();
|
||||
}
|
||||
|
||||
public void setLines(List<T> newLines) {
|
||||
@ -89,14 +89,14 @@ public abstract class BaseHologram<T extends EditableHologramLine> extends BaseH
|
||||
|
||||
clearLines();
|
||||
lines.addAll(newLines);
|
||||
updateLineLocations();
|
||||
updateLinePositions();
|
||||
}
|
||||
|
||||
public void removeLine(int index) {
|
||||
checkNotDeleted();
|
||||
|
||||
lines.remove(index).setDeleted();
|
||||
updateLineLocations();
|
||||
updateLinePositions();
|
||||
}
|
||||
|
||||
public void removeLine(T line) {
|
||||
@ -104,7 +104,7 @@ public abstract class BaseHologram<T extends EditableHologramLine> extends BaseH
|
||||
|
||||
lines.remove(line);
|
||||
line.setDeleted();
|
||||
updateLineLocations();
|
||||
updateLinePositions();
|
||||
}
|
||||
|
||||
public void clearLines() {
|
||||
@ -190,7 +190,7 @@ public abstract class BaseHologram<T extends EditableHologramLine> extends BaseH
|
||||
this.isInLoadedChunk.invalidate();
|
||||
}
|
||||
|
||||
updateLineLocations();
|
||||
updateLinePositions();
|
||||
}
|
||||
|
||||
private int getChunkCoordinate(double positionCoordinate) {
|
||||
@ -201,7 +201,7 @@ public abstract class BaseHologram<T extends EditableHologramLine> extends BaseH
|
||||
* When spawning at a location, the top part of the first line should be exactly on that location.
|
||||
* The second line is below the first, and so on.
|
||||
*/
|
||||
private void updateLineLocations() {
|
||||
private void updateLinePositions() {
|
||||
double currentLineY = y;
|
||||
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
@ -212,7 +212,7 @@ public abstract class BaseHologram<T extends EditableHologramLine> extends BaseH
|
||||
currentLineY -= Settings.spaceBetweenLines;
|
||||
}
|
||||
|
||||
line.setLocation(x, currentLineY, z);
|
||||
line.setPosition(x, currentLineY, z);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public abstract class BaseHologramLine extends BaseHologramComponent implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setLocation(double x, double y, double z) {
|
||||
public final void setPosition(double x, double y, double z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
|
@ -7,7 +7,7 @@ package me.filoghost.holographicdisplays.plugin.hologram.base;
|
||||
|
||||
public interface EditableHologramLine {
|
||||
|
||||
void setLocation(double x, double y, double z);
|
||||
void setPosition(double x, double y, double z);
|
||||
|
||||
double getHeight();
|
||||
|
||||
|
@ -12,7 +12,7 @@ import me.filoghost.holographicdisplays.plugin.hologram.base.BaseClickableLine;
|
||||
import me.filoghost.holographicdisplays.plugin.listener.LineClickListener;
|
||||
import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
||||
|
||||
public abstract class ClickableLineTracker<T extends BaseClickableLine> extends LocationBasedLineTracker<T> {
|
||||
public abstract class ClickableLineTracker<T extends BaseClickableLine> extends PositionBasedLineTracker<T> {
|
||||
|
||||
private static final double SLIME_HEIGHT = 0.5;
|
||||
|
||||
@ -93,15 +93,15 @@ public abstract class ClickableLineTracker<T extends BaseClickableLine> extends
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
@Override
|
||||
protected void addLocationChangePackets(NMSPacketList packetList) {
|
||||
protected void addPositionChangePackets(NMSPacketList packetList) {
|
||||
if (spawnSlimeEntities) {
|
||||
packetList.addTeleportPackets(vehicleEntityID, locationX, getSlimeLocationY(), locationZ);
|
||||
packetList.addTeleportPackets(vehicleEntityID, positionX, getSlimePositionY(), positionZ);
|
||||
}
|
||||
}
|
||||
|
||||
private void addSlimeSpawnPackets(NMSPacketList packetList) {
|
||||
packetList.addArmorStandSpawnPackets(vehicleEntityID, locationX, getSlimeLocationY(), locationZ);
|
||||
packetList.addSlimeSpawnPackets(slimeEntityID, locationX, getSlimeLocationY(), locationZ);
|
||||
packetList.addArmorStandSpawnPackets(vehicleEntityID, positionX, getSlimePositionY(), positionZ);
|
||||
packetList.addSlimeSpawnPackets(slimeEntityID, positionX, getSlimePositionY(), positionZ);
|
||||
packetList.addMountPackets(vehicleEntityID, slimeEntityID);
|
||||
}
|
||||
|
||||
@ -109,8 +109,8 @@ public abstract class ClickableLineTracker<T extends BaseClickableLine> extends
|
||||
packetList.addEntityDestroyPackets(slimeEntityID, vehicleEntityID);
|
||||
}
|
||||
|
||||
private double getSlimeLocationY() {
|
||||
return locationY + ((line.getHeight() - SLIME_HEIGHT) / 2);
|
||||
private double getSlimePositionY() {
|
||||
return positionY + ((line.getHeight() - SLIME_HEIGHT) / 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class ItemLineTracker extends ClickableLineTracker<BaseItemLine> {
|
||||
|
||||
if (spawnItemEntities && hasTrackedPlayers()) {
|
||||
for (Player trackedPlayer : getTrackedPlayers()) {
|
||||
if (CollisionHelper.isInPickupRange(trackedPlayer, locationX, locationY, locationZ)) {
|
||||
if (CollisionHelper.isInPickupRange(trackedPlayer, positionX, positionY, positionZ)) {
|
||||
line.onPickup(trackedPlayer);
|
||||
}
|
||||
}
|
||||
@ -118,17 +118,17 @@ public class ItemLineTracker extends ClickableLineTracker<BaseItemLine> {
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
@Override
|
||||
protected void addLocationChangePackets(NMSPacketList packetList) {
|
||||
super.addLocationChangePackets(packetList);
|
||||
protected void addPositionChangePackets(NMSPacketList packetList) {
|
||||
super.addPositionChangePackets(packetList);
|
||||
|
||||
if (spawnItemEntities) {
|
||||
packetList.addTeleportPackets(vehicleEntityID, locationX, getItemLocationY(), locationZ);
|
||||
packetList.addTeleportPackets(vehicleEntityID, positionX, getItemPositionY(), positionZ);
|
||||
}
|
||||
}
|
||||
|
||||
private void addItemSpawnPackets(NMSPacketList packetList) {
|
||||
packetList.addArmorStandSpawnPackets(vehicleEntityID, locationX, getItemLocationY(), locationZ);
|
||||
packetList.addItemSpawnPackets(itemEntityID, locationX, getItemLocationY(), locationZ, itemStack);
|
||||
packetList.addArmorStandSpawnPackets(vehicleEntityID, positionX, getItemPositionY(), positionZ);
|
||||
packetList.addItemSpawnPackets(itemEntityID, positionX, getItemPositionY(), positionZ, itemStack);
|
||||
packetList.addMountPackets(vehicleEntityID, itemEntityID);
|
||||
}
|
||||
|
||||
@ -136,8 +136,8 @@ public class ItemLineTracker extends ClickableLineTracker<BaseItemLine> {
|
||||
packetList.addEntityDestroyPackets(itemEntityID, vehicleEntityID);
|
||||
}
|
||||
|
||||
private double getItemLocationY() {
|
||||
return locationY;
|
||||
private double getItemPositionY() {
|
||||
return positionY;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,37 +12,37 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
||||
|
||||
abstract class LocationBasedLineTracker<T extends BaseHologramLine> extends LineTracker<T> {
|
||||
abstract class PositionBasedLineTracker<T extends BaseHologramLine> extends LineTracker<T> {
|
||||
|
||||
private static final int ENTITY_VIEW_RANGE = 64;
|
||||
|
||||
protected double locationX;
|
||||
protected double locationY;
|
||||
protected double locationZ;
|
||||
private boolean locationChanged;
|
||||
protected double positionX;
|
||||
protected double positionY;
|
||||
protected double positionZ;
|
||||
private boolean positionChanged;
|
||||
|
||||
LocationBasedLineTracker(T line, NMSManager nmsManager) {
|
||||
PositionBasedLineTracker(T line, NMSManager nmsManager) {
|
||||
super(line, nmsManager);
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
@Override
|
||||
protected void detectChanges() {
|
||||
double locationX = line.getX();
|
||||
double locationY = line.getY();
|
||||
double locationZ = line.getZ();
|
||||
if (this.locationX != locationX || this.locationY != locationY || this.locationZ != locationZ) {
|
||||
this.locationX = locationX;
|
||||
this.locationY = locationY;
|
||||
this.locationZ = locationZ;
|
||||
this.locationChanged = true;
|
||||
double positionX = line.getX();
|
||||
double positionY = line.getY();
|
||||
double positionZ = line.getZ();
|
||||
if (this.positionX != positionX || this.positionY != positionY || this.positionZ != positionZ) {
|
||||
this.positionX = positionX;
|
||||
this.positionY = positionY;
|
||||
this.positionZ = positionZ;
|
||||
this.positionChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
@Override
|
||||
protected void clearDetectedChanges() {
|
||||
this.locationChanged = false;
|
||||
this.positionChanged = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -52,8 +52,8 @@ abstract class LocationBasedLineTracker<T extends BaseHologramLine> extends Line
|
||||
return false;
|
||||
}
|
||||
|
||||
double diffX = Math.abs(playerLocation.getX() - locationX);
|
||||
double diffZ = Math.abs(playerLocation.getZ() - locationZ);
|
||||
double diffX = Math.abs(playerLocation.getX() - positionX);
|
||||
double diffZ = Math.abs(playerLocation.getZ() - positionZ);
|
||||
|
||||
return diffX <= (double) ENTITY_VIEW_RANGE
|
||||
&& diffZ <= (double) ENTITY_VIEW_RANGE
|
||||
@ -63,11 +63,11 @@ abstract class LocationBasedLineTracker<T extends BaseHologramLine> extends Line
|
||||
@MustBeInvokedByOverriders
|
||||
@Override
|
||||
protected void addChangesPackets(NMSPacketList packetList) {
|
||||
if (locationChanged) {
|
||||
addLocationChangePackets(packetList);
|
||||
if (positionChanged) {
|
||||
addPositionChangePackets(packetList);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void addLocationChangePackets(NMSPacketList packetList);
|
||||
protected abstract void addPositionChangePackets(NMSPacketList packetList);
|
||||
|
||||
}
|
@ -77,11 +77,11 @@ public class TextLineTracker extends ClickableLineTracker<BaseTextLine> {
|
||||
super.addSpawnPackets(packetList);
|
||||
|
||||
if (!allowPlaceholders) {
|
||||
packetList.addArmorStandSpawnPackets(armorStandEntityID, locationX, getArmorStandLocationY(), locationZ, displayText.getWithoutReplacements());
|
||||
packetList.addArmorStandSpawnPackets(armorStandEntityID, positionX, getArmorStandPositionY(), positionZ, displayText.getWithoutReplacements());
|
||||
} else if (displayText.containsIndividualPlaceholders()) {
|
||||
packetList.addArmorStandSpawnPackets(armorStandEntityID, locationX, getArmorStandLocationY(), locationZ, displayText::getWithIndividualReplacements);
|
||||
packetList.addArmorStandSpawnPackets(armorStandEntityID, positionX, getArmorStandPositionY(), positionZ, displayText::getWithIndividualReplacements);
|
||||
} else {
|
||||
packetList.addArmorStandSpawnPackets(armorStandEntityID, locationX, getArmorStandLocationY(), locationZ, displayText.getWithGlobalReplacements());
|
||||
packetList.addArmorStandSpawnPackets(armorStandEntityID, positionX, getArmorStandPositionY(), positionZ, displayText.getWithGlobalReplacements());
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,13 +109,13 @@ public class TextLineTracker extends ClickableLineTracker<BaseTextLine> {
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
@Override
|
||||
protected void addLocationChangePackets(NMSPacketList packetList) {
|
||||
super.addLocationChangePackets(packetList);
|
||||
packetList.addTeleportPackets(armorStandEntityID, locationX, getArmorStandLocationY(), locationZ);
|
||||
protected void addPositionChangePackets(NMSPacketList packetList) {
|
||||
super.addPositionChangePackets(packetList);
|
||||
packetList.addTeleportPackets(armorStandEntityID, positionX, getArmorStandPositionY(), positionZ);
|
||||
}
|
||||
|
||||
private double getArmorStandLocationY() {
|
||||
return locationY - 0.29;
|
||||
private double getArmorStandPositionY() {
|
||||
return positionY - 0.29;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user