From f5a418b99176b9de2e8ed3af6b9fc1100e0831c0 Mon Sep 17 00:00:00 2001 From: bob Date: Tue, 22 Oct 2024 23:20:12 +0000 Subject: [PATCH] thusfar --- src/Nether/Atlantis/Struct/PrototypeIndex.php | 5 ++++- src/Nether/Atlantis/Tag/EntityLink.php | 12 +++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Nether/Atlantis/Struct/PrototypeIndex.php b/src/Nether/Atlantis/Struct/PrototypeIndex.php index 5a7a4314..ab154fb7 100644 --- a/src/Nether/Atlantis/Struct/PrototypeIndex.php +++ b/src/Nether/Atlantis/Struct/PrototypeIndex.php @@ -114,10 +114,13 @@ static public function static public function FetchTypeForUUID(string $UUID): - string { + ?string { $PIndex = static::GetByField('UUID', $UUID); + if(!$PIndex) + return NULL; + return $PIndex->Type; } diff --git a/src/Nether/Atlantis/Tag/EntityLink.php b/src/Nether/Atlantis/Tag/EntityLink.php index 2f74ec90..70e5f6f4 100755 --- a/src/Nether/Atlantis/Tag/EntityLink.php +++ b/src/Nether/Atlantis/Tag/EntityLink.php @@ -248,14 +248,24 @@ static public function ]; } - static public function GetTypeByEntityClass(string $CName): string { + $EntProp = NULL; + + //////// + + foreach(static::$TypeList as $LinkType => $LinkClass) { + try { $EntProp = ($LinkClass)::EntityProperty($LinkClass); } + catch(Exception $E) { } + if($EntProp->Type === $CName) + return $LinkType; + } throw new Exception("no type found for $CName"); + return ''; }