Esempio n. 1
0
        public override void NewRightClick(int i, int j)
        {
            Player player = Main.player[Main.myPlayer];
            Item   currentSelectedItem = player.inventory[player.selectedItem];

            Tile tile = Main.tile[i, j];

            int left = i - (tile.frameX / 18);
            int top  = j - (tile.frameY / 18);

            int index = ModContent.GetInstance <MobSpawnerEntity>().Find(left, top);

            if (index == -1)
            {
                Main.NewText("fail");
                return;
            }

            MobSpawnerEntity mse = (MobSpawnerEntity)TileEntity.ByID[index];

            if (Main.LocalPlayer.HeldItem.modItem is SoulCrystal)
            {
                SoulCrystal sc = Main.LocalPlayer.HeldItem.modItem as SoulCrystal;
                if (sc.isFull())
                {
                    mse.setMob(sc.getMobID());
                }
            }
        }
Esempio n. 2
0
 public override bool CanPlace(int i, int j)
 {
     if (base.CanPlace(i, j))
     {
         int index           = ModContent.GetInstance <MobSpawnerEntity>().Place(i, j);
         MobSpawnerEntity te = (MobSpawnerEntity)TileEntity.ByID[index];
         te.Hook_AfterPlacement(i, j, 0, 0, 0);
         return(true);
     }
     return(false);
 }
Esempio n. 3
0
        public override void ReadData(int x, int y)
        {
            Player player = Main.player[Main.myPlayer];
            Item   currentSelectedItem = player.inventory[player.selectedItem];

            Tile tile = Main.tile[x, y];

            int left = x - (tile.frameX / 18);
            int top  = y - (tile.frameY / 18);

            int index = ModContent.GetInstance <MobSpawnerEntity>().Find(left, top);

            if (index == -1)
            {
                Main.NewText("fail");
                return;
            }

            MobSpawnerEntity mse = (MobSpawnerEntity)TileEntity.ByID[index];

            Main.NewText("Current mob in spawner : " + mse.getCurrentMobName());
            Main.NewText("Time in tick until next spawn : " + mse.getCurrentTimer());
        }