supersaiyansubtlety

player-interact-again.zs

Feb 15th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. import crafttweaker.event.PlayerInteractEvent;
  2. import crafttweaker.event.PlayerInteractBlockEvent;
  3. import crafttweaker.event.PlayerInteractEntityEvent;
  4. import crafttweaker.event.EntityLivingUseItemEvent.Start;
  5. import crafttweaker.entity.IEntityLiving;
  6. import crafttweaker.entity.IEntityEquipmentSlot as slots;
  7. import crafttweaker.server.IServer;
  8. import crafttweaker.block.IBlock;
  9. import crafttweaker.entity.IEntity;
  10. import crafttweaker.world.IFacing;
  11. /* import crafttweaker.command.ICommand; */
  12. import crafttweaker.command.ICommandSender;
  13. import mods.ctutils.utils.Math;
  14. import scripts.player_interact_statics as stats;
  15.  
  16.  
  17. events.onPlayerInteract(function(event as PlayerInteractEvent)
  18. {
  19. /* print("PlayerInteract");
  20. print("PlayerInteractEvent is PlayerInteractBlockEvent: "~((event instanceof PlayerInteractBlockEvent) as string));
  21. print("PlayerInteractEvent is PlayerInteractEntityEvent: "~((event instanceof PlayerInteractEntityEvent) as string)); */
  22.  
  23. if(!event.player.world.isRemote()) { return; }
  24. print("PlayerInteract block: "~event.block.definition.id);
  25. print("Player blockPos y-1 block: "~event.world.getBlock((event.player as IEntity).position.getOffset(IFacing.down(), 1)).definition.id);
  26.  
  27. print("event.block == event.world.getBlock y-1 ([] has)?: "~((([event.block] as IBlock []) has event.world.getBlock((event.player as IEntity).position.getOffset(IFacing.down(), 1))) as string));
  28. print("event.block == event.world.getBlock y-1 (has)?: "~((event.block has event.world.getBlock((event.player as IEntity).position.getOffset(IFacing.down(), 1))) as string));
  29. /* print("event.block == event.world.getBlock y-1 (==)?: "~((event.block == event.world.getBlock((event.player as IEntity).position.getOffset(IFacing.down(), 1))) as string)); */
  30.  
  31. print("current item: "~event.player.currentItem.definition.id);
  32. if (event.player.currentItem.definition.id == <minecraft:fire_charge>.definition.id)
  33. {
  34. print("fire charge used!");
  35.  
  36. server.commandManager.executeCommand(event.player, "summon small_fireball "~(event.player.x as string)~" "~(event.player.y+3 as string)~" "~(event.player.z as string)~" {direction:[0.0,0.0,0.0],power:[0.1,0.0, 0.0]}");
  37.  
  38. }
  39. });
  40.  
  41.  
  42.  
  43.  
  44. /* val direction as
  45. eyeHeight
  46. heldEquipment
  47. rotationYaw
  48. rotationPitch
  49. lookingDirection */
Add Comment
Please, Sign In to add comment