Esempio n. 1
0
 public Utilities(ICoreAPI api)
 {
     world       = api.World;
     bA          = api.World.BlockAccessor;
     cardinal    = AreaMethods.SphericalOffsetList(1).ToArray();
     supportarea = AreaMethods.LargeAreaBelowOffsetList().ToArray();
 }
Esempio n. 2
0
        public override void OnLoaded(ICoreAPI api)
        {
            util = new Utilities(api);
            base.OnLoaded(api);
            blockReinforcement = api.ModLoader.GetModSystem <ModSystemBlockReinforcement>();

            offset   = AreaMethods.AreaBelowOffsetList().ToArray();
            cardinal = AreaMethods.SphericalOffsetList(1).ToArray();
        }
Esempio n. 3
0
        public override void OnBlockRemoved(IWorldAccessor world, BlockPos pos, ref EnumHandling handling)
        {
            cardinal = cardinal ?? AreaMethods.SphericalOffsetList(1).ToArray(); //if for whatever reason it's null
            offset   = offset ?? AreaMethods.AreaBelowOffsetList().ToArray();

            if (world.Side.IsServer())
            {
                for (int i = 0; i < cardinal.Length; i++)
                {
                    if (world.BlockAccessor.GetBlock(pos.AddCopy(cardinal[i])).Id != 0)
                    {
                        world.BlockAccessor.GetBlock(pos.AddCopy(cardinal[i])).GetBehavior <AlteredBlockPhysics>()?.TryCollapse(world, pos.AddCopy(cardinal[i]));
                        world.BlockAccessor.GetBlock(pos.AddCopy(cardinal[i])).OnNeighourBlockChange(world, pos.AddCopy(cardinal[i]), pos);
                    }
                }
                TryCollapse(world, pos);
            }
            base.OnBlockRemoved(world, pos, ref handling);
        }