@@ -42,7 +42,9 @@ void HookNpcLoot(MonoModder modder)
4242 ) ;
4343
4444 NewNPC . Emit ( OpCodes . Ldarg_0 ) ; // NPC instance
45- #if TerrariaServer_EntitySourcesActive || Terraria_EntitySourcesActive || tModLoader_EntitySourcesActive
45+ #if TerrariaServer_1450_OrAbove || Terraria__1450_OrAbove || tModLoader_1450_OrAbove
46+ NewNPC . Next . Operand = modder . GetMethodDefinition ( ( ) => OTAPI . Hooks . NPC . InvokeDropLoot ( default , default , default , default , default , default , default , default , default , default , default ) ) ;
47+ #elif TerrariaServer_EntitySourcesActive || Terraria_EntitySourcesActive || tModLoader_EntitySourcesActive
4648 NewNPC . Next . Operand = modder . GetMethodDefinition ( ( ) => OTAPI . Hooks . NPC . InvokeDropLoot ( default , default , default , default , default , default , default , default , default , default , default , default ) ) ;
4749#else
4850 NewNPC . Next . Operand = modder . GetMethodDefinition ( ( ) => OTAPI . Hooks . NPC . InvokeDropLoot ( default , default , default , default , default , default , default , default , default , default , default ) ) ;
@@ -74,6 +76,9 @@ public class DropLootEventArgs : EventArgs
7476 public bool NoBroadcast { get ; set ; }
7577 public int Pfix { get ; set ; }
7678 public bool NoGrabDelay { get ; set ; }
79+ #if TerrariaServer_1450_OrAbove || Terraria__1450_OrAbove || tModLoader_1450_OrAbove
80+ [ Obsolete ( "ReverseLookup is no longer used in Terraria 1.4.5 and above, but is kept for API compatibility." ) ]
81+ #endif
7782 public bool ReverseLookup { get ; set ; }
7883 }
7984 public static event EventHandler < DropLootEventArgs > ? DropLoot ;
@@ -83,7 +88,12 @@ public static int InvokeDropLoot(Terraria.DataStructures.IEntitySource source, i
8388#else
8489 public static int InvokeDropLoot ( int X , int Y , int Width , int Height , int Type ,
8590#endif
91+
92+ #if TerrariaServer_1450_OrAbove || Terraria__1450_OrAbove || tModLoader_1450_OrAbove
93+ int Stack , bool noBroadcast , int pfix , bool noGrabDelay ,
94+ #else
8695 int Stack , bool noBroadcast , int pfix , bool noGrabDelay , bool reverseLookup ,
96+ #endif
8797 Terraria . NPC instance )
8898 {
8999 var args = new DropLootEventArgs ( )
@@ -101,15 +111,21 @@ public static int InvokeDropLoot(int X, int Y, int Width, int Height, int Type,
101111 NoBroadcast = noBroadcast ,
102112 Pfix = pfix ,
103113 NoGrabDelay = noGrabDelay ,
114+ #if TerrariaServer_1450_OrAbove || Terraria__1450_OrAbove || tModLoader_1450_OrAbove
115+ ReverseLookup = false , // no longer used, but kept for api compatibility.
116+ #else
104117 ReverseLookup = reverseLookup ,
118+ #endif
105119 Npc = instance,
106120
107121 ItemIndex = 0 ,
108122 } ;
109123 DropLoot ? . Invoke ( null , args ) ;
110124 if ( args . Result ! = HookResult . Cancel )
111125 {
112- #if TerrariaServer_EntitySourcesActive || Terraria_EntitySourcesActive || tModLoader_EntitySourcesActive
126+ #if TerrariaServer_1450_OrAbove || Terraria__1450_OrAbove || tModLoader_1450_OrAbove
127+ args . ItemIndex = Terraria . Item . NewItem ( args . Source , X , Y , Width , Height , Type , Stack , noBroadcast , pfix , noGrabDelay ) ;
128+ #elif TerrariaServer_EntitySourcesActive || Terraria_EntitySourcesActive || tModLoader_EntitySourcesActive
113129 args . ItemIndex = Terraria . Item . NewItem ( args . Source , X , Y , Width , Height , Type , Stack , noBroadcast , pfix , noGrabDelay , reverseLookup ) ;
114130#else
115131 args . ItemIndex = Terraria . Item . NewItem ( X , Y , Width , Height , Type , Stack , noBroadcast , pfix , noGrabDelay , reverseLookup ) ;
0 commit comments