3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

Only apply the 'Hologram patch' to small entities since it only happens to them.

Only apply the 'Hologram patch' to small entities (Doesn't fix issue but hey)
Dieser Commit ist enthalten in:
Mats 2016-04-04 16:55:48 +02:00 committet von Myles
Ursprung c7c6ee9fbc
Commit 5032e7d07e

Datei anzeigen

@ -89,21 +89,21 @@ public class EntityTracker extends StoredObject {
} }
public boolean interactedBlockRecently(int x, int y, int z) { public boolean interactedBlockRecently(int x, int y, int z) {
if(blockInteractions.size() == 0) if (blockInteractions.size() == 0)
return false; return false;
Iterator<Position> it = blockInteractions.asMap().keySet().iterator(); Iterator<Position> it = blockInteractions.asMap().keySet().iterator();
while(it.hasNext()) { while (it.hasNext()) {
Position p = it.next(); Position p = it.next();
if(p.getX() == x) if (p.getX() == x)
if(p.getY() == y) if (p.getY() == y)
if(p.getZ() == z) if (p.getZ() == z)
return true; return true;
} }
return false; return false;
} }
public void addBlockInteraction(Position p) { public void addBlockInteraction(Position p) {
blockInteractions.put(p,Material.AIR); blockInteractions.put(p, Material.AIR);
} }
public void handleMetadata(int entityID, List<Metadata> metadataList) { public void handleMetadata(int entityID, List<Metadata> metadataList) {
@ -143,9 +143,10 @@ public class EntityTracker extends StoredObject {
} }
} }
if (type == EntityType.ARMOR_STAND && ((ViaVersionPlugin) ViaVersion.getInstance()).isHologramPatch()) { if (type == EntityType.ARMOR_STAND && ((ViaVersionPlugin) ViaVersion.getInstance()).isHologramPatch()) {
if (metadata.getId() == 0) { if (metadata.getId() == 0 && getMetaByIndex(metadataList, 10) != null) {
Metadata meta = getMetaByIndex(metadataList, 10); //Only happens if the armorstand is small
byte data = (byte) metadata.getValue(); byte data = (byte) metadata.getValue();
if ((data & 0x20) == 0x20) { if ((data & 0x20) == 0x20 && ((byte) meta.getValue() & 0x01) == 0x01) {
if (!knownHolograms.contains(entityID)) { if (!knownHolograms.contains(entityID)) {
knownHolograms.add(entityID); knownHolograms.add(entityID);
try { try {
@ -200,6 +201,13 @@ public class EntityTracker extends StoredObject {
} }
} }
public Metadata getMetaByIndex(List<Metadata> list, int index) {
for (Metadata meta : list)
if (index == meta.getId())
return meta;
return null;
}
public void sendTeamPacket(boolean b) { public void sendTeamPacket(boolean b) {
PacketWrapper wrapper = new PacketWrapper(0x41, null, getUser()); PacketWrapper wrapper = new PacketWrapper(0x41, null, getUser());
wrapper.write(Type.STRING, "viaversion"); // Use viaversion as name wrapper.write(Type.STRING, "viaversion"); // Use viaversion as name