Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
AssemblyReferenceHandle.cs
Go to the documentation of this file.
2
3public readonly struct AssemblyReferenceHandle : IEquatable<AssemblyReferenceHandle>
4{
15
16 private readonly uint _value;
17
18 internal uint Value => _value;
19
20 private uint VToken => _value | 0x23000000u;
21
22 public bool IsNil => _value == 0;
23
24 internal bool IsVirtual => (_value & 0x80000000u) != 0;
25
26 internal int RowId => (int)(_value & 0xFFFFFF);
27
29 {
30 _value = value;
31 }
32
33 internal static AssemblyReferenceHandle FromRowId(int rowId)
34 {
35 return new AssemblyReferenceHandle((uint)rowId);
36 }
37
39 {
40 return new AssemblyReferenceHandle(0x80000000u | (uint)virtualIndex);
41 }
42
43 public static implicit operator Handle(AssemblyReferenceHandle handle)
44 {
45 return Handle.FromVToken(handle.VToken);
46 }
47
48 public static implicit operator EntityHandle(AssemblyReferenceHandle handle)
49 {
50 return new EntityHandle(handle.VToken);
51 }
52
53 public static explicit operator AssemblyReferenceHandle(Handle handle)
54 {
55 if (handle.Type != 35)
56 {
58 }
59 return new AssemblyReferenceHandle(handle.SpecificEntityHandleValue);
60 }
61
62 public static explicit operator AssemblyReferenceHandle(EntityHandle handle)
63 {
64 if (handle.Type != 587202560)
65 {
67 }
68 return new AssemblyReferenceHandle(handle.SpecificHandleValue);
69 }
70
72 {
73 return left._value == right._value;
74 }
75
76 public override bool Equals(object? obj)
77 {
79 {
80 return ((AssemblyReferenceHandle)obj)._value == _value;
81 }
82 return false;
83 }
84
86 {
87 return _value == other._value;
88 }
89
90 public override int GetHashCode()
91 {
92 return _value.GetHashCode();
93 }
94
96 {
97 return left._value != right._value;
98 }
99}
static void InvalidCast()
Definition Throw.cs:12
static AssemblyReferenceHandle FromRowId(int rowId)
static bool operator!=(AssemblyReferenceHandle left, AssemblyReferenceHandle right)
static bool operator==(AssemblyReferenceHandle left, AssemblyReferenceHandle right)
static AssemblyReferenceHandle FromVirtualIndex(VirtualIndex virtualIndex)
static Handle FromVToken(uint vToken)
Definition Handle.cs:52