Exemplo n.º 1
0
        public static bool OnTryChangeBlockUser(ModLoader.OnTryChangeBlockUserData d)
        {
            if (d.TypeNew == HerbStage1.ItemIndex && d.typeTillNow == BuiltinBlocks.Air)
            {
                Items.UpdatableBlocks.Herbs.OnAdd(d.VoxelToChange, HerbStage1.ItemIndex, d.requestedBy);
            }
            else if (d.TypeNew == BuiltinBlocks.Air && (d.typeTillNow == HerbStage1.ItemIndex || d.typeTillNow == HerbStage2.ItemIndex))
            {
                Items.UpdatableBlocks.Herbs.OnRemove(d.VoxelToChange, d.typeTillNow, d.requestedBy);
            }
            else if (d.TypeNew == HerbBench.ItemIndex && d.typeTillNow == BuiltinBlocks.Air)
            {
                _areaJobTracker.Add(new HerbalistJob(new Bounds(d.VoxelToChange.Vector, new Vector3(6, 0, 6)), d.requestedBy, 0));
            }
            else if (d.TypeNew == BuiltinBlocks.Air && d.typeTillNow == HerbBench.ItemIndex)
            {
                var bounds = new Bounds(d.VoxelToChange.Vector, new Vector3(6, 0, 6));
                var jobPos = new Vector3Int(bounds.min);

                _areaJobTracker.GetList(d.requestedBy)[jobPos].OnRemove();
                _areaJobTracker.Remove(jobPos);
            }

            return(true);
        }
Exemplo n.º 2
0
        public static void OnAdd(Vector3Int position, ushort type, Players.Player player)
        {
            ushort num;

            if (World.TryGetTypeAt(position.Add(0, -1, 0), out num) && ItemTypes.GetType(num).IsFertile)
            {
                BlockTracker.Add(new Herbs(position));
            }
        }
Exemplo n.º 3
0
 public static void Load(JSONNode array)
 {
     if (array == null)
     {
         return;
     }
     foreach (JSONNode current in array.LoopArray())
     {
         try
         {
             BlockTracker.Add(new Herbs((Vector3Int)current["location"], current["growth"].GetAs <float>()));
         }
         catch (Exception exc)
         {
             Log.WriteException("Exception loading a herb block;", exc);
         }
     }
 }
Exemplo n.º 4
0
 void OnAdd(Vector3Int position, ushort type, Players.Player player)
 {
     tracker.Add((T) new T().InitializeOnAdd(position, type, player));
 }