Guest User

GetBlockActivationCommands

a guest
Dec 7th, 2019
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 KB | None | 0 0
  1. public override BlockActivationCommand[] GetBlockActivationCommands(WorldBase _world, BlockValue _blockValue, int _clrIdx, Vector3i _blockPos, EntityAlive _entityFocusing)
  2. {
  3.     bool flag = false;
  4.     ChunkCluster chunkCluster = _world.ChunkClusters[_clrIdx];
  5.     if (chunkCluster != null)
  6.     {
  7.         IChunk chunkSync = chunkCluster.GetChunkSync(World.toChunkXZ(_blockPos.x), World.toChunkY(_blockPos.y), World.toChunkXZ(_blockPos.z));
  8.         if (chunkSync != null)
  9.         {
  10.             BlockEntityData blockEntity = chunkSync.GetBlockEntity(_blockPos);
  11.             if (blockEntity != null && blockEntity.bHasTransform)
  12.             {
  13.                 Transform transform = blockEntity.transform.Find("MainLight");
  14.                 if (transform != null)
  15.                 {
  16.                     LightLOD component = transform.GetComponent<LightLOD>();
  17.                     if (component != null && component.GetLight() != null)
  18.                     {
  19.                         flag = true;
  20.                     }
  21.                 }
  22.             }
  23.         }
  24.     }
  25.     _world.IsMyLandProtectedBlock(_blockPos, _world.GetGameManager().GetPersistentLocalPlayer(), false);
  26.     this.cmds[0].enabled = (_world.IsEditor() || this.bRuntimeSwitch);
  27.     this.cmds[1].enabled = (_world.IsEditor() && flag);
  28.     return this.cmds;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment