22
33import com .google .gson .Gson ;
44import com .google .gson .GsonBuilder ;
5- import dev .architectury .event .CompoundEventResult ;
65import dev .architectury .event .EventResult ;
76import dev .architectury .event .events .common .*;
87import dev .architectury .hooks .level .entity .PlayerHooks ;
1312import dev .architectury .utils .Env ;
1413import dev .architectury .utils .EnvExecutor ;
1514import dev .architectury .utils .value .IntValue ;
16- import dev .ftb .mods .ftbchunks .api .*;
15+ import dev .ftb .mods .ftbchunks .api .ClaimedChunk ;
16+ import dev .ftb .mods .ftbchunks .api .FTBChunksAPI ;
17+ import dev .ftb .mods .ftbchunks .api .FTBChunksProperties ;
18+ import dev .ftb .mods .ftbchunks .api .Protection ;
1719import dev .ftb .mods .ftbchunks .client .FTBChunksClient ;
1820import dev .ftb .mods .ftbchunks .client .FTBChunksClientConfig ;
1921import dev .ftb .mods .ftbchunks .data .*;
2022import dev .ftb .mods .ftbchunks .net .*;
21- import dev .ftb .mods .ftbchunks .data .ChunkSyncInfo ;
2223import dev .ftb .mods .ftblibrary .config .manager .ConfigManager ;
2324import dev .ftb .mods .ftblibrary .integration .stages .StageHelper ;
2425import dev .ftb .mods .ftblibrary .math .ChunkDimPos ;
3940import net .minecraft .server .level .ServerPlayer ;
4041import net .minecraft .stats .Stats ;
4142import net .minecraft .world .InteractionHand ;
43+ import net .minecraft .world .InteractionResult ;
4244import net .minecraft .world .damagesource .DamageSource ;
4345import net .minecraft .world .entity .Entity ;
46+ import net .minecraft .world .entity .EntitySpawnReason ;
4447import net .minecraft .world .entity .LivingEntity ;
45- import net .minecraft .world .entity .MobSpawnType ;
4648import net .minecraft .world .entity .player .Player ;
4749import net .minecraft .world .item .BlockItem ;
4850import net .minecraft .world .item .ItemStack ;
49- import net .minecraft .world .level .BaseSpawner ;
50- import net .minecraft .world .level .Explosion ;
51- import net .minecraft .world .level .Level ;
52- import net .minecraft .world .level .LevelAccessor ;
51+ import net .minecraft .world .level .*;
5352import net .minecraft .world .level .block .Block ;
5453import net .minecraft .world .level .block .state .BlockState ;
5554import net .minecraft .world .phys .BlockHitResult ;
@@ -268,17 +267,17 @@ private void teamSaved(TeamEvent teamEvent) {
268267 ClaimedChunkManagerImpl .getInstance ().getOrCreateData (teamEvent .getTeam ()).saveNow ();
269268 }
270269
271- public EventResult blockLeftClick (Player player , InteractionHand hand , BlockPos pos , Direction face ) {
270+ public InteractionResult blockLeftClick (Player player , InteractionHand hand , BlockPos pos , Direction face ) {
272271 // calling architectury stub method
273272 //noinspection ConstantConditions
274273 if (player instanceof ServerPlayer && ClaimedChunkManagerImpl .getInstance ().shouldPreventInteraction (player , hand , pos , FTBChunksExpected .getBlockBreakProtection (), null )) {
275- return EventResult . interruptFalse () ;
274+ return InteractionResult . FAIL ;
276275 }
277276
278- return EventResult . pass () ;
277+ return InteractionResult . PASS ;
279278 }
280279
281- public EventResult blockRightClick (Player player , InteractionHand hand , BlockPos pos , Direction face ) {
280+ public InteractionResult blockRightClick (Player player , InteractionHand hand , BlockPos pos , Direction face ) {
282281 // calling architectury stub method
283282 //noinspection ConstantConditions
284283 if (player instanceof ServerPlayer sp ) {
@@ -290,20 +289,20 @@ public EventResult blockRightClick(Player player, InteractionHand hand, BlockPos
290289 || blockItem && mgr .shouldPreventInteraction (player , hand , pos , FTBChunksExpected .getBlockPlaceProtection (), null ))
291290 {
292291 FTBCUtils .forceHeldItemSync (sp , hand );
293- return EventResult . interruptFalse () ;
292+ return InteractionResult . FAIL ;
294293 }
295294 }
296295
297- return EventResult . pass () ;
296+ return InteractionResult . PASS ;
298297 }
299298
300- public CompoundEventResult < ItemStack > itemRightClick (Player player , InteractionHand hand ) {
299+ public InteractionResult itemRightClick (Player player , InteractionHand hand ) {
301300 if (player instanceof ServerPlayer sp && ClaimedChunkManagerImpl .getInstance ().shouldPreventInteraction (player , hand , BlockPos .containing (player .getEyePosition (1F )), Protection .RIGHT_CLICK_ITEM , null )) {
302301 FTBCUtils .forceHeldItemSync (sp , hand );
303- return CompoundEventResult . interruptFalse ( player . getItemInHand ( hand )) ;
302+ return InteractionResult . FAIL ;
304303 }
305304
306- return CompoundEventResult . pass () ;
305+ return InteractionResult . PASS ;
307306 }
308307
309308
@@ -334,23 +333,23 @@ public EventResult blockPlace(Level level, BlockPos pos, BlockState blockState,
334333 return EventResult .pass ();
335334 }
336335
337- public CompoundEventResult < ItemStack > fillBucket (Player player , Level level , ItemStack emptyBucket , @ Nullable HitResult target ) {
336+ public InteractionResult fillBucket (Player player , Level level , ItemStack emptyBucket , @ Nullable HitResult target ) {
338337 if (player instanceof ServerPlayer && target instanceof BlockHitResult hitResult ) {
339338 InteractionHand hand = player .getUsedItemHand ();
340339 if (ClaimedChunkManagerImpl .getInstance ().shouldPreventInteraction (player , hand , hitResult .getBlockPos (), Protection .EDIT_FLUID , null )) {
341- return CompoundEventResult . interrupt ( false , player . getItemInHand ( hand )) ;
340+ return InteractionResult . FAIL ;
342341 }
343342 }
344343
345- return CompoundEventResult . pass () ;
344+ return InteractionResult . PASS ;
346345 }
347346
348- public EventResult farmlandTrample (Level world , BlockPos pos , BlockState blockState , float distance , Entity entity ) {
347+ public InteractionResult farmlandTrample (Level world , BlockPos pos , BlockState blockState , double distance , Entity entity ) {
349348 if (entity instanceof ServerPlayer && ClaimedChunkManagerImpl .getInstance ().shouldPreventInteraction (entity , InteractionHand .MAIN_HAND , pos , Protection .EDIT_BLOCK , null )) {
350- return EventResult . interrupt ( false ) ;
349+ return InteractionResult . FAIL ;
351350 }
352351
353- return EventResult . pass () ;
352+ return InteractionResult . PASS ;
354353 }
355354
356355 // This event is a nightmare, gets fired before login
@@ -367,7 +366,7 @@ public void enterSection(Entity entity, int chunkX, int chunkY, int chunkZ, int
367366 });
368367 }
369368
370- public EventResult checkSpawn (LivingEntity entity , LevelAccessor levelAccessor , double x , double y , double z , MobSpawnType type , @ Nullable BaseSpawner spawner ) {
369+ public EventResult checkSpawn (LivingEntity entity , LevelAccessor levelAccessor , double x , double y , double z , EntitySpawnReason type , @ Nullable BaseSpawner spawner ) {
371370 if (!levelAccessor .isClientSide () && !(entity instanceof Player ) && levelAccessor instanceof Level level ) {
372371 switch (type ) {
373372 case NATURAL , CHUNK_GENERATION , SPAWNER , STRUCTURE , JOCKEY , PATROL -> {
0 commit comments