keaft

Untitled

Jan 24th, 2022
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 2.06 KB | None | 0 0
  1. #Name: events.zs
  2. #Author: Keaft
  3.  
  4. import crafttweaker.events.IEventManager;
  5. import crafttweaker.command.ICommandManager;
  6. import crafttweaker.event.IEventCancelable;
  7. import crafttweaker.item.IItemStack;
  8. import crafttweaker.block.IBlock;
  9.  
  10. print("Initializing 'events'...");
  11.  
  12. function merge(array1 as string[], array2 as string[]) as string[]{
  13.     for stringitem in array1 {
  14.         array2 += stringitem;
  15.     }
  16.     return array2;
  17. }
  18.  
  19. var droptorches as string[] = [
  20.     "minecraft:torch",
  21.     "atum:palm_torch",
  22.     "atum:deadwood_torch",
  23.     "atum:limestone_torch",
  24.     "atum:bone_torch",
  25.     "atum:pharaoh_torch",
  26.     "inspirations:torch_lever",
  27.     "aether_legacy:ambrosium_torch",
  28.     "thebetweenlands:sulfur_torch",
  29.     "tconstruct:stone_torch",
  30.     "torchmaster:mega_torch",
  31.     // "torchmaster:mega_torch:1",
  32.     "torchmaster:terrain_lighter"
  33. ];
  34.  
  35. // Just cancel the event as this uses unique circumstances of placing light sources. Supremium axe for instance.
  36. var canceltorches as string[] = [
  37.     "mysticalagriculture:miners_torch"
  38. ];
  39.  
  40. var alltorches as string[] = merge(droptorches, canceltorches);
  41.  
  42. events.onBlockPlace(function(weaklightbeneath as crafttweaker.event.BlockPlaceEvent){
  43.     print(weaklightbeneath.block.definition.id);
  44.     if (weaklightbeneath.player.dimension == 66){
  45.         for itemCheck in alltorches {
  46.             if(weaklightbeneath.block.definition.id == itemCheck){
  47.                 weaklightbeneath.player.sendStatusMessage("The atmosphere extinguishes the flame.");
  48.                 weaklightbeneath.player.dropItem(true);
  49.                 weaklightbeneath.cancel();
  50.             }
  51.         }
  52.     }
  53. });
  54.  
  55. // var playercheck = weaklightbeneath.player;
  56.         // var itemcheck = weaklightbeneath.block;
  57.         // print(playercheck.name as string);
  58.         // print(playercheck.dimension as string);
  59.         // print(itemcheck.definition.displayName as string);
  60.         // playercheck.dropItem(true);
  61.         // weaklightbeneath.cancel();
  62.         // playercheck.dropItem(<minecraft:torch>);
  63.  
  64. print("Initialized 'events'");
Advertisement
Add Comment
Please, Sign In to add comment