Ejemplo n.º 1
0
    public override void OnBlockLoaded(WorldBase _world, int _clrIdx, Vector3i _blockPos, BlockValue _blockValue)
    {
        if (_blockValue.ischild)
        {
            return;
        }

        this.shape.OnBlockLoaded(_world, _clrIdx, _blockPos, _blockValue);

        // Try to get BlockEntityData
        ChunkCluster chunkCluster = _world.ChunkClusters[_clrIdx];

        if (chunkCluster == null)
        {
            DebugMsg("BlockDummyBoat OnBlockLoaded: ChunkCluster is NULL, aborting. Cannot find and set Boat.");
            return;
        }
        Chunk           chunk           = (Chunk)chunkCluster.GetChunkFromWorldPos(_blockPos);
        BlockEntityData blockEntityData = chunk.GetBlockEntity(_blockPos);

        // Try to find closest Boat, then set and offset it
        DebugMsg("BlockDummyBoat OnBlockLoaded: Entity count = " + GameManager.Instance.World.Entities.list.Count.ToString());
        if (!FindSetAndOffsetAssignedBoat(_clrIdx, _blockPos, _blockValue, blockEntityData) && GameManager.Instance.World.Entities.list.Count > 0)
        {
            // Destroying on Load output errors so I moved Destroy Orphans to OnBlockEntityTransformBeforeActivated
            DebugMsg("BlockDummyBoat OnBlockLoaded: No Boat close enough, skipping.");
        }
    }
Ejemplo n.º 2
0
    public BlockEntityData GetBlockEntityData(WorldBase _world, Vector3i _blockPos, int _clrIdx)
    {
        // Try to get BlockEntityData
        ChunkCluster chunkCluster = _world.ChunkClusters[_clrIdx];

        if (chunkCluster == null)
        {
            DebugMsg("BlockDummyBoat GetBlockEntityData: ChunkCluster is NULL.");
            return(null);
        }
        DebugMsg("BlockDummyBoat GetBlockEntityData: Getting BlockEntityData.");
        Chunk chunk = (Chunk)chunkCluster.GetChunkFromWorldPos(_blockPos);

        return(chunk.GetBlockEntity(_blockPos));
    }