Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ExportedTypeHandle.cs
Go to the documentation of this file.
2
3public readonly struct ExportedTypeHandle : IEquatable<ExportedTypeHandle>
4{
5 private readonly int _rowId;
6
7 public bool IsNil => RowId == 0;
8
9 internal int RowId => _rowId;
10
11 private ExportedTypeHandle(int rowId)
12 {
13 _rowId = rowId;
14 }
15
16 internal static ExportedTypeHandle FromRowId(int rowId)
17 {
18 return new ExportedTypeHandle(rowId);
19 }
20
21 public static implicit operator Handle(ExportedTypeHandle handle)
22 {
23 return new Handle(39, handle._rowId);
24 }
25
26 public static implicit operator EntityHandle(ExportedTypeHandle handle)
27 {
28 return new EntityHandle((uint)(0x27000000uL | (ulong)handle._rowId));
29 }
30
31 public static explicit operator ExportedTypeHandle(Handle handle)
32 {
33 if (handle.VType != 39)
34 {
36 }
37 return new ExportedTypeHandle(handle.RowId);
38 }
39
40 public static explicit operator ExportedTypeHandle(EntityHandle handle)
41 {
42 if (handle.VType != 654311424)
43 {
45 }
46 return new ExportedTypeHandle(handle.RowId);
47 }
48
49 public static bool operator ==(ExportedTypeHandle left, ExportedTypeHandle right)
50 {
51 return left._rowId == right._rowId;
52 }
53
54 public override bool Equals(object? obj)
55 {
57 {
58 return ((ExportedTypeHandle)obj)._rowId == _rowId;
59 }
60 return false;
61 }
62
64 {
65 return _rowId == other._rowId;
66 }
67
68 public override int GetHashCode()
69 {
70 return _rowId.GetHashCode();
71 }
72
73 public static bool operator !=(ExportedTypeHandle left, ExportedTypeHandle right)
74 {
75 return left._rowId != right._rowId;
76 }
77}
static void InvalidCast()
Definition Throw.cs:12
static bool operator!=(ExportedTypeHandle left, ExportedTypeHandle right)
static bool operator==(ExportedTypeHandle left, ExportedTypeHandle right)
static ExportedTypeHandle FromRowId(int rowId)